Verified Telemetry
Data Structures | Typedefs | Functions
nx_vt_currentsense_component.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 "vt_cs_api.h"

Go to the source code of this file.

Data Structures

struct  NX_VT_CURRENTSENSE_COMPONENT_TAG
 

Typedefs

typedef struct NX_VT_CURRENTSENSE_COMPONENT_TAG NX_VT_CURRENTSENSE_COMPONENT
 

Functions

UINT nx_vt_currentsense_init (NX_VT_CURRENTSENSE_COMPONENT *handle, UCHAR *component_name_ptr, VT_DEVICE_DRIVER *device_driver, VT_SENSOR_HANDLE *sensor_handle, UCHAR *associated_telemetry, CHAR *shared_buffer, UINT shared_buffer_size)
 Initializes an instance of Verified Telemetry Information Interface for currentsense component. More...
 
UINT nx_vt_currentsense_reported_properties (NX_VT_CURRENTSENSE_COMPONENT *handle, NX_AZURE_IOT_PNP_CLIENT *iotpnp_client_ptr, bool *device_status, bool toggle_verified_telemetry)
 Send read-only properties of the currentsense component like telemetryStatus, fingerprintType, fingerprintTemplate, fingerprintTemplateConfidenceMetric to IoT Hub. More...
 
UINT nx_vt_currentsense_process_command (NX_VT_CURRENTSENSE_COMPONENT *handle, 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)
 Process commands related to currentsense component eg. setResetFingerprintTemplate , retrainFingerprintTemplate. More...
 
UINT nx_vt_currentsense_process_reported_property_sync (NX_VT_CURRENTSENSE_COMPONENT *handle, 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 on-device currentsense template database from the digital twin upon startup. More...
 
UINT nx_vt_currentsense_signature_read (NX_VT_CURRENTSENSE_COMPONENT *handle, UCHAR *associated_telemetry, UINT associated_telemetry_length, bool toggle_verified_telemetry, UINT mode)
 Start reading current on the device. Call this function just before reading sensor data. More...
 
UINT nx_vt_currentsense_signature_process (NX_VT_CURRENTSENSE_COMPONENT *handle, UCHAR *associated_telemetry, UINT associated_telemetry_length, bool toggle_verified_telemetry)
 Process the raw current data stored. Get status in normal operation, calibrate and recalibrate based on commands. More...
 
bool nx_vt_currentsense_fetch_telemetry_status (NX_VT_CURRENTSENSE_COMPONENT *handle, bool toggle_verified_telemetry)
 Get status of the sensor related to this currentsense component. More...
 

Function Documentation

◆ nx_vt_currentsense_fetch_telemetry_status()

bool nx_vt_currentsense_fetch_telemetry_status ( NX_VT_CURRENTSENSE_COMPONENT handle,
bool  toggle_verified_telemetry 
)

Get status of the sensor related to this currentsense component.

Parameters
[in]handleThe currentsense handle created by a call to the initialization function.
[in]toggle_verified_telemetryBool value to enable VT for this component or not.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_currentsense_init()

UINT nx_vt_currentsense_init ( NX_VT_CURRENTSENSE_COMPONENT handle,
UCHAR *  component_name_ptr,
VT_DEVICE_DRIVER *  device_driver,
VT_SENSOR_HANDLE *  sensor_handle,
UCHAR *  associated_telemetry,
CHAR *  shared_buffer,
UINT  shared_buffer_size 
)

Initializes an instance of Verified Telemetry Information Interface for currentsense component.

Parameters
[in]handleThe handle created by a call to the initialization function.
[in]component_name_ptrName of the PNP component eg. vTsoilMoistureExternal1.
[in]device_driverThe platform driver functions for interacting with the device hardware.
[in]sensor_handleThe platform driver references for interacting with the particular sensor connected to device hardware.
[in]associated_telemetryName of the telemetry associated with this component.
[in]shared_bufferPointer to byte buffer passed from application layer, used for fingerprint calculation/storage.
[in]shared_buffer_lengthLength of byte buffer passed from application layer, used for fingerprint calculation/storage.
Return values
VT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_currentsense_process_command()

UINT nx_vt_currentsense_process_command ( NX_VT_CURRENTSENSE_COMPONENT handle,
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 
)

Process commands related to currentsense component eg. setResetFingerprintTemplate , retrainFingerprintTemplate.

Parameters
[in]handleThe currentsense handle created by a call to the initialization function.
[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_currentsense_process_reported_property_sync()

UINT nx_vt_currentsense_process_reported_property_sync ( NX_VT_CURRENTSENSE_COMPONENT handle,
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 on-device currentsense template database from the digital twin upon startup.

Parameters
[in]handleThe currentsense handle created by a call to the initialization function.
[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_currentsense_reported_properties()

UINT nx_vt_currentsense_reported_properties ( NX_VT_CURRENTSENSE_COMPONENT handle,
NX_AZURE_IOT_PNP_CLIENT *  iotpnp_client_ptr,
bool *  device_status,
bool  toggle_verified_telemetry 
)

Send read-only properties of the currentsense component like telemetryStatus, fingerprintType, fingerprintTemplate, fingerprintTemplateConfidenceMetric to IoT Hub.

Parameters
[in]handleThe currentsense handle created by a call to the initialization function.
[in]iotpnp_client_ptrPointer to initialized Azure IoT PnP instance.
[out]device_statusPointer to update the global bool showing if all devices are working or not.
[in]toggle_verified_telemetryBool value to enable VT for this component or not.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_currentsense_signature_process()

UINT nx_vt_currentsense_signature_process ( NX_VT_CURRENTSENSE_COMPONENT handle,
UCHAR *  associated_telemetry,
UINT  associated_telemetry_length,
bool  toggle_verified_telemetry 
)

Process the raw current data stored. Get status in normal operation, calibrate and recalibrate based on commands.

Parameters
[in]handleThe currentsense handle created by a call to the initialization function.
[in]associated_telemetryName of the telemetry associated with this component.
[in]associated_telemetry_lengthLength of the name of the telemetry associated with this component.
[in]toggle_verified_telemetryBool value to enable VT for this component or not.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.

◆ nx_vt_currentsense_signature_read()

UINT nx_vt_currentsense_signature_read ( NX_VT_CURRENTSENSE_COMPONENT handle,
UCHAR *  associated_telemetry,
UINT  associated_telemetry_length,
bool  toggle_verified_telemetry,
UINT  mode 
)

Start reading current on the device. Call this function just before reading sensor data.

Parameters
[in]handleThe currentsense handle created by a call to the initialization function.
[in]associated_telemetryName of the telemetry associated with this component.
[in]associated_telemetry_lengthLength of the name of the telemetry associated with this component.
[in]toggle_verified_telemetryBool value to enable VT for this component or not.
Return values
NX_AZURE_IOT_SUCCESSupon success or an error code upon failure.