Viam C++ SDK current
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
viam::sdk::impl::AudioInClient Class Reference

gRPC client implementation of a AudioIn component. More...

#include <audio_in_client.hpp>

+ Inheritance diagram for viam::sdk::impl::AudioInClient:

Public Types

using interface_type = AudioIn
 

Public Member Functions

 AudioInClient (std::string name, std::shared_ptr< grpc::Channel > channel)
 
void get_audio (std::string const &codec, std::function< bool(audio_chunk &&chunk)> const &chunk_handler, double const &duration_seconds, int64_t const &previous_timestamp, const ProtoStruct &extra) override
 Get a stream of audio from the device until completed or cancelled.
 
audio_properties get_properties (const ProtoStruct &extra) override
 Returns properties of the audio in device (supported codecs, sample rate, number of channels)
 
ProtoStruct do_command (const ProtoStruct &command) override
 
std::vector< GeometryConfigget_geometries (const ProtoStruct &extra) override
 Returns GeometryConfigs associated with the calling AudioIn.
 
void get_audio (std::string const &codec, std::function< bool(audio_chunk &&chunk)> const &chunk_handler, double const &duration_seconds, int64_t const &previous_timestamp)
 Get a stream of audio from the device until completed or cancelled.
 
virtual void get_audio (std::string const &codec, std::function< bool(audio_chunk &&chunk)> const &chunk_handler, double const &duration_seconds, int64_t const &previous_timestamp, const ProtoStruct &extra)=0
 Get a stream of audio from the device until completed or cancelled.
 
std::vector< GeometryConfigget_geometries ()
 Returns GeometryConfigs associated with the calling AudioIn.
 
virtual std::vector< GeometryConfigget_geometries (const ProtoStruct &extra)=0
 Returns GeometryConfigs associated with the calling AudioIn.
 
audio_properties get_properties ()
 Returns properties of the audio in device (supported codecs, sample rate, number of channels)
 
virtual audio_properties get_properties (const ProtoStruct &extra)=0
 Returns properties of the audio in device (supported codecs, sample rate, number of channels)
 
- Public Member Functions inherited from viam::sdk::AudioIn
void get_audio (std::string const &codec, std::function< bool(audio_chunk &&chunk)> const &chunk_handler, double const &duration_seconds, int64_t const &previous_timestamp)
 Get a stream of audio from the device until completed or cancelled.
 
audio_properties get_properties ()
 Returns properties of the audio in device (supported codecs, sample rate, number of channels)
 
std::vector< GeometryConfigget_geometries ()
 Returns GeometryConfigs associated with the calling AudioIn.
 
API api () const override
 Returns the API associated with a particular resource.
 
- Public Member Functions inherited from viam::sdk::Component
Name get_resource_name () const override
 Returns the Name for a particular resource.
 
- Public Member Functions inherited from viam::sdk::Resource
 Resource (std::string name)
 
virtual std::string name () const
 Return the resource's name.
 
void set_log_level (log_level) const
 Set the log level for log messages originating from this Resource.
 

Additional Inherited Members

- Protected Member Functions inherited from viam::sdk::AudioIn
 AudioIn (std::string name)
 
- Protected Member Functions inherited from viam::sdk::Component
 Component (std::string name)
 
- Protected Member Functions inherited from viam::sdk::Resource
Name get_resource_name (const std::string &type) const
 
- Protected Attributes inherited from viam::sdk::Resource
LogSource logger_
 

Detailed Description

gRPC client implementation of a AudioIn component.

Member Function Documentation

◆ do_command()

ProtoStruct viam::sdk::impl::AudioInClient::do_command ( const ProtoStruct & command)
overridevirtual
Parameters
Commandthe command to execute.
Returns
The result of the executed command.

Implements viam::sdk::AudioIn.

◆ get_audio() [1/3]

void viam::sdk::AudioIn::get_audio ( std::string const & codec,
std::function< bool(audio_chunk &&chunk)> const & chunk_handler,
double const & duration_seconds,
int64_t const & previous_timestamp )
inline

Get a stream of audio from the device until completed or cancelled.

Parameters
codecrequested codec of the audio data
chunk_handlercallback function to call when an audio response is received. This should return true to keep streaming audio and false to indicate that the stream should terminate. The callback function should not be blocking.
duration_secondsduration of audio stream. If not set, stream duration is indefinite.
previous_timestamptimestamp to start the audio stream from for continuity between multiple calls. If not set, will stream data

◆ get_audio() [2/3]

void viam::sdk::impl::AudioInClient::get_audio ( std::string const & codec,
std::function< bool(audio_chunk &&chunk)> const & chunk_handler,
double const & duration_seconds,
int64_t const & previous_timestamp,
const ProtoStruct & extra )
overridevirtual

Get a stream of audio from the device until completed or cancelled.

Parameters
codecrequested codec of the audio data
chunk_handlercallback function to call when an audio response is received. For an infinite stream this should return true to keep streaming audio and false to indicate that the stream should terminate. The callback function should not be blocking.
duration_secondsduration of audio stream. If zero, stream duration is indefinite.
previous_timestamptimestamp to start the audio stream from for continuity between multiple calls. If zero, will stream data
extraAny additional arguments to the method

Implements viam::sdk::AudioIn.

◆ get_audio() [3/3]

virtual void viam::sdk::AudioIn::get_audio ( std::string const & codec,
std::function< bool(audio_chunk &&chunk)> const & chunk_handler,
double const & duration_seconds,
int64_t const & previous_timestamp,
const ProtoStruct & extra )
virtual

Get a stream of audio from the device until completed or cancelled.

Parameters
codecrequested codec of the audio data
chunk_handlercallback function to call when an audio response is received. For an infinite stream this should return true to keep streaming audio and false to indicate that the stream should terminate. The callback function should not be blocking.
duration_secondsduration of audio stream. If zero, stream duration is indefinite.
previous_timestamptimestamp to start the audio stream from for continuity between multiple calls. If zero, will stream data
extraAny additional arguments to the method

Implements viam::sdk::AudioIn.

◆ get_geometries() [1/3]

std::vector< GeometryConfig > viam::sdk::AudioIn::get_geometries ( )
inline

Returns GeometryConfigs associated with the calling AudioIn.

Returns
The requested GeometryConfigs associated with the component.

◆ get_geometries() [2/3]

std::vector< GeometryConfig > viam::sdk::impl::AudioInClient::get_geometries ( const ProtoStruct & extra)
overridevirtual

Returns GeometryConfigs associated with the calling AudioIn.

Parameters
extraAny additional arguments to the method.
Returns
The requested GeometryConfigs associated with the component.

Implements viam::sdk::AudioIn.

◆ get_geometries() [3/3]

virtual std::vector< GeometryConfig > viam::sdk::AudioIn::get_geometries ( const ProtoStruct & extra)
virtual

Returns GeometryConfigs associated with the calling AudioIn.

Parameters
extraAny additional arguments to the method.
Returns
The requested GeometryConfigs associated with the component.

Implements viam::sdk::AudioIn.

◆ get_properties() [1/2]

audio_properties viam::sdk::impl::AudioInClient::get_properties ( const ProtoStruct & extra)
overridevirtual

Returns properties of the audio in device (supported codecs, sample rate, number of channels)

Parameters
extraAny additional arguments to the method

Implements viam::sdk::AudioIn.

◆ get_properties() [2/2]

virtual audio_properties viam::sdk::AudioIn::get_properties ( const ProtoStruct & extra)
virtual

Returns properties of the audio in device (supported codecs, sample rate, number of channels)

Parameters
extraAny additional arguments to the method

Implements viam::sdk::AudioIn.


The documentation for this class was generated from the following file: