|
Astarte device API for C++ 0.8.1
Astarte device SDK for C++
|
Class for the Astarte devices. More...
#include <device_grpc.hpp>
Inheritance diagram for AstarteDeviceSdk::AstarteDeviceGrpc:Public Member Functions | |
| AstarteDeviceGrpc (const std::string &server_addr, const std::string &node_uuid) | |
| Constructor for the Astarte device class. | |
| ~AstarteDeviceGrpc () override | |
| Destructor for the Astarte device class. | |
| AstarteDeviceGrpc (AstarteDeviceGrpc &other)=delete | |
| Copy constructor for the Astarte device class. | |
| AstarteDeviceGrpc (AstarteDeviceGrpc &&other)=delete | |
| Move constructor for the Astarte device class. | |
| auto | operator= (AstarteDeviceGrpc &other) -> AstarteDeviceGrpc &=delete |
| Copy assignment operator for the Astarte device class. | |
| auto | operator= (AstarteDeviceGrpc &&other) -> AstarteDeviceGrpc &=delete |
| Move assignment operator for the Astarte device class. | |
| auto | add_interface_from_file (const std::filesystem::path &json_file) -> astarte_tl::expected< void, AstarteError > override |
| Add an interface for the device from a JSON file. | |
| auto | add_interface_from_str (std::string_view json) -> astarte_tl::expected< void, AstarteError > override |
| Add an interface for the device from a JSON string view. | |
| auto | remove_interface (const std::string &interface_name) -> astarte_tl::expected< void, AstarteError > override |
| Remove an installed interface. | |
| auto | connect () -> astarte_tl::expected< void, AstarteError > override |
| Connect the device to Astarte. | |
| auto | is_connected () const -> bool override |
| Check if the device is connected. | |
| auto | disconnect () -> astarte_tl::expected< void, AstarteError > override |
| Disconnect from Astarte. | |
| auto | send_individual (std::string_view interface_name, std::string_view path, const AstarteData &data, const std::chrono::system_clock::time_point *timestamp) -> astarte_tl::expected< void, AstarteError > override |
| Send individual data to Astarte. | |
| auto | send_object (std::string_view interface_name, std::string_view path, const AstarteDatastreamObject &object, const std::chrono::system_clock::time_point *timestamp) -> astarte_tl::expected< void, AstarteError > override |
| Send object data to Astarte. | |
| auto | set_property (std::string_view interface_name, std::string_view path, const AstarteData &data) -> astarte_tl::expected< void, AstarteError > override |
| Set a device property. | |
| auto | unset_property (std::string_view interface_name, std::string_view path) -> astarte_tl::expected< void, AstarteError > override |
| Unset a device property. | |
| auto | poll_incoming (const std::chrono::milliseconds &timeout) -> std::optional< AstarteMessage > override |
| Poll incoming messages. | |
| auto | get_all_properties (const std::optional< AstarteOwnership > &ownership) -> astarte_tl::expected< std::list< AstarteStoredProperty >, AstarteError > |
| Get all stored properties matching the input filter. | |
| auto | get_properties (std::string_view interface_name) -> astarte_tl::expected< std::list< AstarteStoredProperty >, AstarteError > |
| Get stored properties matching the interface. | |
| auto | get_property (std::string_view interface_name, std::string_view path) -> astarte_tl::expected< AstartePropertyIndividual, AstarteError > |
| Get a single stored property matching the interface name and path. | |
Public Member Functions inherited from AstarteDeviceSdk::AstarteDevice | |
| virtual | ~AstarteDevice ()=default |
| Virtual destructor. | |
| AstarteDevice (const AstarteDevice &other)=delete | |
| Copy constructor for the Astarte device class. | |
| AstarteDevice (AstarteDevice &&other)=default | |
| Move constructor for the Astarte device class. | |
| auto | operator= (const AstarteDevice &other) -> AstarteDevice &=delete |
| Copy assignment operator for the Astarte device class. | |
| auto | operator= (AstarteDevice &&other) -> AstarteDevice &=default |
| Move assignment operator for the Astarte device class. | |
Additional Inherited Members | |
Protected Member Functions inherited from AstarteDeviceSdk::AstarteDevice | |
| AstarteDevice ()=default | |
| Protected default constructor. | |
Class for the Astarte devices.
This class should be instantiated once and then used to communicate with Astarte.
| AstarteDeviceSdk::AstarteDeviceGrpc::AstarteDeviceGrpc | ( | const std::string & | server_addr, |
| const std::string & | node_uuid ) |
Constructor for the Astarte device class.
| server_addr | The gRPC server address of the Astarte message hub. |
| node_uuid | The UUID identifier for this device with the Astarte message hub. |
|
override |
Destructor for the Astarte device class.
|
delete |
Copy constructor for the Astarte device class.
|
delete |
Move constructor for the Astarte device class.
|
overridevirtual |
Add an interface for the device from a JSON file.
| json_file | The path to the .json interface file. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Add an interface for the device from a JSON string view.
| json | The interface definition as a JSON string view. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Connect the device to Astarte.
This is an asynchronous funciton. It will start a management thread that will manage the device connectivity.
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
| auto AstarteDeviceSdk::AstarteDeviceGrpc::get_all_properties | ( | const std::optional< AstarteOwnership > & | ownership | ) | -> astarte_tl::expected< std::list< AstarteStoredProperty >, AstarteError > |
Get all stored properties matching the input filter.
| ownership | Optional ownership filter. |
| auto AstarteDeviceSdk::AstarteDeviceGrpc::get_properties | ( | std::string_view | interface_name | ) | -> astarte_tl::expected< std::list< AstarteStoredProperty >, AstarteError > |
Get stored properties matching the interface.
| interface_name | The name of the interface for the properties. |
| auto AstarteDeviceSdk::AstarteDeviceGrpc::get_property | ( | std::string_view | interface_name, |
| std::string_view | path ) -> astarte_tl::expected< AstartePropertyIndividual, AstarteError > |
Get a single stored property matching the interface name and path.
| interface_name | The name of the interface for the property. |
| path | Exact path for the property. |
|
nodiscardoverridevirtual |
Check if the device is connected.
Implements AstarteDeviceSdk::AstarteDevice.
|
delete |
Move assignment operator for the Astarte device class.
|
delete |
Copy assignment operator for the Astarte device class.
|
overridevirtual |
Poll incoming messages.
| timeout | Will block for this timeout if no message is present. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Remove an installed interface.
| interface_name | The interface name. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Send individual data to Astarte.
| interface_name | The name of the interface on which to send the data. |
| path | The path to the interface endpoint to use for sending. |
| data | The data to send. |
| timestamp | The timestamp for the data, this might be a nullptr. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Send object data to Astarte.
| interface_name | The name of the interface on which to send the data. |
| path | The common path to the interface endpoint to use for sending. |
| object | The data to send. |
| timestamp | The timestamp for the data, this might be a nullptr. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Set a device property.
| interface_name | The name of the interface for the property. |
| path | The property full path. |
| data | The property data. |
Implements AstarteDeviceSdk::AstarteDevice.
|
overridevirtual |
Unset a device property.
| interface_name | The name of the interface for the property. |
| path | The property full path. |
Implements AstarteDeviceSdk::AstarteDevice.