|
Astarte device API for C++ 0.7.1
Astarte device SDK for C++
|
Interface for an Astarte device. More...
#include <device.hpp>
Inheritance diagram for AstarteDeviceSdk::AstarteDevice:Public Member Functions | |
| 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. | |
| virtual void | add_interface_from_file (const std::filesystem::path &json_file)=0 |
| Add an interface for the device from a JSON file. | |
| virtual void | add_interface_from_str (std::string_view json)=0 |
| Add an interface for the device from a JSON string view. | |
| virtual void | remove_interface (const std::string &interface_name)=0 |
| Remove an installed interface. | |
| virtual void | connect ()=0 |
| Connect the device to Astarte. | |
| virtual auto | is_connected () const -> bool=0 |
| Check if the device is connected to the Astarte message hub. | |
| virtual void | disconnect ()=0 |
| Disconnect the device from Astarte. | |
| virtual void | send_individual (std::string_view interface_name, std::string_view path, const AstarteData &data, const std::chrono::system_clock::time_point *timestamp)=0 |
| Send an individual data payload to Astarte. | |
| virtual void | send_object (std::string_view interface_name, std::string_view path, const AstarteDatastreamObject &object, const std::chrono::system_clock::time_point *timestamp)=0 |
| Send an aggregate object data payload to Astarte. | |
| virtual void | set_property (std::string_view interface_name, std::string_view path, const AstarteData &data)=0 |
| Set a device property on Astarte. | |
| virtual void | unset_property (std::string_view interface_name, std::string_view path)=0 |
| Unset a device property on Astarte. | |
| virtual auto | poll_incoming (const std::chrono::milliseconds &timeout) -> std::optional< AstarteMessage >=0 |
| Poll for incoming messages from Astarte. | |
Protected Member Functions | |
| AstarteDevice ()=default | |
| Protected default constructor. | |
Interface for an Astarte device.
This class defines a transport independent abstract class to be used by derived classes to implement transport dependent device classes.
|
virtualdefault |
Virtual destructor.
Ensures proper cleanup of derived classes through a base pointer.
|
delete |
Copy constructor for the Astarte device class.
|
default |
Move constructor for the Astarte device class.
| other | Object to move. |
|
protecteddefault |
Protected default constructor.
Prevents direct instantiation of the interface.
|
pure virtual |
Add an interface for the device from a JSON file.
| json_file | The path to the .json interface file. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Add an interface for the device from a JSON string view.
| json | The interface definition as a JSON string view. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Connect the device to Astarte.
This is an asynchronous function. It starts a management process that will handle the device's connectivity in the background.
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Disconnect the device from Astarte.
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
nodiscardpure virtual |
Check if the device is connected to the Astarte message hub.
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
default |
Move assignment operator for the Astarte device class.
| other | Object to move. |
|
delete |
Copy assignment operator for the Astarte device class.
|
pure virtual |
Poll for incoming messages from Astarte.
| timeout | The maximum time to block waiting for a message. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Remove an installed interface.
| interface_name | The interface name. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Send an individual data payload to Astarte.
| interface_name | The name of the target interface. |
| path | The specific endpoint path within the interface. |
| data | The data payload to send. |
| timestamp | An optional timestamp for the data point. If nullptr, Astarte will assign one. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Send an aggregate object data payload to Astarte.
| interface_name | The name of the target interface. |
| path | The common base path for the data object. |
| object | The aggregate data object to send. |
| timestamp | An optional timestamp for the data. If nullptr, Astarte will assign one. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Set a device property on Astarte.
| interface_name | The name of the interface containing the property. |
| path | The full path to the property. |
| data | The value to set for the property. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.
|
pure virtual |
Unset a device property on Astarte.
| interface_name | The name of the interface containing the property. |
| path | The full path to the property to unset. |
Implemented in AstarteDeviceSdk::AstarteDeviceGRPC.