Use the API methods described here to communicate from the Qualcomm LTE Cat M1 Modem API to the Verizon ThingSpace server for sensor configuration. This documentation was generated from the ThingSpace SDK header file, TS-Package-SDK-Source/TS/sdk/api/ts_sdk.h.
See also the Qualcomm Cat M1 LTE Modem guide for ThingSpace.
struct sensor_cfg_t
Macross
#define ESUCCESS 0
#define EFAILURE -1
Typedefs
typedef void(* thingspace_process_message_callback) (const char *topic, const char *server_json_msg) |
Invoked when message is received from server. |
typedef void(* thingspace_profile_update_callback) (const char *unit_name, const char *unit_serial_num, sensor_cfg_t *sensorid) |
Invoked when OEM profile update is required. |
Functions
Function | Description |
---|---|
|
Initialize SDK and connect to ThingSpace server. This is a blocking call; API will return only after successful connection to ThingSpace server, or return immediately when there is an invalid parameter passed. |
|
Terminate ThingSpace SDK Disconnect from ThingSpace server. |
|
Publish event to server. |
|
Publish command response to server. |
|
Update profile config in config file with current sensor index and device state. |
|
Get profile configuration. |
|
Get ThingSpace SDK version. |
|
Get unique ID of device, required for UNITOnBoard message. |
Typedefs
typedef void(* thingspace_process_message_callback) (const char *topic, const char *server_json_msg)
Invoked when message is received from server.
Parameters:
topic | Topic on which message has arrived |
server_json_msg | JSON message from ThingSpace sever |
typedef void(* thingspace_profile_update_callback) (const char *unit_name, const char *unit_serial_num, sensor_cfg_t *sensorid)
Invoked when OEM profile update is required.
Parameters:
unit_name | UNIT name of ThingSpace client |
unit_serial_num | UNIT serial number of ThingSpace device |
sensorid | Sensor IDs |
Get device ID
const char* thingspace_get_device_id (void )
Get unique ID of device, required for UNITOnBoard message.
Returns:
Device ID
Get profile configuration
int thingspace_get_profile_cfg (bool * provision, uint32_t * cur_sensor_idx, char * device_state_json)
Get profile configuration.
Parameters:
out | provision | Provision status |
out | cur_sensor_idx | Current profile index |
out | device_state_json | Last device state JSON |
Returns:
ESUCCESS or EFAILURE
Initialize SDK
int thingspace_initialize (thingspace_process_message_callback message_callback, thingspace_profile_update_callback prof_update_callback)
Initialize SDK and connect to ThingSpace server. This is a blocking call; API will return only after successful connection to ThingSpace server, or return immediately when there is an invalid parameter passed.
Parameters:
message_callback | Invoked when message is received from server : Should not be NULL |
prof_update_callback | Invoked when OEM profile update is required : Should not be NULL |
Returns:
ESUCCESS or EFAILURE
Publish command response
int thingspace_publish_cmd_response (const char * cuuid, const char * server_cmd_response, uint32_t msg_expiry_time)
Publish command response to server.
Parameters:
cuuid | Command UUID |
server_cmd_response | Command response to be sent |
msg_expiry_time | Maximum validity (in secs) of published message in pending queue. If set to 0, message stays in queue until it is sent out. |
Returns:
ESUCCESS or EFAILURE
Publish event
int thingspace_publish_event (const char * topic_name, const char * pub_msg, uint32_t msg_expiry_time)
Publish event to server.
Parameters:
topic_name | Publish to topic_name |
pub_msg | Message to be sent |
msg_expiry_time | Maximum validity (in secs) of published message in pending queue. If set as 0, message stays in queue until it is sent out. |
Returns:
ESUCCESS or EFAILURE
Get ThingSpace SDK version
const char* thingspace_sdk_version (void )
Get ThingSpace SDK version.
Returns:
ThingSpace SDK version
Terminate SDK disconnect
int thingspace_terminate (void )
Terminate ThingSpace SDK Disconnect from ThingSpace server.
Returns:
ESUCCESS or EFAILURE
Update profile configuration
int thingspace_update_profile_cfg (bool provision, uint32_t cur_sensor_idx, const char * device_state_json)
Update profile config in config file with current sensor index and device state.
Parameters:
provision | Set provision state |
cur_sensor_idx | Sensor index |
device_state_json | Device state JSON |
Returns:
ESUCCESS or EFAILURE