tvcmiclient
Data Structures | Macros | Typedefs | Enumerations | Functions
tvcmi_client.h File Reference
#include <stdint.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  TVCMI_CreatedMetricTag
 Created metric information. Used in TVCMI_CreatedMetrics. More...
 
struct  TVCMI_CreatedMetricsTag
 Created metrics information. More...
 
struct  TVCMI_MetricInfoTag
 Metric information. Used in TVCMI_SensorInfo. More...
 
struct  TVCMI_PluginParameterTag
 Plugin parameters information. Used in TVCMI_SensorMetadata. More...
 
struct  TVCMI_SensorMetadataTag
 Sensor information. Used in TVCMI_SensorsInfo. More...
 
struct  TVCMI_SensorsInfoTag
 Sensors information. More...
 
struct  TVCMI_MetricMetadataTag
 Metric information. More...
 

Macros

#define IOTTVCMI_API
 
#define ApiVersion   "v1.0"
 The version of the TeamViewer IOT Agent API.
 

Typedefs

typedef enum TVCMI_ApiErrorTag TVCMI_ApiError
 Gateway errors.
 
typedef enum TVCMI_ErrorTag TVCMI_Error
 Error values.
 
typedef enum TVCMI_ValueUnitTag TVCMI_ValueUnit
 Metric value units.
 
typedef enum TVCMI_ValueTypeTag TVCMI_ValueType
 Metric value types.
 
typedef struct TVCMI_CreatedMetricTag TVCMI_CreatedMetric
 Created metric information. Used in TVCMI_CreatedMetrics.
 
typedef struct TVCMI_CreatedMetricsTag TVCMI_CreatedMetrics
 Created metrics information.
 
typedef struct TVCMI_MetricInfoTag TVCMI_MetricInfo
 Metric information. Used in TVCMI_SensorInfo.
 
typedef enum TVCMI_SensorTypeTag TVCMI_SensorType
 Sensor types.
 
typedef struct TVCMI_PluginParameterTag TVCMI_PluginParameter
 Plugin parameters information. Used in TVCMI_SensorMetadata.
 
typedef struct TVCMI_SensorMetadataTag TVCMI_SensorMetadata
 Sensor information. Used in TVCMI_SensorsInfo.
 
typedef struct TVCMI_SensorsInfoTag TVCMI_SensorsInfo
 Sensors information.
 
typedef struct TVCMI_MetricMetadataTag TVCMI_MetricMetadata
 Metric information.
 
typedef struct TVCMI_MetricSchemaContainerTag TVCMI_MetricSchemaContainer
 A container for creating metrics.
 
typedef struct TVCMI_MetricValueContainerTag TVCMI_MetricValueContainer
 A container for sending metric values.
 
typedef struct TVCMI_ClientTag TVCMI_Client
 A client object.
 

Enumerations

enum  TVCMI_ApiErrorTag {
  TVCMI_ApiError_NoError = -1, TVCMI_ApiError_UnknownError = 0, TVCMI_ApiError_NoBackendConnection = 1, TVCMI_ApiError_NoLicence = 2,
  TVCMI_ApiError_InternalError = 3, TVCMI_ApiError_InvalidJson = 4, TVCMI_ApiError_JsonIsNotAnObject = 5, TVCMI_ApiError_MissingParameter = 6,
  TVCMI_ApiError_ParameterIsNotAString = 7, TVCMI_ApiError_ParameterIsNotANumber = 8, TVCMI_ApiError_ParameterIsNotABool = 9, TVCMI_ApiError_ParameterIsNotAnArray = 10,
  TVCMI_ApiError_ParameterIsNotAnInteger = 11, TVCMI_ApiError_UnknownValueUnit = 12, TVCMI_ApiError_UnknownMetricType = 13, TVCMI_ApiError_ValueUnitOrValueTypeHasToBeProvided = 14,
  TVCMI_ApiError_UnknownSensorId = 15, TVCMI_ApiError_UnknownMetricId = 16, TVCMI_ApiError_NoMetricsUpdated = 17, TVCMI_ApiError_ForbiddendAccess = 18,
  TVCMI_ApiError_OutOfRange = 19, TVCMI_ApiError_CertificateFormatError = 20, TVCMI_ApiError_CertificateIsEmptyError = 21, TVCMI_ApiError_CertificateWithoutCommonName = 22,
  TVCMI_ApiError_DeleteMetricsFailed = 23, TVCMI_ApiError_ChangeMetricsFailed = 24, TVCMI_ApiError_InvalidClientName = 25, TVCMI_ApiError_CreateMetricsFailed = 26,
  TVCMI_ApiError_PushValuesFailed = 27
}
 Gateway errors.
 
enum  TVCMI_ErrorTag {
  TVCMI_Error_Unknown = -1, TVCMI_Error_Success = 0, TVCMI_Error_WrongApiVersion = 1, TVCMI_Error_WrongConfigName = 2,
  TVCMI_Error_ConfigReadFailed = 3, TVCMI_Error_WrongConfigParams = 4, TVCMI_Error_NoMemory = 5, TVCMI_Error_InvalidArguments = 6,
  TVCMI_Error_NoResource = 7, TVCMI_Error_ConnectionFailed = 8, TVCMI_Error_WrongProtocol = 9, TVCMI_Error_WrongIdentifier = 10,
  TVCMI_Error_ServerUnavailable = 11, TVCMI_Error_UnexpectedDisconnect = 12, TVCMI_Error_NoConnectionToServer = 13, TVCMI_Error_PayloadSize = 14,
  TVCMI_Error_WrongReply = 15, TVCMI_Error_Busy = 16, TVCMI_Error_CreateCertificate = 17, TVCMI_Error_CreateProvisionCertificate = 18,
  TVCMI_Error_CreatePrivateKey = 19, TVCMI_Error_GetClientId = 20, TVCMI_Error_TlsSetFailed = 21, TVCMI_Error_ClientProvision = 22,
  TVCMI_Error_ModifySensor = 23, TVCMI_Error_DeleteSensor = 24, TVCMI_Error_DeleteMetrics = 25, TVCMI_Error_RemoveCertificates = 26,
  TVCMI_Error_TlsConnection = 27, TVCMI_Error_Errno = 28, TVCMI_Error_ComposeJson = 29, TVCMI_Error_NoThreadSupport = 30,
  TVCMI_Error_ReadCertificateCN = 31, TVCMI_Error_CertificateRequestPath = 32, TVCMI_Error_CertifcateFolderPath = 33, TVCMI_Error_AlreadyProvisioned = 34,
  TVCMI_Error_WritingToCertificateFile = 35, TVCMI_Error_WrongCertificateFile = 36, TVCMI_Error_ThreadCreate = 37, TVCMI_Error_NoBackendConnection = 38,
  TVCMI_Error_CertificateRequest = 39
}
 Error values.
 
enum  TVCMI_ValueUnitTag {
  TVCMI_ValueUnit_NoUnit, TVCMI_ValueUnit_SIAmpere, TVCMI_ValueUnit_SIBit, TVCMI_ValueUnit_SICandela,
  TVCMI_ValueUnit_SICelsius, TVCMI_ValueUnit_SIFarad, TVCMI_ValueUnit_SIKilogram, TVCMI_ValueUnit_SIHertz,
  TVCMI_ValueUnit_SIJoule, TVCMI_ValueUnit_SIMeter, TVCMI_ValueUnit_SIMetersPerSecond, TVCMI_ValueUnit_SIMetersPerSquareSecond,
  TVCMI_ValueUnit_SIMole, TVCMI_ValueUnit_SINewtone, TVCMI_ValueUnit_SIOhm, TVCMI_ValueUnit_SIPascal,
  TVCMI_ValueUnit_SIRadian, TVCMI_ValueUnit_SISecond, TVCMI_ValueUnit_SISquareMeter, TVCMI_ValueUnit_SIVolt,
  TVCMI_ValueUnit_SIWatt, TVCMI_ValueUnit_NoSIDecibel, TVCMI_ValueUnit_NoSIPercent
}
 Metric value units.
 
enum  TVCMI_ValueTypeTag {
  TVCMI_ValueType_NoType, TVCMI_ValueType_Integer, TVCMI_ValueType_Double, TVCMI_ValueType_Bool,
  TVCMI_ValueType_String
}
 Metric value types.
 
enum  TVCMI_SensorTypeTag { TVCMI_SensorType_None, TVCMI_SensorType_Standard, TVCMI_SensorType_Plugin }
 Sensor types.
 

Functions

IOTTVCMI_API TVCMI_Error TVCMI_LibInit ()
 Initializes the library. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_LibCleanup ()
 Call TVCMI_LibCleanup to free resources associated with the library. More...
 
IOTTVCMI_API TVCMI_ClientTVCMI_NewClient (const char *confFile, void *callbackParameter, TVCMI_Error *err)
 Create a client object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeleteClient (TVCMI_Client *client)
 Use to free the memory associated with a TVCMI_Client instance. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ProvisionClient (TVCMI_Client *client)
 Provision the client. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_Connect (TVCMI_Client *client)
 Connect to the TeamViewer IOT Agent. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_Disconnect (TVCMI_Client *client)
 Disconnect from the TeamViewer IOT Agent. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CreateSensor (TVCMI_Client *client, const char *name)
 Create sensor by name. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_UpdateSensor (TVCMI_Client *client, const char *sensorId, const char *sensorName)
 Update sensor meta data. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeleteSensor (TVCMI_Client *client, const char *sensorId)
 Delete sensor. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CreateMetrics (TVCMI_Client *client, const char *sensorId, TVCMI_MetricSchemaContainer *container)
 Create metrics of a sensor. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_UpdateMetrics (TVCMI_Client *client, const char *sensorId, TVCMI_MetricSchemaContainer *container)
 Update metrics. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_PushMetricValues (TVCMI_Client *client, const char *sensorId, TVCMI_MetricValueContainer *container)
 Send values of metrics of a client to the TeamViewer IOT Agent. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeleteMetrics (TVCMI_Client *client, const char *sensorId, char **metricIds, int metricsCount)
 Delete metrics. More...
 
IOTTVCMI_API TVCMI_MetricSchemaContainerTVCMI_CreateMetricSchemaContainer ()
 Create a TVCMI_MetricSchemaContainer object and returns it's pointer. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DestroyMetricSchemaContainer (TVCMI_MetricSchemaContainer *container)
 Destroy container object created by function TVCMI_CreateMetricSchemaContainer(). More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddStandardMetricSchema (TVCMI_MetricSchemaContainer *container, const char *matchingId, const char *name, TVCMI_ValueUnit valueUnit)
 Add a metric with standard ValueUnit type of value unit. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddCustomMetricSchema (TVCMI_MetricSchemaContainer *container, const char *matchingId, const char *name, TVCMI_ValueType valueType, const char *valueAnnotation)
 Add a metric with custom type of value unit. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddMetricUpdateSchema (TVCMI_MetricSchemaContainer *container, const char *metricId, const char *name, const char *valueAnnotation)
 Add metrics to change name and/or valueAnnotation. More...
 
IOTTVCMI_API TVCMI_MetricValueContainerTVCMI_CreateMetricValueContainer ()
 Create a TVCMI_MetricValueContainer object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DestroyMetricValueContainer (TVCMI_MetricValueContainer *container)
 Destroy container object created by function TVCMI_CreateMetricValueContainer(). More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddIntegerMetricValue (TVCMI_MetricValueContainer *container, int64_t value, const char *metricId)
 Add a value of type int64_t to the container object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddBoolMetricValue (TVCMI_MetricValueContainer *container, int value, const char *metricId)
 Add a value of boolean type to the container object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddDoubleMetricValue (TVCMI_MetricValueContainer *container, double value, const char *metricId)
 Add a value of type double to the container object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddStringMetricValue (TVCMI_MetricValueContainer *container, const char *value, const char *metricId)
 Add a value of type string to the container object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_AddEpochTimeStamp (TVCMI_MetricValueContainer *container, uint64_t epochTimestamp)
 Add a timestamp to the container object. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ListSensors (TVCMI_Client *client)
 Get information about sensors, including its metrics. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DescribeMetric (TVCMI_Client *client, const char *sensorId, const char *metricId)
 Get information about certain metric. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ReportClientError (TVCMI_Client *client, int error, const char *errMessage)
 Send error message about a client. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ReportSensorError (TVCMI_Client *client, const char *sensorId, int error, const char *errMessage)
 Send error message about a sensor. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ReportMetricError (TVCMI_Client *client, const char *sensorId, const char *metricId, int error, const char *errMessage)
 Send error message about a metric. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ProvisionClientCallbackSet (TVCMI_Client *client, void(*TVCMI_OnProvisionClient)(TVCMI_Client *client, void *callbackParameter, TVCMI_Error err))
 Set TVCMI_OnProvisionClient callback to get an event about client being provisioned. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ConnectCallbackSet (TVCMI_Client *client, void(*TVCMI_OnConnect)(TVCMI_Client *client, void *callbackParameter, TVCMI_Error err))
 Set TVCMI_OnConnect callback to get an event about client being connected. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DisconnectCallbackSet (TVCMI_Client *client, void(*TVCMI_OnDisconnect)(TVCMI_Client *client, void *callbackParameter, TVCMI_Error err))
 Set TVCMI_OnDisconnect callback to get an event about client being disconnected. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CreateSensorCallbackSet (TVCMI_Client *client, void(*TVCMI_OnCreateSensor)(TVCMI_Client *client, void *callbackParameter, const char *sensorName, const char *sensorId, TVCMI_ApiError err))
 Set TVCMI_OnCreateSensor callback to get a response about sensor creation. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_UpdateSensorCallbackSet (TVCMI_Client *client, void(*TVCMI_OnUpdateSensor)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err))
 Set TVCMI_OnUpdateSensor callback to get a response about sensor meta data change. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeleteSensorCallbackSet (TVCMI_Client *client, void(*TVCMI_OnDeleteSensor)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err))
 Set TVCMI_OnDeleteSensor callback to get a response about sensor deletion. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CreateMetricsCallbackSet (TVCMI_Client *client, void(*TVCMI_OnCreateMetrics)(TVCMI_Client *client, void *callbackParameter, TVCMI_CreatedMetrics *createdMetrics, TVCMI_ApiError err))
 Set TVCMI_OnCreateMetrics callback to get a response about metrics creation. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_UpdateMetricsCallbackSet (TVCMI_Client *client, void(*TVCMI_OnUpdateMetrics)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err))
 Set TVCMI_OnUpdateMetrics callback to get a response about metrics update. More...
 
IOTTVCMI_API void TVCMI_DestroyCreatedMetrics (TVCMI_CreatedMetrics *createdMetrics)
 Destroy created metrics returned by callback function TVCMI_OnCraeteMetrics(). More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeleteMetricsCallbackSet (TVCMI_Client *client, void(*TVCMI_OnDeleteMetrics)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err))
 Set TVCMI_OnDeleteMetrics callback to get errors about metrics deletion. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_PushMetricValuesCallbackSet (TVCMI_Client *client, void(*TVCMI_OnPushMetricValues)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err))
 Set TVCMI_OnPushMetricValues callback to get errors about metrics values update. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_ListSensorsCallbackSet (TVCMI_Client *client, void(*TVCMI_OnListSensors)(TVCMI_Client *client, TVCMI_SensorsInfo *sensorsInfo, void *callbackParameter, TVCMI_ApiError err))
 Set TVCMI_OnListSensors callback to get a response about the sensors. More...
 
IOTTVCMI_API void TVCMI_DestroySensorsInfo (TVCMI_SensorsInfo *sensorsInfo)
 Destroy sensorsInfo returned by callback function TVCMI_OnListSensors(). More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DescribeMetricCallbackSet (TVCMI_Client *client, void(*TVCMI_OnDescribeMetric)(TVCMI_Client *client, const char *sensorId, TVCMI_MetricMetadata *metricMetadata, void *callbackParameter, TVCMI_ApiError err))
 Set TVCMI_OnDescribeMetric callback to receive a response about the metric. More...
 
IOTTVCMI_API void TVCMI_DestroyMetricMetadata (TVCMI_MetricMetadata *metricMetadata)
 Destroy metricMetadata returned by callback function TVCMI_OnGetMetric(). More...
 
IOTTVCMI_API TVCMI_Error TVCMI_LogCallbackSet (TVCMI_Client *client, void(*TVCMI_OnLog)(TVCMI_Client *client, const char *logMessage, void *callbackParameter))
 Set TVCMI_OnLog callback to get library's internal info and error messages. More...
 
const IOTTVCMI_API char * TVCMI_GetClientId (TVCMI_Client *client)
 Return the client id. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CheckConnection (TVCMI_Client *client)
 Check if the connection with TeamViewer IoT Agent is alive. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CheckConnectionCallbackSet (TVCMI_Client *client, void(*TVCMI_OnCheckConnection)(TVCMI_Client *client, void *callbackParameter, TVCMI_ApiError err))
 Set TVCMI_OnCheckConnection callback to get a response from the TeamViewer IoT Agent. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_CreateSensorJobCallbackSet (TVCMI_Client *client, void(*TVCMI_OnCreateSensorJob)(TVCMI_Client *client, TVCMI_SensorMetadata *sensorMetadata, void *callbackParameter))
 Set TVCMI_OnCreateSensorJob callback to receive sensor create jobs. More...
 
void TVCMI_DestroySensorMetadata (TVCMI_SensorMetadata *sensorMetadata)
 Destroy sensorMetadata returned by callback function TVCMI_OnCreateSensorJob(). More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeleteSensorJobCallbackSet (TVCMI_Client *client, void(*TVCMI_OnDeleteSensorJob)(TVCMI_Client *client, const char *sensorId, void *callbackParameter))
 Set TVCMI_OnDeleteSensorJob callback to receive sensor delete jobs. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeprovisionClient (TVCMI_Client *client)
 Delete the access to this client. More...
 
IOTTVCMI_API TVCMI_Error TVCMI_DeprovisionClientCallbackSet (TVCMI_Client *client, void(*TVCMI_OnDeprovisionClient)(TVCMI_Client *client, void *callbackParameter))
 Set TVCMI_OnDeprovisionClient callback to know that the Deprovision is done. More...
 

Detailed Description

tvcmiclient - client library for the TeamViewer IOT Agent API version 1.0

Usage hints

Call TVCMI_LibInit() function before using any other functions of this library.

All callback functions should be set once. Otherwise they will be replaced and that will not be thread safe.

Function Documentation

◆ TVCMI_AddBoolMetricValue()

IOTTVCMI_API TVCMI_Error TVCMI_AddBoolMetricValue ( TVCMI_MetricValueContainer container,
int  value,
const char *  metricId 
)

Add a value of boolean type to the container object.

Parameters
containerA valid TVCMI_MetricValueContainer object.
valueA value of boolean type. It can be 0 or 1.
metricIdMetric ID.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricValueContainer()
TVCMI_DestroyMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddDoubleMetricValue()
TVCMI_AddStringMetricValue()
TVCMI_AddEpochTimeStamp()

◆ TVCMI_AddCustomMetricSchema()

IOTTVCMI_API TVCMI_Error TVCMI_AddCustomMetricSchema ( TVCMI_MetricSchemaContainer container,
const char *  matchingId,
const char *  name,
TVCMI_ValueType  valueType,
const char *  valueAnnotation 
)

Add a metric with custom type of value unit.

Parameters
containerA valid TVCMI_MetricValueContainer pointer.
matchingIdAn ID which is unique in sensor and can be used to match metric IDs after registration.
nameMetric name.
valueTypeCustom value type of metric.
valueAnnotationCustom measurement unit ("kg", "Mhz", "Km", "", ...).
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_ComposeJson - could not create json message
See also
TVCMI_CreateMetricSchemaContainer()
TVCMI_DestroyMetricSchemaContainer()
TVCMI_AddCustomMetricSchema()

◆ TVCMI_AddDoubleMetricValue()

IOTTVCMI_API TVCMI_Error TVCMI_AddDoubleMetricValue ( TVCMI_MetricValueContainer container,
double  value,
const char *  metricId 
)

Add a value of type double to the container object.

Parameters
containerA valid TVCMI_MetricValueContainer object.
valueA value of type double.
metricIdMetric ID.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricValueContainer()
TVCMI_DestroyMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddBoolMetricValue()
TVCMI_AddStringMetricValue()
TVCMI_AddEpochTimeStamp()

◆ TVCMI_AddEpochTimeStamp()

IOTTVCMI_API TVCMI_Error TVCMI_AddEpochTimeStamp ( TVCMI_MetricValueContainer container,
uint64_t  epochTimestamp 
)

Add a timestamp to the container object.

Parameters
containerA valid TVCMI_MetricValueContainer object.
epochTimestampThe timestamp has to be a UNIX Epoch timestamp. Time since 1.1.1970.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricValueContainer()
TVCMI_DestroyMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddBoolMetricValue()
TVCMI_AddDoubleMetricValue()

◆ TVCMI_AddIntegerMetricValue()

IOTTVCMI_API TVCMI_Error TVCMI_AddIntegerMetricValue ( TVCMI_MetricValueContainer container,
int64_t  value,
const char *  metricId 
)

Add a value of type int64_t to the container object.

Parameters
containerA valid TVCMI_MetricValueContainer object.
valueA value of type int64_t.
metricIdMetric ID.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricValueContainer()
TVCMI_DestroyMetricValueContainer()
TVCMI_AddBoolMetricValue()
TVCMI_AddDoubleMetricValue()
TVCMI_AddStringMetricValue()
TVCMI_AddEpochTimeStamp()

◆ TVCMI_AddMetricUpdateSchema()

IOTTVCMI_API TVCMI_Error TVCMI_AddMetricUpdateSchema ( TVCMI_MetricSchemaContainer container,
const char *  metricId,
const char *  name,
const char *  valueAnnotation 
)

Add metrics to change name and/or valueAnnotation.

Parameters
containerA valid TVCMI_MetricValueContainer pointer.
metricIdmetric ID.
nameMetric name.
valueAnnotationCustom measurement unit ("kg", "Mhz", "Km", "", ...).
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_ComposeJson - could not create json message
See also
TVCMI_CreateMetricSchemaContainer()
TVCMI_DestroyMetricSchemaContainer()

◆ TVCMI_AddStandardMetricSchema()

IOTTVCMI_API TVCMI_Error TVCMI_AddStandardMetricSchema ( TVCMI_MetricSchemaContainer container,
const char *  matchingId,
const char *  name,
TVCMI_ValueUnit  valueUnit 
)

Add a metric with standard ValueUnit type of value unit.

Parameters
containerA valid TVCMI_MetricValueContainer pointer.
matchingIdThis string will be used to identify the metric ID in the response. It has to be unique in the context of this request.
nameMetric name.
valueUnitValue unit of metric.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_ComposeJson - could not create json message
See also
TVCMI_CreateMetricSchemaContainer()
TVCMI_DestroyMetricSchemaContainer()
TVCMI_AddCustomMetricSchema()

◆ TVCMI_AddStringMetricValue()

IOTTVCMI_API TVCMI_Error TVCMI_AddStringMetricValue ( TVCMI_MetricValueContainer container,
const char *  value,
const char *  metricId 
)

Add a value of type string to the container object.

Parameters
containerA valid TVCMI_MetricValueContainer object.
valueNull terminated string value.
metricIdMetric ID.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoMemory - no memory
TVCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricValueContainer()
TVCMI_DestroyMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddBoolMetricValue()
TVCMI_AddDoubleMetricValue()
TVCMI_AddEpochTimeStamp()

◆ TVCMI_CheckConnection()

IOTTVCMI_API TVCMI_Error TVCMI_CheckConnection ( TVCMI_Client client)

Check if the connection with TeamViewer IoT Agent is alive.

If it works then you will get a response callback set by function TVCMI_CheckConnectionCallbackSet().

Parameters
client- A valid TVCMI_Client instance.
Returns
client Id - on success
NULL - on failure

◆ TVCMI_CheckConnectionCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_CheckConnectionCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, TVCMI_ApiError err)  TVCMI_OnCheckConnection 
)

Set TVCMI_OnCheckConnection callback to get a response from the TeamViewer IoT Agent.

If the connection is alive you will get the response.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnCheckConnectionA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of connetor.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_Connect()

IOTTVCMI_API TVCMI_Error TVCMI_Connect ( TVCMI_Client client)

Connect to the TeamViewer IOT Agent.

Callback function set by TVCMI_ConnectCallbackSet() will inform about connection done.

Parameters
clientA valid TVCMI_Client instance.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_NoResource - no resources
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_TlsSetFailed - failed to set TLS options
TVCMI_Error_NoThreadSupport - the system does not support threads
TVCMI_Error_Errno - system error number

◆ TVCMI_ConnectCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_ConnectCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, TVCMI_Error err)  TVCMI_OnConnect 
)

Set TVCMI_OnConnect callback to get an event about client being connected.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnConnectA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success.
TVCMI_Error_InvalidArguments - wrong parameters.

◆ TVCMI_CreateMetrics()

IOTTVCMI_API TVCMI_Error TVCMI_CreateMetrics ( TVCMI_Client client,
const char *  sensorId,
TVCMI_MetricSchemaContainer container 
)

Create metrics of a sensor.

The callback function set by TVCMI_CreateMetricsCallbackSet() will return created metric IDs on success or error code on failure.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
containerA structure containing metric schemas.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent
TVCMI_Error_ComposeJson - could not create json message
See also
TVCMI_CreateMetricSchemaContainer()
TVCMI_DestroyMetricSchemaContainer()
TVCMI_AddStandardMetricSchema()
TVCMI_AddCustomMetricSchema()

◆ TVCMI_CreateMetricsCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_CreateMetricsCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, TVCMI_CreatedMetrics *createdMetrics, TVCMI_ApiError err)  TVCMI_OnCreateMetrics 
)

Set TVCMI_OnCreateMetrics callback to get a response about metrics creation.

createdMetrics must be destroyed by call to function TVCMI_DestroyCreatedMetrics() after usage.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnCreateMetricsA callback function.
Callback Parameters:
    client -                The TVCMI_Client instance making the callback.
    callbackParameter -     A pointer provided during creation of the client.
    createdMetrics -        A structure containing information about created
                            metrics. Created metrics must be destroyed by
                            function TVCMI_DestroyCreatedMetrics() after usage.
    err -                   Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_CreateMetricSchemaContainer()

IOTTVCMI_API TVCMI_MetricSchemaContainer* TVCMI_CreateMetricSchemaContainer ( )

Create a TVCMI_MetricSchemaContainer object and returns it's pointer.

It should be destroyed by function TVCMI_DestroyMetricSchemaContainer().

Returns
TVCMI_MetricSchemaContainer* - on success
NULL - on failure
See also
TVCMI_DestroyMetricSchemaContainer()
TVCMI_AddStandardMetricSchema()
TVCMI_AddCustomMetricSchema()

◆ TVCMI_CreateMetricValueContainer()

IOTTVCMI_API TVCMI_MetricValueContainer* TVCMI_CreateMetricValueContainer ( )

Create a TVCMI_MetricValueContainer object.

Should be destroyed by function TVCMI_DestroyMetricValueContainer().

Returns
TVCMI_MetricValueContainer* - on success
NULL - on failure
See also
TVCMI_DestroyMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddBoolMetricValue()
TVCMI_AddDoubleMetricValue()
TVCMI_AddStringMetricValue()
TVCMI_AddEpochTimeStamp()

◆ TVCMI_CreateSensor()

IOTTVCMI_API TVCMI_Error TVCMI_CreateSensor ( TVCMI_Client client,
const char *  name 
)

Create sensor by name.

Callback function set by TVCMI_CreteSensorCallbackSet() will return a sensor id.

Parameters
clientA valid TVCMI_Client instance.
nameSensor name.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_CreateSensorCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_CreateSensorCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, const char *sensorName, const char *sensorId, TVCMI_ApiError err)  TVCMI_OnCreateSensor 
)

Set TVCMI_OnCreateSensor callback to get a response about sensor creation.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnCreateSensorA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    sensorName -        The name of the sensor. It will be destroyed automatically after callback returns.
    sensorId -          The id of the sensor. It will be destroyed automatically after callback returns.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_CreateSensorJobCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_CreateSensorJobCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, TVCMI_SensorMetadata *sensorMetadata, void *callbackParameter)  TVCMI_OnCreateSensorJob 
)

Set TVCMI_OnCreateSensorJob callback to receive sensor create jobs.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnCreateSensorJobA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    sensorMetadata -    A pointer to a structure containing the sensor information.
                        It must be deleted by call of function
                        TVCMI_DestroySensorMetadata()
    callbackParameter - A pointer provided during creation of the client.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DeleteClient()

IOTTVCMI_API TVCMI_Error TVCMI_DeleteClient ( TVCMI_Client client)

Use to free the memory associated with a TVCMI_Client instance.

Do not call this function from the callback functions.

Parameters
clientA struct TVCMI_Client pointer to free.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DeleteMetrics()

IOTTVCMI_API TVCMI_Error TVCMI_DeleteMetrics ( TVCMI_Client client,
const char *  sensorId,
char **  metricIds,
int  metricsCount 
)

Delete metrics.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
metricIdsAn array of metric IDs.
metricsCountThe number of metrics in the metricIds array.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_DeleteMetricsCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_DeleteMetricsCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err)  TVCMI_OnDeleteMetrics 
)

Set TVCMI_OnDeleteMetrics callback to get errors about metrics deletion.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnDeleteMetricsA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    sensorId -          The id of the sensor.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DeleteSensor()

IOTTVCMI_API TVCMI_Error TVCMI_DeleteSensor ( TVCMI_Client client,
const char *  sensorId 
)

Delete sensor.

The callback function set by TVCMI_DeleteSensorCallbackSet() will return success or error information about sensor deletion.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor to delete.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_DeleteSensorCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_DeleteSensorCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err)  TVCMI_OnDeleteSensor 
)

Set TVCMI_OnDeleteSensor callback to get a response about sensor deletion.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnDeleteSensorA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    sensorId -          The id of the sensor.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DeleteSensorJobCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_DeleteSensorJobCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, const char *sensorId, void *callbackParameter)  TVCMI_OnDeleteSensorJob 
)

Set TVCMI_OnDeleteSensorJob callback to receive sensor delete jobs.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnDeleteSensorJobA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    sensorId -          ID of a sensor to delete.
    callbackParameter - A pointer provided during creation of the client.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DeprovisionClient()

IOTTVCMI_API TVCMI_Error TVCMI_DeprovisionClient ( TVCMI_Client client)

Delete the access to this client.

The callback function set by TVCMI_DeprovisionClientCallbackSet() will confirm that deprovisioning is done.

Parameters
clientA valid TVCMI_Client instance.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DeprovisionClientCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_DeprovisionClientCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter)  TVCMI_OnDeprovisionClient 
)

Set TVCMI_OnDeprovisionClient callback to know that the Deprovision is done.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnDeprovisionClientA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of client.

◆ TVCMI_DescribeMetric()

IOTTVCMI_API TVCMI_Error TVCMI_DescribeMetric ( TVCMI_Client client,
const char *  sensorId,
const char *  metricId 
)

Get information about certain metric.

The callback set by TVCMI_DescribeMetricCallbackSet() will return the information about the metric.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
metricIdID of a metric.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_DescribeMetricCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_DescribeMetricCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, const char *sensorId, TVCMI_MetricMetadata *metricMetadata, void *callbackParameter, TVCMI_ApiError err)  TVCMI_OnDescribeMetric 
)

Set TVCMI_OnDescribeMetric callback to receive a response about the metric.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnDescribeMetricA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    sensorId -          ID of a sensor to which the metric belongs to.
    inventory -         A pointer to a structure containing inventory information.
                        It must be deleted by call of function
                        TVCMI_DestroyMetricInventory()
    callbackParameter - A pointer provided during creation of the client.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DestroyCreatedMetrics()

IOTTVCMI_API void TVCMI_DestroyCreatedMetrics ( TVCMI_CreatedMetrics createdMetrics)

Destroy created metrics returned by callback function TVCMI_OnCraeteMetrics().

Parameters
createdMetricsA pointer to structure containing created metrics.

◆ TVCMI_DestroyMetricMetadata()

IOTTVCMI_API void TVCMI_DestroyMetricMetadata ( TVCMI_MetricMetadata metricMetadata)

Destroy metricMetadata returned by callback function TVCMI_OnGetMetric().

Parameters
metricMetadata- A structure containing inventory information.

◆ TVCMI_DestroyMetricSchemaContainer()

IOTTVCMI_API TVCMI_Error TVCMI_DestroyMetricSchemaContainer ( TVCMI_MetricSchemaContainer container)

Destroy container object created by function TVCMI_CreateMetricSchemaContainer().

Parameters
containerA valid TVCMI_MetricSchemaContainer pointer to destroy.
Returns
TVCMI_Error_Success - on success
VCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricSchemaContainer()
TVCMI_AddStandardMetricSchema()
TVCMI_AddCustomMetricSchema()

◆ TVCMI_DestroyMetricValueContainer()

IOTTVCMI_API TVCMI_Error TVCMI_DestroyMetricValueContainer ( TVCMI_MetricValueContainer container)

Destroy container object created by function TVCMI_CreateMetricValueContainer().

Parameters
containerA valid TVCMI_MetricValueContainer pointer to destroy.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
See also
TVCMI_CreateMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddBoolMetricValue()
TVCMI_AddDoubleMetricValue()
TVCMI_AddStringMetricValue()
TVCMI_AddEpochTimeStamp()

◆ TVCMI_DestroySensorMetadata()

void TVCMI_DestroySensorMetadata ( TVCMI_SensorMetadata sensorMetadata)

Destroy sensorMetadata returned by callback function TVCMI_OnCreateSensorJob().

Parameters
sensorMetadataA structure containing sensor information.

◆ TVCMI_DestroySensorsInfo()

IOTTVCMI_API void TVCMI_DestroySensorsInfo ( TVCMI_SensorsInfo sensorsInfo)

Destroy sensorsInfo returned by callback function TVCMI_OnListSensors().

Parameters
sensorsInfo- A structure containing sensors information.

◆ TVCMI_Disconnect()

IOTTVCMI_API TVCMI_Error TVCMI_Disconnect ( TVCMI_Client client)

Disconnect from the TeamViewer IOT Agent.

Callback function set by TVCMI_DisconnectCallbackSet() will inform about connection drop.

Parameters
clientA valid TVCMI_Client instance.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_DisconnectCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_DisconnectCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, TVCMI_Error err)  TVCMI_OnDisconnect 
)

Set TVCMI_OnDisconnect callback to get an event about client being disconnected.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnDisconnectA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_GetClientId()

const IOTTVCMI_API char* TVCMI_GetClientId ( TVCMI_Client client)

Return the client id.

Parameters
clientA valid TVCMI_Client instance.
Returns
client Id - on success
NULL - on failure

◆ TVCMI_LibCleanup()

IOTTVCMI_API TVCMI_Error TVCMI_LibCleanup ( )

Call TVCMI_LibCleanup to free resources associated with the library.

This function is not thread safe.

Returns
TVCMI_Error_Success - always
See also
TVCMI_LibInit()

◆ TVCMI_LibInit()

IOTTVCMI_API TVCMI_Error TVCMI_LibInit ( )

Initializes the library.

It must be called before any other API functions. This have to be called only once in the beginning. This function is not thread safe.

Returns
TVCMI_Error_Success - always
See also
TVCMI_LibCleanup()

◆ TVCMI_ListSensors()

IOTTVCMI_API TVCMI_Error TVCMI_ListSensors ( TVCMI_Client client)

Get information about sensors, including its metrics.

The Callback set by TVCMI_ListSensorsCallbackSet() will return the information about sensors.

Parameters
clientA valid TVCMI_Client instance.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_ListSensorsCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_ListSensorsCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, TVCMI_SensorsInfo *sensorsInfo, void *callbackParameter, TVCMI_ApiError err)  TVCMI_OnListSensors 
)

Set TVCMI_OnListSensors callback to get a response about the sensors.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnListSensorsA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    sensorsInfo -       A pointer to a structure containing information about sensors.
                        The pointer must be freed by function
                        TVCMI_DestroySensorsInfo() after usage.
    callbackParameter - A pointer provided during creation of the client.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_LogCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_LogCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, const char *logMessage, void *callbackParameter)  TVCMI_OnLog 
)

Set TVCMI_OnLog callback to get library's internal info and error messages.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnLogA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    logMessage -        The message text.
    callbackParameter - A pointer provided during creation of the client.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_NewClient()

IOTTVCMI_API TVCMI_Client* TVCMI_NewClient ( const char *  confFile,
void *  callbackParameter,
TVCMI_Error err 
)

Create a client object.

It must be deleted by TVCMI_DeleteClient() after usage.

Parameters
confFileA file path which will contain all the API protocol specific configuration data. A possible content of that file is described in the following section:
  • MqttHost localhost // host to connect
  • MqttProvisionPort 1883 // port for the client provisioning
  • MqttPort 8883 // port for other than provisioning actions
  • MqttKeepAlive 60 // connection keep alive seconds
  • CaFile /var/lib/teamviewer-iot-agent/certs/TeamViewerAuthority.crt // Team Viewer CA certificate path
  • CertFolder /home/pi/Downloads/certs // a folder where the certificates will be placed and it will be created if it does not already exist. Each client must have its own folder for certificates.
  • ClientName IOT-Client // a display name for the client
callbackParameterA pointer that will be passed as an argument to any callbacks function.
errReturned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - no memory
TVCMI_Error_WrongConfigName - confFile argument is NULL or empty
TVCMI_Error_ConfigReadFailed - can not open the file confFile
TVCMI_Error_WrongConfigParams - the file confFile has wrong parameters in it

◆ TVCMI_ProvisionClient()

IOTTVCMI_API TVCMI_Error TVCMI_ProvisionClient ( TVCMI_Client client)

Provision the client.

It will provision the client, if it is not provisioned yet. The callback function set by TVCMI_ProvisionClientCallbackSet will inform about the client provisioning on success or will return an error code in case of failure.

Parameters
clientA valid TVCMI_Client instance.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - no memory
TVCMI_Error_GetClientId - failed to get client id from certificate
TVCMI_Error_CreateProvisionCertificate - failed to create provision certificate
TVCMI_Error_CreatePrivateKey - failed to create a private key
TVCMI_Error_AlreadyProvisioned - the client was provisioned
TVCMI_Error_TlsSetFailed - failed to set TLS options
TVCMI_Error_NoThreadSupport - the system does not support threads
TVCMI_Error_Errno - system error number

◆ TVCMI_ProvisionClientCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_ProvisionClientCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, TVCMI_Error err)  TVCMI_OnProvisionClient 
)

Set TVCMI_OnProvisionClient callback to get an event about client being provisioned.

Do not make any other SDK function calls in this callback function.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnProvisionClientA callback function.
Callback Parameters:
    client -            A valid TVCMI_Client instance.
    callbackParameter - A pointer provided during creation of the client.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - no memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent
TVCMI_Error_PayloadSize - payload is too large
TVCMI_Error_WrongIdentifier - internal identifier error
TVCMI_Error_ServerUnavailable - TeamViewer IOT Agent is not available

◆ TVCMI_PushMetricValues()

IOTTVCMI_API TVCMI_Error TVCMI_PushMetricValues ( TVCMI_Client client,
const char *  sensorId,
TVCMI_MetricValueContainer container 
)

Send values of metrics of a client to the TeamViewer IOT Agent.

If the sensor or metrics were not registered, then they will be registered before pushing values. The callback function set by TVCMI_PushMetricValuesCallbackSet() will return error codes in case of failure.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor
containerA pointer to a structure containing metric values.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent
See also
TVCMI_CreateMetricValueContainer()
TVCMI_DestroyMetricValueContainer()
TVCMI_AddIntegerMetricValue()
TVCMI_AddBoolMetricValue()
TVCMI_AddDoubleMetricValue()
TVCMI_AddStringMetricValue()
TVCMI_AddEpochTimeStamp()
TVCMI_PushMetricValuesCallbackSet()

◆ TVCMI_PushMetricValuesCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_PushMetricValuesCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err)  TVCMI_OnPushMetricValues 
)

Set TVCMI_OnPushMetricValues callback to get errors about metrics values update.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnPushMetricValuesA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    sensorId -          The id of the sensor.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_ReportClientError()

IOTTVCMI_API TVCMI_Error TVCMI_ReportClientError ( TVCMI_Client client,
int  error,
const char *  errMessage 
)

Send error message about a client.

Parameters
clientA valid TVCMI_Client instance.
errorError code.
errMessageError message text.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_ReportMetricError()

IOTTVCMI_API TVCMI_Error TVCMI_ReportMetricError ( TVCMI_Client client,
const char *  sensorId,
const char *  metricId,
int  error,
const char *  errMessage 
)

Send error message about a metric.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
metricIdID of a metric.
errorError code.
errMessageerror Message text.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_ReportSensorError()

IOTTVCMI_API TVCMI_Error TVCMI_ReportSensorError ( TVCMI_Client client,
const char *  sensorId,
int  error,
const char *  errMessage 
)

Send error message about a sensor.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
errorError code.
errMessageError message text.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_UpdateMetrics()

IOTTVCMI_API TVCMI_Error TVCMI_UpdateMetrics ( TVCMI_Client client,
const char *  sensorId,
TVCMI_MetricSchemaContainer container 
)

Update metrics.

The callback function set by TVCMI_UpdateMetricsCallbackSet() will return success or error information about metrics update.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
containerA structure containing metric schemas.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent
TVCMI_Error_ComposeJson - could not create json message
See also
TVCMI_CreateMetricSchemaContainer()
TVCMI_AddMetricUpdateSchema()
TVCMI_DestroyMetricSchemaContainer()

◆ TVCMI_UpdateMetricsCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_UpdateMetricsCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err)  TVCMI_OnUpdateMetrics 
)

Set TVCMI_OnUpdateMetrics callback to get a response about metrics update.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnUpdateMetricsA callback function.
Callback Parameters:
    client -                The TVCMI_Client instance making the callback.
    callbackParameter -     A pointer provided during creation of the client.
    sensorId -              The id of the sensor.
    err -                   Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters

◆ TVCMI_UpdateSensor()

IOTTVCMI_API TVCMI_Error TVCMI_UpdateSensor ( TVCMI_Client client,
const char *  sensorId,
const char *  sensorName 
)

Update sensor meta data.

The callback function set by TVCMI_UpdateSensorCallbackSet() will return success or error information about sensor meta data change.

Parameters
clientA valid TVCMI_Client instance.
sensorIdID of a sensor.
sensorNameSensor name. If NULL, it will not be changed.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters
TVCMI_Error_NoMemory - out of memory
TVCMI_Error_NoConnectionToServer - no connection with TeamViewer IOT Agent
TVCMI_Error_WrongProtocol - internal protocol error communicating with the TeamViewer IOT Agent

◆ TVCMI_UpdateSensorCallbackSet()

IOTTVCMI_API TVCMI_Error TVCMI_UpdateSensorCallbackSet ( TVCMI_Client client,
void(*)(TVCMI_Client *client, void *callbackParameter, const char *sensorId, TVCMI_ApiError err)  TVCMI_OnUpdateSensor 
)

Set TVCMI_OnUpdateSensor callback to get a response about sensor meta data change.

Parameters
clientA valid TVCMI_Client instance.
TVCMI_OnUpdateSensorA callback function.
Callback Parameters:
    client -            The TVCMI_Client instance making the callback.
    callbackParameter - A pointer provided during creation of the client.
    sensorId -          The id of the sensor.
    err -               Returned error code.
Returns
TVCMI_Error_Success - on success
TVCMI_Error_InvalidArguments - wrong parameters