Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
viam::sdk::ViamChannel Class Reference

Classes

class  Options
 

Public Member Functions

 ViamChannel (std::shared_ptr< GrpcChannel > channel)
 
 ViamChannel (ViamChannel &&) noexcept
 
ViamChanneloperator= (ViamChannel &&) noexcept
 
const std::shared_ptr< GrpcChannel > & channel () const
 
const boost::optional< std::string > & auth_token () const
 Returns the bearer token for connecting to the robot if one is needed; else returns null.
 
const char * get_channel_addr () const
 Returns the address of the robot to which this channel is connected.
 
void close ()
 Closes the connection of this channel to its associated robot. This method is called by the destructor of ViamChannel. No further operations can be performed on the channel afterwards except to assign a new value to it.
 

Static Public Member Functions

static ViamChannel dial (const char *uri, const boost::optional< Options > &options)
 Connects to a robot at the given URI address, using the provided dial options (or default options is none are provided). Ignores initial connection options specifying how many times to attempt to connect and with what timeout. In general, use of this method is discouraged. RobotClient::at_address(...) is the preferred method to connect to a robot, and creates the channel itself.
 
static ViamChannel dial_initial (const char *uri, const boost::optional< Options > &options)
 Dials to a robot at the given URI address, using the provided dial options (or default options is none are provided). Additionally specifies that this dial is an initial connection attempt and so uses the initial connection options. In general, use of this method is discouraged. RobotClient::at_address(...) is the preferred method to connect to a robot, and creates the channel itself.
 

Friends

class ViamClient
 

Member Function Documentation

◆ auth_token()

const boost::optional< std::string > & viam::sdk::ViamChannel::auth_token ( ) const

Returns the bearer token for connecting to the robot if one is needed; else returns null.

Remarks
When dialing with disable_webrtc = true and grpc >= 1.43.0, a bearer token is needed for all client requests. If you use ClientHelper for client requests this is handled automatically, otherwise you will have to add this to the client context of a grpc call.

◆ dial()

static ViamChannel viam::sdk::ViamChannel::dial ( const char * uri,
const boost::optional< Options > & options )
static

Connects to a robot at the given URI address, using the provided dial options (or default options is none are provided). Ignores initial connection options specifying how many times to attempt to connect and with what timeout. In general, use of this method is discouraged. RobotClient::at_address(...) is the preferred method to connect to a robot, and creates the channel itself.

Exceptions
Exceptionif it is unable to establish a connection to the provided URI

◆ dial_initial()

static ViamChannel viam::sdk::ViamChannel::dial_initial ( const char * uri,
const boost::optional< Options > & options )
static

Dials to a robot at the given URI address, using the provided dial options (or default options is none are provided). Additionally specifies that this dial is an initial connection attempt and so uses the initial connection options. In general, use of this method is discouraged. RobotClient::at_address(...) is the preferred method to connect to a robot, and creates the channel itself.

Exceptions
Exceptionif it is unable to establish a connection to the provided URI within the given number of initial connection attempts

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