Introduction
This documentation provides a comprehensive overview of the DaaSAPI, designed to support developers in building robust and scalable daas-IoT applications. Within these pages, you will find detailed descriptions of all available methods. This documentation will help you understand the full capabilities of the API and how to leverage them to create efficient and reliable DaaS applications.
DaaS overview
DaaS, acronym of “Device as a Service”, is a net protocol thinked for create overlay-mesh auto-organized and data-oriented relying on existing infrastructures, managing with transparency transceiver, protocols and hardware platforms (CPU, MCU,SoC) heterogeneity. In the heart of DaaS innovation are four innovations – EPRN for resilient interoperability, PSRC for protocol dynamic change, ATFS for devices dynamic and precise synchronization and FRMD for distributed data fragmentation and recomposition – that permit for each nodes, real time valuation of channel metrics and to be able to select the most efficient and safe path to follow with the help of artificial intelligence logics. Regarding this method, DaaS makes the net itself an active part of information flow management, ensuring continuity of service and fast development of new solutions.
DaaS-IoT overview
DaaS-IoT SDK offer a new precompiled standard C/C++ library, technical documentation and usable desktop application (Windows,Linux, macOS), Node.js and Java environments, and microcontrollers such as ESP32 and dsPIC, ensuring that any developer can create application directly with DaaS protocol. Thanks to a driver based modular architecture, DaaS-IoT can support the standard communication protocol – from TCP/IP and UART to MQTT5.0, Bluetooth 5.2, LoRa and many other – furthermore make sure about temporal synchronization, data convergence and communication resilience even with Edge and Fog computing scenarios. Library itself simplifies the provisioning self‑organizing of nodes, “reciver” cloud configuration and hot re-routing of paths, making life simple to developers allowing them to focus on applicative logic maintaining performance, security and scalability.
Available Methods:
The methods for using the library are listed below. All necessary calls are exposed as invocable methods. Here is a summary of the most common ones:
Constructor & Destructor
- DaasAPI()
- DaasAPI(IDaasApiEvent *)
- DaasAPI(IDaasApiEvent *, const char *lhver_)
- ~DaasAPI();
Event Methods
- dinAcceptedEvent(din_t)
- ddoReceivedEvent(payload_size, typeset_t, din_t)
- frisbeeReceivedEvent(din_t)
- nodeStateReceivedEvent(din_t)
General Methods
- const char *getVersion()
- daas_error_t doInit(din_t sid_, din_t din_)
- daas_error_t doPerform(performs_mode_t mode)
- daas_error_t doEnd()
- daas_error_t doReset()
Local configuration & state
- nodestate_t getStatus()
- apilist_t listSystems()
- apilist_t getSystemSettings(const uint32_t id_system)
- apilist_t getSystemStatistics(const uint32_t id_system)
- apilist_t listAvailableDrivers()
- daas_error_t enableDriver(link_t driver_id, const char *local_uri)
- bool storeConfiguration(IDepot* storage_interface)
- bool loadConfiguration(IDepot* storage_interface)
- bool doStatisticsReset(const uint32_t id_system)
- bool setSystemOption(const uint32_t id_system, const uint32_t id_option, const uint32_t option_value_)
Mapping Managing & node disponibility
- daas_error_t map(din_t din)
- daas_error_t map(din_t din, link_t link_, const char* suri)
- daas_error_t map(din_t din, link_t link_, const char* suri, const char* skey)
- daas_error_t remove(din_t din)
- dinlist_t listNodes()
- daas_error_t locate(din_t din)
- const nodestate_t& status(din_t din)
- const nodestate_t& fetch(din_t din, uint16_t opts)
- daas_error_t availablesPull(din_t din, uint32_t &count)
Data transfer
- tsetlist_t &listTypesets()
- daas_error_t addTypeset(uint16_t typeset_code, uint16_t typeset_size)
- daas_error_t pull(din_t din, DDO **inboundDDO)
- daas_error_t push(din_t din, DDO *outboundDDO)
- daas_error_t frisbee(din_t din)
DDO
Constructor & Destructor
- DDO()
- DDO(typeset_t typeset_)
- DDO(typeset_t typeset_, stime_t timestamp_)
- ~DDO()
Timestamp Managing
- void setTimestamp(stime_t tstamp)
- stime_t getTimestamp()
Orignin & identification
- void setOrigin(din_t origin)
- din_t getOrigin() Ottiene il DIN di origine
Settings & Data access
- void clearPayload()
- void setTypeset(typeset_t typeset)
- typeset_t getTypeset()
- void clearPayload()
- void clearPayload()
- inline unsigned char *getPayloadPtr()
- void clearPayload()
- unsigned char* getPayloadPtr()
- uint32_t getPayloadAsBinary(unsigned char *pbuffer_, unsigned offset_, uint32_t maxSize_)
DaasAPI
Syntax:
DaasAPI();
Method Type:
Constructors
Description:
Creates an instance of the DaasAPI class with default settings.
Notes:
- Used to instantiate the API object.
- Used when no event interface or identification code is required.
DaasAPI
Syntax:
DaasAPI(IDaasApiEvent *);
Method Type:
Constructors
Description:
Initializes the DaasAPI instance with an implementation of the event handler interface.
Notes:
- Used to instantiate the API object.
- Event handlers are triggered automatically if provided.
DaasAPI
Syntax:
DaasAPI(IDaasApiEvent *, const char *lhver_);
Method Type:
Constructors
Description:
Initializes the DaasAPI instance with event handling and an identifying version string.
Notes:
- Used to instantiate the API object.
- Event handlers are triggered automatically if provided.
DaasAPI
Syntax:
~DaasAPI();
Method Type:
Destructor
Description:
Releases resources and shuts down the DaaS node.
Notes:
dinAcceptedEvent
Syntax:
dinAcceptedEvent(din_t);
Method Type:
Event handler
Description:
Function called when a new DIN is accepted
Notes:
ddoReceivedEvent
Syntax:
ddoReceivedEvent(payload_size, typeset_t, din_t);
Method Type:
Event handler
Description:
Called when a DDO is received at the node.
Notes:
frisbeeReceivedEvent
Syntax:
frisbeeReceivedEvent(din_t);
Method Type:
Event handler
Description:
Called when a frisbee is returned
Notes:
nodeStateReceivedEvent
Syntax:
nodeStateReceivedEvent(din_t);
Method Type:
Event handler
Description:
Function called when a nodeState sysDDO is received
Notes:
getVersion
Syntax:
getVersion();
Method Type:
General Methods
Description:
Return a string with details about the local stack DaaS version.
Notes:
The returning type string is a const pointer
doInit
Syntax:
doInit(din_t sid_, din_t din_);
Method Type:
General Methods
Description:
Initializes the DaaS net using the provided SID and device identifiers.
Notes:
Returns a daas_error_t when the network is initialised or not, specifying its status.
doPerform(performs_mode_t mode)
Syntax:
doPerform(performs_mode_t mode);
Method Type:
General Methods
Description:
Execute the task of the node (PERFORM_CORE_THREAD – Threaded, PERFORM_CORE_NO_THREAD – RealTime)
Notes:
Returns a daas_error_t when the network is executed or not, specifying its status.
The doPerform called with the parameter PERFORM_CORE_NO_THREAD needs to be called cyclically in order for the node to function correctly
doEnd
Syntax:
doEnd();
Method Type:
General Method
Description:
Function called when a new DIN is accepted
Notes:
Returns a daas_error_t when the resources are released and the node is deactivate, specifying its status.
doReset
Syntax:
doReset();
Method Type:
General Method
Description:
Resets all resources and restarts services.
Notes:
Returns a daas_error_t when the resources are resetted and services are restarted, specifying its status.
getStatus
Syntax:
getStatus();
Method Type:
State & Configuration
Description:
Returns the state of the local node instance
Notes:
The returned value is a nodestate_t
listSystems
Syntax:
listSystems();
Method Type:
State & Configuration
Description:
Return a list of the current active system modules
Notes:
The value returned is an apilist_t
getSystemSettings
Syntax:
getSystemSettings(const uint32_t id_system);
Method Type:
State & Configuration
Description:
Returns active system options
Notes:
The value returned is an apilist_t
getSystemStatistics
Syntax:
getSystemStatistics(const uint32_t id_system)
Method Type:
State & Configuration
Description:
Returns system statistics
Notes:
The value returned is an apilist_t
listAvailableDrivers
Syntax:
listAvailableDrivers()
Method Type:
State & Configuration
Description:
List the available drivers
Notes:
The available drivers type are: 1=”INET4″, 2=”UART”, 3=”MQTT”.
The value returned is an apilist_t
enableDriver
Syntax:
enableDriver(link_t driver_id, const char *local_uri);
Method Type:
State & Configuration
Description:
Activate and configure the passed driver for the net technology
Notes:
Returns a daas_error_t when the driver is activated and configured, specifying its status.
storeConfiguration
Syntax:
storeConfiguration(IDepot* storage_interface);
Method Type:
State & Configuration
Description:
Save the actual configuration
Notes:
Returns a Boolean value indicating whether the configuration is saved or not
loadConfiguration
Syntax:
loadConfiguration(IDepot* storage_interface)
Method Type:
State & Configuration
Description:
Load a configuration
Notes:
Returns a Boolean value indicating whether the configuration is loaded or not
doStatisticsReset
Syntax:
doStatisticsReset(const uint32_t id_system);
Method Type:
State & Configuration
Description:
Reset System Statistics
Notes:
Returns a Boolean value indicating whether the statistics are resetted or not
setSystemOption
Syntax:
setSystemOption(const uint32_t id_system, const uint32_t id_option, const uint32_t option_value_);
Method Type:
State & Configuration
Description:
Set System Options
Notes:
Returns a Boolean value indicating whether the system option are resetted or not.
map
Syntax:
map(din_t din)
Method Type:
Mapping & Disponibility
Description:
Adds a node to the local instance
Notes:
Returns a daas_error_t when a node is mapped to local instances, specifying its status.
map
Syntax:
map(din_t din, link_t link_, const char* suri)
Method Type:
Mapping & Disponibility
Description:
Adds a node to the local instance with identifier and address
Notes:
Returns a daas_error_t when a node is mapped to local instances, specifying its status.
The address could be a link: 1=”INET4″, 2=”UART”or 3=”MQTT5″.
map
Syntax:
map(din_t din, link_t link_, const char* suri, const char* skey)
Method Type:
Mapping & Disponibility
Description:
Adds a node to the local instance with identifier, address and security key
Notes:
Returns a daas_error_t when a node is mapped to local instances, specifying its status.
The address could be a link: 1=”INET4″, 2=”UART”or 3=”MQTT5″.
remove
Syntax:
remove(din_t din);
Method Type:
Mapping & Disponibility
Description:
Removes a node from the local instance.
Notes:
Returns a daas_error_t when a node is removed, specifying its status.
listNodes
Syntax:
listNodes();
Method Type:
Mapping & Disponibility
Description:
Lists the known nodes in the map.
Notes:
locate
Syntax:
locate(din_t din);
Method Type:
Mapping & Disponibility
Description:
Checking node availability
Notes:
Returns a daas_error_t when a node is found, specifying its status.
The node must have no network activity.
status
Syntax:
status(din_t din);
Method Type:
Mapping & Disponibility
Description:
Gets the latest details on the status of the remote node.
Notes:
The returned value is a reference to the state of the node: const nodestate_t.
fetch
Syntax:
fetch(din_t din, uint16_t opts);
Method Type:
Mapping & Disponibility
Description:
It attempts to connect with the remote node to update its status details.
Notes:
The returned value is a reference to the state of the node: const nodestate_t.
availablesPull
Syntax:
availablesPull(din_t din, uint32_t &count);
Method Type:
Mapping & Disponibility
Description:
Returns the number of available DDOs dispatched from the specified din
Notes:
Returns a daas_error_t specifying its status.
listTypesets
Syntax:
listTypesets();
Method Type:
Data
Description:
Lists user-defined typesets.
Notes:
Returns a reference to an object of type tsetlist_t
addTypeset
Syntax:
addTypeset(uint16_t typeset_code, uint16_t typeset_size);
Method Type:
Data
Description:
Adds a new user-defined typeset
Notes:
After adding the typeset it returns a daas_error_t indicating its status
pull
Syntax:
pull(din_t din, DDO **inboundDDO)
Method Type:
Data
Description:
It receives the first available DDO from the specified node.
Notes:
After receiving the DDO it returns a daas_error_t indicating its status
push
Syntax:
push(din_t din, DDO *outboundDDO);
Method Type:
Data
Description:
Sends a DDO to the specified node.
Notes:
After sending the DDO it returns a daas_error_t indicating its status
frisbee
Syntax:
frisbee(din_t din);
Method Type:
Data
Description:
Sends a response request to the remote node.
Notes:
After sending the response request it returns a daas_error_t indicating its status
DDO
Syntax:
DDO();
Method Type:
Constructor & Destructor
Description:
Default constructor
Notes:
DDO
Syntax:
DDO(typeset_t typeset_)
Method Type:
Constructor & Destructor
Description:
Constructor with type assignment
Notes:
The type must be a typeset_t
DDO
Syntax:
DDO(typeset_t typeset_, stime_t timestamp_);
Method Type:
Constructor & Destructor
Description:
Constructor with typeset and timestamp assignment.
Notes:
DDO
Syntax:
~DDO();
Method Type:
Constructor & Destructor
Description:
Destructor
Notes:
setTimestamp
Syntax:
setTimestamp(stime_t tstamp);
Method Type:
Timestamp
Description:
Set DDO timestamp
Notes:
The return value of the function is void
getTimestamp
Syntax:
getTimestamp();
Method Type:
Timestamp
Description:
Return the current timestamp
Notes:
The return value of the function is stime_t
setOrigin
Syntax:
setOrigin(din_t origin);
Method Type:
Origin & Identification
Description:
Set the source DIN.
Notes:
The return value of the function is void
getOrigin
Syntax:
getOrigin();
Method Type:
Origin & Identification
Description:
Get the source DIN
Notes:
Return a din_t type that representing the source DIN
clearPayload
Syntax:
clearPayload();
Method Type:
Payload Managing
Description:
Empty the payload contents
Notes:
The return value of the function is void
setTypeset
Syntax:
setTypeset(typeset_t typeset);
Method Type:
Payload Managing
Description:
Set the data type
Notes:
The data type must be typeset
getTypeset
Syntax:
getTypeset();
Method Type:
Payload Managing
Description:
Returns the assigned typeset.
Notes:
The returned value is a typeset_t representing the assigned typeset
clearPayload
Syntax:
clearPayload();
Method Type:
Payload Managing
Description:
Delete the current payload
Notes:
The return value of the function is void
clearPayload
Syntax:
clearPayload();
Method Type:
Payload Managing
Description:
Deletes the contents of the current payload.
Notes:
The return value of the function is void
getPayloadPtr
Syntax:
getPayloadPtr();
Method Type:
Payload Managing
Description:
Returns a direct pointer to the internal payload.
Notes:
The function’s return value is a pointer to inline unsigned char
getPayloadAsBinary
Syntax:
getPayloadAsBinary(unsigned char *pbuffer_, unsigned offset_, uint32_t maxSize_);
Method Type:
Payload Managing
Description:
Copies the payload into an external buffer as binary data. Returns the number of bytes copied.
Notes:
Il valore di ritorno della funzione è un uint32_t
Lascia un commento