5#ifndef ASTARTE_DEVICE_SDK_DEVICE_GRPC_H
6#define ASTARTE_DEVICE_SDK_DEVICE_GRPC_H
43 DeviceGrpc(
const std::string& server_addr,
const std::string& node_uuid);
68 -> astarte_tl::expected<void, Error>
override;
85 -> astarte_tl::expected<void, Error>
override;
95 auto connect() -> astarte_tl::expected<void, Error>
override;
119 const std::chrono::system_clock::time_point* timestamp)
120 -> astarte_tl::expected<
void,
Error> override;
131 auto
send_object(std::string_view interface_name, std::string_view path,
133 const std::chrono::system_clock::time_point* timestamp)
134 -> astarte_tl::expected<
void,
Error> override;
144 auto
set_property(std::string_view interface_name, std::string_view path, const
Data& data)
145 -> astarte_tl::expected<
void,
Error> override;
155 -> astarte_tl::expected<
void,
Error> override;
194 auto
get_property(std::string_view interface_name, std::string_view path)
198 struct DeviceGrpcImpl;
199 std::shared_ptr<DeviceGrpcImpl> astarte_device_impl_;
Represents a single Astarte data value.
Definition data.hpp:61
Astarte object class, representing the Astarte object datastream data.
Definition object.hpp:33
Device(const Device &other)=delete
Device is non-copyable.
Astarte message class, represents a full message for/from Astarte.
Definition msg.hpp:37
Representing the Astarte individual property data.
Definition property.hpp:22
Represents a stored property on the device.
Definition stored_property.hpp:33
auto get_properties(std::string_view interface_name) -> astarte_tl::expected< std::list< StoredProperty >, Error > override
Retrieves all stored properties belonging to a specific interface.
auto unset_property(std::string_view interface_name, std::string_view path) -> astarte_tl::expected< void, Error > override
Unsets (deletes) a device property.
auto get_property(std::string_view interface_name, std::string_view path) -> astarte_tl::expected< PropertyIndividual, Error > override
Retrieves a specific property value.
auto add_interface_from_str(std::string_view json) -> astarte_tl::expected< void, Error > override
Adds an interface definition to the device from a JSON string.
DeviceGrpc(const std::string &server_addr, const std::string &node_uuid)
Constructor for the Astarte device class.
auto send_object(std::string_view interface_name, std::string_view path, const DatastreamObject &object, const std::chrono::system_clock::time_point *timestamp) -> astarte_tl::expected< void, Error > override
Sends an aggregated object to an Astarte Interface.
DeviceGrpc(DeviceGrpc &&other)=delete
Device is non-moveable.
auto remove_interface(const std::string &interface_name) -> astarte_tl::expected< void, Error > override
Removes an installed interface from the device.
~DeviceGrpc() override
Virtual destructor.
auto operator=(DeviceGrpc &&other) -> DeviceGrpc &=delete
Device is non-moveable.
auto connect() -> astarte_tl::expected< void, Error > override
Connects the device to the Astarte platform.
auto operator=(DeviceGrpc &other) -> DeviceGrpc &=delete
Device is non-copyable.
auto send_individual(std::string_view interface_name, std::string_view path, const Data &data, const std::chrono::system_clock::time_point *timestamp) -> astarte_tl::expected< void, Error > override
Sends an individual data point to an Astarte Interface.
auto add_interface_from_file(const std::filesystem::path &json_file) -> astarte_tl::expected< void, Error > override
Adds an interface definition to the device from a JSON file.
DeviceGrpc(DeviceGrpc &other)=delete
Device is non-copyable.
auto set_property(std::string_view interface_name, std::string_view path, const Data &data) -> astarte_tl::expected< void, Error > override
Updates a local device property and synchronize it with Astarte.
auto disconnect() -> astarte_tl::expected< void, Error > override
Disconnects the device from Astarte.
auto get_all_properties(const std::optional< Ownership > &ownership) -> astarte_tl::expected< std::list< StoredProperty >, Error > override
Retrieves all stored properties matching an ownership filter.
auto poll_incoming(const std::chrono::milliseconds &timeout) -> std::optional< Message > override
Polls for incoming messages from Astarte.
auto is_connected() const -> bool override
Checks connectivity status.
Astarte data class and its related methods.
Abstract Astarte device interface.
Error types and handling for the Astarte device library.
Astarte message class and its related methods.
Namespace for Astarte device functionality using the gRPC transport layer.
Definition device_grpc.hpp:29
Ownership
Possible Astarte ownership.
Definition ownership.hpp:23
std::variant< DataSerializationError, InternalError, FileOpenError, InvalidInputError, InterfaceValidationError, InvalidInterfaceVersionError, InvalidInterfaceTypeError, InvalidInterfaceOwnershipeError, InvalidInterfaceAggregationError, InvalidAstarteTypeError, InvalidReliabilityError, InvalidRetentionError, InvalidDatabaseRetentionPolicyError, OperationRefusedError, GrpcLibError, MsgHubError, mqtt::JsonParsingError, mqtt::DeviceRegistrationError, mqtt::PairingApiError, mqtt::MqttError, mqtt::InvalidUrlError, mqtt::RetrieveBrokerUrlError, mqtt::ReadCredentialError, mqtt::WriteCredentialError, mqtt::PairingConfigError, mqtt::CryptoError, mqtt::UuidError, mqtt::HttpError, mqtt::MqttConnectionError > Error
Variant type representing any error from the Astarte device library.
Definition errors.hpp:80
Astarte object class and its related methods.
Astarte individual property class and its related methods.