8#include <viam/sdk/common/grpc_fwd.hpp>
16 const std::string& type()
const;
17 const std::string& payload()
const;
25 ViamChannel(std::shared_ptr<GrpcChannel> channel,
char* path,
void* runtime);
32 const std::optional<Credentials>& credentials()
const;
33 const std::optional<std::string>& entity()
const;
34 bool allows_insecure_downgrade()
const;
35 bool webrtc_disabled()
const;
36 const std::chrono::duration<float>& timeout()
const;
37 int initial_connection_attempts()
const;
38 std::chrono::duration<float> initial_connection_attempt_timeout()
const;
69 std::optional<std::string> auth_entity_;
71 std::optional<Credentials> credentials_;
73 bool allow_insecure_downgrade_ =
false;
75 bool disable_webrtc_ =
false;
77 std::chrono::duration<float> timeout_{20};
79 int initial_connection_attempts_ = 3;
81 std::chrono::duration<float> initial_connection_attempt_timeout_{20};
84 explicit ViamChannel(std::shared_ptr<GrpcChannel> channel);
86 ViamChannel(ViamChannel&&) noexcept;
88 ViamChannel& operator=(ViamChannel&&) noexcept;
110 const std::shared_ptr<GrpcChannel>& channel() const;
135 std::unique_ptr<impl> pimpl_;
139 [[deprecated("This class is now a member class of
ViamChannel::
Options. The alias DialOptions "
147 Options(
unsigned int refresh_interval, std::optional<ViamChannel::Options> channel_options)
148 : refresh_interval_(std::move(refresh_interval)),
149 channel_options_(std::move(channel_options)) {}
155 std::chrono::seconds check_every_interval()
const;
157 std::chrono::seconds reconnect_every_interval()
const;
171 [[deprecated(
"Please update your function calls to channel_options")]]
172 const std::optional<ViamChannel::Options>&
173 dial_options()
const;
175 const std::optional<ViamChannel::Options>& channel_options()
const;
178 std::chrono::seconds refresh_interval_{0};
180 std::chrono::seconds check_every_interval_{0};
182 std::chrono::seconds reconnect_every_interval_{0};
184 std::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_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_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....
Options & set_credentials(std::optional< Credentials > creds)
Set Credentials for connecting to the robot.
Options & set_entity(std::optional< std::string > entity)
Set the URL to authenticate against.
const std::optional< std::string > & auth_token() const
Returns the bearer token for connecting to the robot if one is needed; else returns null.
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(const char *uri, const std::optional< Options > &options)
Connects to a robot at the given URI address, using the provided dial options (or default options is ...
static ViamChannel dial_initial(const char *uri, const std::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