7#include <boost/optional.hpp>
9#include <viam/sdk/common/grpc_fwd.hpp>
17 const std::string& type()
const;
18 const std::string& payload()
const;
26 ViamChannel(std::shared_ptr<GrpcChannel> channel,
char* path,
void* runtime);
33 const boost::optional<Credentials>& credentials()
const;
34 const boost::optional<std::string>& entity()
const;
35 bool allows_insecure_downgrade()
const;
36 bool webrtc_disabled()
const;
37 const std::chrono::duration<float>& timeout()
const;
38 int initial_connection_attempts()
const;
39 std::chrono::duration<float> initial_connection_attempt_timeout()
const;
70 boost::optional<std::string> auth_entity_;
72 boost::optional<Credentials> credentials_;
74 bool allow_insecure_downgrade_ =
false;
76 bool disable_webrtc_ =
false;
78 std::chrono::duration<float> timeout_{20};
80 int initial_connection_attempts_ = 3;
82 std::chrono::duration<float> initial_connection_attempt_timeout_{20};
85 explicit ViamChannel(std::shared_ptr<GrpcChannel> channel);
87 ViamChannel(ViamChannel&&) noexcept;
89 ViamChannel& operator=(ViamChannel&&) noexcept;
111 const std::shared_ptr<GrpcChannel>& channel() const;
136 std::unique_ptr<impl> pimpl_;
140 [[deprecated("This class is now a member class of
ViamChannel::
Options. The alias DialOptions "
148 Options(
unsigned int refresh_interval, boost::optional<ViamChannel::Options> channel_options)
149 : refresh_interval_(std::move(refresh_interval)),
150 channel_options_(std::move(channel_options)) {}
156 std::chrono::seconds check_every_interval()
const;
158 std::chrono::seconds reconnect_every_interval()
const;
172 [[deprecated(
"Please update your function calls to channel_options")]]
173 const boost::optional<ViamChannel::Options>&
174 dial_options()
const;
176 const boost::optional<ViamChannel::Options>& channel_options()
const;
179 std::chrono::seconds refresh_interval_{0};
181 std::chrono::seconds check_every_interval_{0};
183 std::chrono::seconds reconnect_every_interval_{0};
185 boost::optional<ViamChannel::Options> channel_options_;
Options & set_reconnect_every_interval(std::chrono::seconds interval)
Sets how often to attempt to reconnect to the robot when disconnected. If set to 0,...
std::chrono::seconds refresh_interval() const
How often to refresh the status/parts of the robot, in seconds. If set to 0, the robot will not autom...
Options & set_check_every_interval(std::chrono::seconds interval)
Sets how often to verify connectivity to the robot, in seconds. If set to 0, will not check,...
Options & set_initial_connection_attempts(int attempts)
Set the number of attempts to make when initially connecting to a robot If set to 0 or a negative int...
Options & set_entity(boost::optional< std::string > entity)
Set the URL to authenticate against.
Options & set_initial_connection_attempt_timeout(std::chrono::duration< float > timeout)
Set the timeout of connection attempts when initially dialing a robot Defaults to 20sec to match the ...
Options & set_credentials(boost::optional< Credentials > creds)
Set Credentials for connecting to the robot.
Options & set_timeout(std::chrono::duration< float > timeout)
Set the duration before the dial connection times out Set to 20sec to match _defaultOfferDeadline in ...
Options & set_webrtc_disabled(bool disable_webrtc)
Set whether to bypass WebRTC and connect directly to the robot. This dials directly through grpc bypa...
Options & set_allow_insecure_downgrade(bool allow)
Set whether to allow the RPC connection to be downgraded to an insecure connection if detected....
const boost::optional< std::string > & auth_token() const
Returns the bearer token for connecting to the robot if one is needed; else returns null.
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 ...
void close()
Closes the connection of this channel to its associated robot. This method is called by the destructo...
const char * get_channel_addr() const
Returns the address of the robot to which this channel is connected.
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 non...
Definition viam_client.hpp:6