Verified Telemetry
Data Structures | Macros | Typedefs | Functions
nx_verified_telemetry.h File Reference
#include "nx_azure_iot_json_reader.h"
#include "nx_azure_iot_json_writer.h"
#include "nx_azure_iot_pnp_client.h"
#include "nx_vt_currentsense_component.h"
#include "nx_vt_fallcurve_component.h"

Go to the source code of this file.

Data Structures

union  NX_VT_SIGNATURE_COMPONENT_UNION_TAG
 
struct  NX_VT_OBJECT_TAG
 
struct  NX_VERIFIED_TELEMETRY_DB_TAG
 

Macros

#define VT_SIGNATURE_TYPE_FALLCURVE   0x01
 
#define VT_SIGNATURE_TYPE_CURRENTSENSE   0x02
 
#define VT_MINIMUM_BUFFER_SIZE_BYTES   sizeof(VT_CURRENTSENSE_RAW_SIGNATURES_READER)
 

Typedefs

typedef struct NX_VT_OBJECT_TAG NX_VT_OBJECT
 
typedef struct NX_VERIFIED_TELEMETRY_DB_TAG NX_VERIFIED_TELEMETRY_DB
 

Functions

UINT nx_vt_init (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, UCHAR *component_name_ptr, bool enable_verified_telemetry, VT_DEVICE_DRIVER *device_driver, CHAR *scratch_buffer, UINT scratch_buffer_length)
 Initializes Global Verified Telemetry using platform specific device drivers. More...
 
UINT nx_vt_signature_init (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_VT_OBJECT *handle, UCHAR *component_name_ptr, UINT signature_type, UCHAR *associated_telemetry, bool telemetry_status_auto_update, VT_SENSOR_HANDLE *sensor_handle)
 Initializes Verified Telemetry for a particular sensor data stream. More...
 
UINT nx_vt_process_command (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *iotpnp_client_ptr, UCHAR *component_name_ptr, UINT component_name_length, UCHAR *pnp_command_name_ptr, UINT pnp_command_name_length, NX_AZURE_IOT_JSON_READER *json_reader_ptr, NX_AZURE_IOT_JSON_WRITER *json_response_ptr, UINT *status_code)
 Processes all commands supported by VT Middleware. More...
 
UINT nx_vt_process_property_update (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *iotpnp_client_ptr, const UCHAR *component_name_ptr, UINT component_name_length, NX_AZURE_IOT_JSON_READER *name_value_reader_ptr, UINT version)
 Processes all desired property updates supported by vT Middleware. More...
 
UINT nx_vt_properties (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *iotpnp_client_ptr)
 Creates payloads and sends all reported properties supported by VT Middleware. More...
 
UINT nx_vt_send_desired_property_after_boot (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *iotpnp_client_ptr, UINT message_type)
 Updates Digital Twin with default desired property values when device is booted for the first time. More...
 
UINT nx_vt_process_reported_property_sync (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *iotpnp_client_ptr, const UCHAR *component_name_ptr, UINT component_name_length, NX_AZURE_IOT_JSON_READER *name_value_reader_ptr, UINT version)
 Synchronizes VT Settings stored in digital Twin as reported properties at startup. More...
 
UINT nx_vt_verified_telemetry_message_create_send (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *pnp_client_ptr, const UCHAR *component_name_ptr, UINT component_name_length, UINT wait_option, const UCHAR *telemetry_data, UINT data_size)
 Creates and sends telemetry JSON with message properties containing telemetry status. More...
 
UINT nx_vt_compute_evaluate_fingerprint_all_sensors (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB)
 Computes status of all telemetries which have been initialized to provide Verified Telemetry. More...
 
UINT nx_vt_azure_iot_pnp_client_component_add (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, NX_AZURE_IOT_PNP_CLIENT *pnp_client_ptr)
 Adds VT Information Interfaces that are initialized to the nx_pnp_client object. More...
 
UINT nx_vt_signature_read (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, UCHAR *associated_telemetry, UINT associated_telemetry_length, UINT mode)
 Starts reading VT signatures for the sensor mapped to the telemetry string passed. More...
 
UINT nx_vt_signature_process (NX_VERIFIED_TELEMETRY_DB *verified_telemetry_DB, UCHAR *associated_telemetry, UINT associated_telemetry_length)
 Processes the collected VT signatures for the sensor mapped to the telemetry string passed. More...
 

Function Documentation

◆ nx_vt_azure_iot_pnp_client_component_add()

UINT nx_vt_azure_iot_pnp_client_component_add ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  pnp_client_ptr 
)

Adds VT Information Interfaces that are initialized to the nx_pnp_client object.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]pnp_client_ptrPointer to initialized Azure IoT PnP instance.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_compute_evaluate_fingerprint_all_sensors()

UINT nx_vt_compute_evaluate_fingerprint_all_sensors ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB)

Computes status of all telemetries which have been initialized to provide Verified Telemetry.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_init()

UINT nx_vt_init ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
UCHAR *  component_name_ptr,
bool  enable_verified_telemetry,
VT_DEVICE_DRIVER *  device_driver,
CHAR *  scratch_buffer,
UINT  scratch_buffer_length 
)

Initializes Global Verified Telemetry using platform specific device drivers.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]component_name_ptrName of the PnP component. Example - "vTDevice"
[in]enableVerifiedTelemetryUser specified value to set Verified Telemetry active or inactive, can also be configured during runtime from a writable Digital Twin property.
[in]device_driverThe platform specific device driver components for interacting with the device hardware.
[in]scratch_bufferPointer to byte buffer passed from application layer, used for fingerprint calculation/storage.
[in]scratch_buffer_lengthLength of byte buffer passed from application layer, used for fingerprint calculation/storage.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_process_command()

UINT nx_vt_process_command ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  iotpnp_client_ptr,
UCHAR *  component_name_ptr,
UINT  component_name_length,
UCHAR *  pnp_command_name_ptr,
UINT  pnp_command_name_length,
NX_AZURE_IOT_JSON_READER *  json_reader_ptr,
NX_AZURE_IOT_JSON_WRITER *  json_response_ptr,
UINT *  status_code 
)

Processes all commands supported by VT Middleware.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]iotpnp_client_ptrPointer to initialized Azure IoT PnP instance.
[in]component_name_ptrName of the component.
[in]component_name_lengthLength of name of the component.
[in]pnp_command_name_ptrName of the command invoked.
[in]pnp_command_name_lengthLength of name of the command invoked.
[in]json_reader_ptrPointer to read the JSON payload of command.
[in]json_response_ptrPointer to write response JSON payload.
[out]status_codeStatus updated by function based on command execution.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_process_property_update()

UINT nx_vt_process_property_update ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  iotpnp_client_ptr,
const UCHAR *  component_name_ptr,
UINT  component_name_length,
NX_AZURE_IOT_JSON_READER *  name_value_reader_ptr,
UINT  version 
)

Processes all desired property updates supported by vT Middleware.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]iotpnp_client_ptrPointer to initialized Azure IoT PnP instance.
[in]component_name_ptrName of the component.
[in]component_name_lengthLength of name of the component.
[in]name_value_reader_ptrPointer to read the JSON payload of command.
[in]versionProperty version stored in digital twin.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_process_reported_property_sync()

UINT nx_vt_process_reported_property_sync ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  iotpnp_client_ptr,
const UCHAR *  component_name_ptr,
UINT  component_name_length,
NX_AZURE_IOT_JSON_READER *  name_value_reader_ptr,
UINT  version 
)

Synchronizes VT Settings stored in digital Twin as reported properties at startup.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]iotpnp_client_ptrPointer to initialized Azure IoT PnP instance.
[in]component_name_ptrName of the component.
[in]component_name_lengthLength of name of the component.
[in]name_value_reader_ptrPointer to read the JSON payload of command.
[in]versionProperty version stored in digital twin.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_properties()

UINT nx_vt_properties ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  iotpnp_client_ptr 
)

Creates payloads and sends all reported properties supported by VT Middleware.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]iotpnp_client_ptrPointer to initialized Azure IoT PnP instance.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_send_desired_property_after_boot()

UINT nx_vt_send_desired_property_after_boot ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  iotpnp_client_ptr,
UINT  message_type 
)

Updates Digital Twin with default desired property values when device is booted for the first time.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]iotpnp_client_ptrPointer to initialized Azure IoT PnP instance.
[in]message_typeType of document, only valid value are NX_AZURE_IOT_PNP_DESIRED_PROPERTIES or NX_AZURE_IOT_PNP_PROPERTIES
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_signature_init()

UINT nx_vt_signature_init ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_VT_OBJECT handle,
UCHAR *  component_name_ptr,
UINT  signature_type,
UCHAR *  associated_telemetry,
bool  telemetry_status_auto_update,
VT_SENSOR_HANDLE *  sensor_handle 
)

Initializes Verified Telemetry for a particular sensor data stream.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]handlePointer to variable of type NX_VT_OBJECT storing collection settings and configuration data for a particular sensor telemetry.
[in]component_name_ptrName of the sensor. Example - "accelerometer" This would be prepended with 'vT' by VT library
[in]signature_typeOne of the defined signature types. Currently available types - VT_SIGNATURE_TYPE_FALLCURVE, VT_SIGNATURE_TYPE_CURRENTSENSE
[in]associated_telemetryTelmetries associated with this sensor, separated by commas Example - "accelerometerX, accelerometerY, accelerometerZ"
[in]telemetry_status_auto_updateUser specified value to control whether fingerprint computation for the sensor should be invoked when nx_vt_compute_evaluate_fingerprint_all_sensors is called
[in]sensor_handleThe sensor specific connection configuration for collecting VT signatures.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_signature_process()

UINT nx_vt_signature_process ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
UCHAR *  associated_telemetry,
UINT  associated_telemetry_length 
)

Processes the collected VT signatures for the sensor mapped to the telemetry string passed.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]associated_telemetryName of the telemetry.
[in]associated_telemetry_lengthLength of name of the telemetry.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_signature_read()

UINT nx_vt_signature_read ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
UCHAR *  associated_telemetry,
UINT  associated_telemetry_length,
UINT  mode 
)

Starts reading VT signatures for the sensor mapped to the telemetry string passed.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]associated_telemetryName of the telemetry.
[in]associated_telemetry_lengthLength of name of the telemetry.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_verified_telemetry_message_create_send()

UINT nx_vt_verified_telemetry_message_create_send ( NX_VERIFIED_TELEMETRY_DB verified_telemetry_DB,
NX_AZURE_IOT_PNP_CLIENT *  pnp_client_ptr,
const UCHAR *  component_name_ptr,
UINT  component_name_length,
UINT  wait_option,
const UCHAR *  telemetry_data,
UINT  data_size 
)

Creates and sends telemetry JSON with message properties containing telemetry status.

Parameters
[in]verified_telemetry_DBPointer to variable of type VERIFIED_TELEMETRY_DB storing Verified Telemetry data.
[in]pnp_client_ptrPointer to initialized Azure IoT PnP instance.
[in]component_name_ptrName of the component.
[in]component_name_lengthLength of name of the component.
[in]wait_optionTicks to wait if no packet is available.
[in]telemetry_dataPointer to buffer containing telemetry data.
[in]data_sizeLength of telemetry data passed in the buffer.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.