API  2.2
TSmarT Software Library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions

Functions

int8_t TSMART_LHINGS_CELLULAR_2G_Start (tsmart_lhings_cellular_2g_config_t *TSMART_LHINGS_CELLULLAR_2G_config)
 Starts the cellular 2g interface. More...
 
int8_t TSMART_LHINGS_CELLULAR_2G_Stop (void)
 Stops the cellular 2G interface. More...
 
int8_t TSMART_LHINGS_CELLULAR_2G_NetworkAttachment (tsmart_lhings_cellular_2g_network_t *TSMART_LHINGS_CELLULAR_2G_network)
 Attaches to the 2G network. More...
 
int8_t TSMART_LHINGS_CELLULAR_2G_NetworkDeAtachment (void)
 Network detachment. More...
 
int8_t TSMART_LHINGS_CELLULAR_2G_Init (void)
 Initializes the cellular 2G interface. More...
 
int8_t TSMART_LHINGS_WIFI_Start (void)
 Starts the WIFI interface. More...
 
void TSMART_LHINGS_WIFI_Stop (void)
 Stops the WIFI interface. More...
 
int8_t TSMART_LHINGS_WIFI_ConnectToAP (tsmart_lhings_wifi_wlan_t *TSMART_LHINGS_WIFI_wlan)
 Connects to an access point. More...
 
int8_t TSMART_LHINGS_WIFI_DisconnectfromAP (void)
 Disconnects form the access point. More...
 
int8_t TSMART_LHINGS_WIFI_Init (void)
 Initializes WIFI interface. More...
 
void TSMART_LHINGS_ETHERNET_Start (tsmart_lhings_ethernet_config_t *TSMART_LHINGS_ETHENET_config)
 Starts the Ethernet interface. More...
 
int8_t TSMART_LHINGS_ETHERNET_Init (void)
 Initializes the ethernet interface. More...
 
int8_t TSMART_LHINGS_DeviceDelete (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Deletes the device with the given uuid. More...
 
int8_t TSMART_LHINGS_DeviceEndSession (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Used to tell Lhings that the specified device will no longer be available. More...
 
int8_t TSMART_LHINGS_DeviceIsInstall (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, uint8_t *TSMART_LHINGS_installed, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Tells whether the device with the given uuid is installed or not. More...
 
int8_t TSMART_LHINGS_DeviceList (uint8_t *TSMART_LHINGS_apikey, tsmart_lhings_device_t *TSMART_LHINGS_device_list, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Returns a list of the devices that belong to the user account used to authenticate the request. More...
 
int8_t TSMART_LHINGS_DeviceRegister (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_device_name, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Registers a new device with Lhings. More...
 
int8_t TSMART_LHINGS_DeviceSetDescriptor (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_device_descriptor_t *TSMART_LHINGS_device_descriptor, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Used by devices to upload their device descriptor to Lhings. More...
 
int8_t TSMART_LHINGS_DeviceReinstall (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Commands Lhings to reinstall the device with the given uuid. More...
 
int8_t TSMART_LHINGS_DeviceSendEvent (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_event_t *TSMART_LHINGS_event, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Notifies that the event named eventName has been generated by the device with the given uuid. More...
 
int8_t TSMART_LHINGS_DeviceStartSession (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Used to tell Lhings that the specified device is available. More...
 
int8_t TSMART_LHINGS_DeviceUnistall (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Commands Lhings to uninstall the device with the given uuid. More...
 
int8_t TSMART_LHINGS_StatusStore (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_state_variable_t *TSMART_LHINGS_state_variable, uint8_t TSMART_LHINGS_n_state_variables, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Asks Lhings to store the status of a device. More...
 
int8_t TSMART_LHINGS_RuleCreate (uint8_t *TSMART_LHINGS_apikey, uint8_t *TSMART_LHINGS_uuid, tsmart_lhings_rule_t *TSMART_LHINGS_rule, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Creates a new rule. More...
 
int8_t TSMART_LHINGS_RuleDelete (uint8_t *TSMART_LHINGS_apikey, uint32_t TSMART_LHINGS_rule_id, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Deletes the rule with the given ruleId. More...
 
int8_t TSMART_LHINGS_RuleDisable (uint8_t *TSMART_LHINGS_apikey, uint32_t TSMART_LHINGS_rule_id, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Commands Lhings to disable the rule with the given ruleId. More...
 
int8_t TSMART_LHINGS_RuleEnable (uint8_t *TSMART_LHINGS_apikey, uint32_t TSMART_LHINGS_rule_id, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Commands Lhings to enable the rule with the given ruleId. More...
 
int8_t TSMART_LHINGS_RuleIsEnable (uint8_t *TSMART_LHINGS_apikey, uint32_t TSMART_LHINGS_rule_id, uint8_t *TSMART_LHINGS_enabled, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Tells whether the rule with the given ruleId is enabled or not. More...
 
int8_t TSMART_LHINGS_RuleIsBroken (uint8_t *TSMART_LHINGS_apikey, uint32_t TSMART_LHINGS_rule_id, uint8_t *TSMART_LHINGS_broken, tsmart_lhings_buffer_t *TSMART_LHINGS_buffer)
 Tells whether the rule with the given ruleId is broken or not. More...
 
int8_t TSMART_LHINGS_ReadIP (tsmart_lhings_ip_t *TSMART_LHINGS_ip)
 Reads the current IP address. More...
 

Detailed Description

Function Documentation

int8_t TSMART_LHINGS_CELLULAR_2G_Init ( void  )

Initializes the cellular 2G interface.

Initializes the hardware configuration of the cellular 2g module and the associated OS mechanisms.

Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Not possible to get software resources.
Examples:
lhings_2g.c.
int8_t TSMART_LHINGS_CELLULAR_2G_NetworkAttachment ( tsmart_lhings_cellular_2g_network_t TSMART_LHINGS_CELLULAR_2G_network)

Attaches to the 2G network.

This function attaches to the available 2G network. To achieve it, it's necessary to know some network parameters such as APN, login and password.

Parameters
TSMART_LHINGS_CELLULAR_2G_networkCellular 2g network structure pointer.
Returns
  • TSMART_PASS - OK.
  • TSMART_LHINGS_FAULT_CODE1 - Bearer configuration failure.
  • TSMART_LHINGS_FAULT_CODE2 - Fails Starting bearer.
  • TSMART_LHINGS_FAULT_CODE3 - Fails the registration in the 2g network.
Examples:
lhings_2g.c.
int8_t TSMART_LHINGS_CELLULAR_2G_NetworkDeAtachment ( void  )

Network detachment.

This function disconnects the cellular 2g form the 2G network.

Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Fails stopping bearer, it was impossible to do a network detachment.
int8_t TSMART_LHINGS_CELLULAR_2G_Start ( tsmart_lhings_cellular_2g_config_t TSMART_LHINGS_CELLULLAR_2G_config)

Starts the cellular 2g interface.

This function starts the cellular 2g interface for LHINGS middleware. It turns on the cellular 2G device and sets it up.

Parameters
TSMART_LHINGS_CELLULLAR_2G_configCelullar 2G configuration structure pointer.
Returns
  • TSMART_PASS - OK.
  • TSMART_LHINGS_FAULT_CODE1 - Fails turning on.
  • TSMART_LHINGS_FAULT_CODE2 - Configuration failure.
  • TSMART_LHINGS_FAULT_CODE3 - Fails start TCP/IP stack.
  • TSMART_LHINGS_FAULT_CODE4 - TCP/IP stack configuration failure.
Examples:
lhings_2g.c.
int8_t TSMART_LHINGS_CELLULAR_2G_Stop ( void  )

Stops the cellular 2G interface.

This function Turns off the cellular 2g device.

Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - It's not possible to stop it.
Examples:
lhings_2g.c.
int8_t TSMART_LHINGS_DeviceDelete ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Deletes the device with the given uuid.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceEndSession ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Used to tell Lhings that the specified device will no longer be available.

After calling this service Lhings marks the device as offline and it will not send any actions, status requests or any other kind of message to the device.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceIsInstall ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
uint8_t *  TSMART_LHINGS_installed,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Tells whether the device with the given uuid is installed or not.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_installedOutput parameter. It indicates if the device is install(its value is 1) or not(its value is 0 ).
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceList ( uint8_t *  TSMART_LHINGS_apikey,
tsmart_lhings_device_t TSMART_LHINGS_device_list,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Returns a list of the devices that belong to the user account used to authenticate the request.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_device_listDevice list structure pointer (output parameter).
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceRegister ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_device_name,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Registers a new device with Lhings.

Used to tell Lhings that a new device has been created. Upon succesful creation, Lhings will return the uuid of the newly created device. The device will belong to the account which API Key was used to authenticate the request.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_device_nameDevice name to be created.
TSMART_LHINGS_uuidLocal UUID(output parameter).
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceReinstall ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Commands Lhings to reinstall the device with the given uuid.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceSendEvent ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_event_t TSMART_LHINGS_event,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Notifies that the event named eventName has been generated by the device with the given uuid.

Each event may have a string payload that will be sent to all the receivers of the events (i.e., the performers of the actions defined in the rules corresponding to this event).

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_eventEvent structure pointer to be sent.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceSetDescriptor ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_device_descriptor_t TSMART_LHINGS_device_descriptor,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Used by devices to upload their device descriptor to Lhings.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_device_descriptorDevice descriptor structure pointer.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceStartSession ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Used to tell Lhings that the specified device is available.

After calling this service Lhings marks the device as online and it will send actions, status requests or any other kind of message to the device.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_DeviceUnistall ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Commands Lhings to uninstall the device with the given uuid.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_ETHERNET_Init ( void  )

Initializes the ethernet interface.

Initializes the hardware configuration of the Wiznet ethernet module and the associated OS mechanisms.

Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Not possible to get software resources.
Examples:
lhings_eth.c.
void TSMART_LHINGS_ETHERNET_Start ( tsmart_lhings_ethernet_config_t TSMART_LHINGS_ETHENET_config)

Starts the Ethernet interface.

This function starts the Ethernet interface for LHINGS middleware.

Parameters
TSMART_LHINGS_ETHENET_configEthernet Network configuration struct.
Examples:
lhings_eth.c.
int8_t TSMART_LHINGS_ReadIP ( tsmart_lhings_ip_t TSMART_LHINGS_ip)

Reads the current IP address.

Parameters
TSMART_LHINGS_ipIPv4 structure pointer(output parameter).
Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Reading IP failure.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_RuleCreate ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_rule_t TSMART_LHINGS_rule,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Creates a new rule.

A rule commands a device or app to perform a particular action when a given event is generated by another device or app. Source device or app and target device or app must be provided. Args for the action may be provided.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_ruleRule structure pointer (Rule Id field is an output parameter).
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_RuleDelete ( uint8_t *  TSMART_LHINGS_apikey,
uint32_t  TSMART_LHINGS_rule_id,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Deletes the rule with the given ruleId.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_rule_idRule identifier.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_RuleDisable ( uint8_t *  TSMART_LHINGS_apikey,
uint32_t  TSMART_LHINGS_rule_id,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Commands Lhings to disable the rule with the given ruleId.

Once disabled the action specified by the rule will not be executed when the corresponding event is received.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_rule_idRule identifier.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_RuleEnable ( uint8_t *  TSMART_LHINGS_apikey,
uint32_t  TSMART_LHINGS_rule_id,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Commands Lhings to enable the rule with the given ruleId.

Once enabled the action specified by the rule will be executed when the corresponding event is received.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_rule_idRule identifier.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_RuleIsBroken ( uint8_t *  TSMART_LHINGS_apikey,
uint32_t  TSMART_LHINGS_rule_id,
uint8_t *  TSMART_LHINGS_broken,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Tells whether the rule with the given ruleId is broken or not.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_rule_idRule identifier.
TSMART_LHINGS_brokenOutput paramter.Rule broken(1) or not broken(0).
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_RuleIsEnable ( uint8_t *  TSMART_LHINGS_apikey,
uint32_t  TSMART_LHINGS_rule_id,
uint8_t *  TSMART_LHINGS_enabled,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Tells whether the rule with the given ruleId is enabled or not.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_rule_idRule ididentifier.
TSMART_LHINGS_enabledOutput parameter. Rule enabled(1) or disabled(0).
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_StatusStore ( uint8_t *  TSMART_LHINGS_apikey,
uint8_t *  TSMART_LHINGS_uuid,
tsmart_lhings_state_variable_t TSMART_LHINGS_state_variable,
uint8_t  TSMART_LHINGS_n_state_variables,
tsmart_lhings_buffer_t TSMART_LHINGS_buffer 
)

Asks Lhings to store the status of a device.

The status is stored using the timestamp of the server.

Parameters
TSMART_LHINGS_apikeyLhings Api key.
TSMART_LHINGS_uuidLocal UUID.
TSMART_LHINGS_state_variableState variable structure pointer.
TSMART_LHINGS_n_state_variablesNumber of state variables to be sent.
TSMART_LHINGS_bufferLhings buffer.
Returns
  • TSMART_PASS - OK
  • TSMART_LHINGS_FAULT_CODE1 - Connection failure.
  • TSMART_LHINGS_FAULT_CODE2 - Sending failure.
  • TSMART_LHINGS_FAULT_CODE3 - Closing connection failure
  • TSMART_LHINGS_FAULT_CODE4 - Wrong answer.
Examples:
lhings_2g.c, lhings_eth.c, and lhings_wifi.c.
int8_t TSMART_LHINGS_WIFI_ConnectToAP ( tsmart_lhings_wifi_wlan_t TSMART_LHINGS_WIFI_wlan)

Connects to an access point.

This function establishes a wireless link with an access point available. To achieve it, it's necessary to know some network parameters such as SSID, type and network key among others.

Parameters
TSMART_LHINGS_WIFI_wlanWLAN parameters estructure pointer.
Returns
  • TSMART_PASS - OK.
  • TSMART_LHINGS_FAULT_CODE1 - Fails setting IP configuration.
  • TSMART_LHINGS_FAULT_CODE2 - The access point configured doesn't work.
Examples:
lhings_wifi.c.
int8_t TSMART_LHINGS_WIFI_DisconnectfromAP ( void  )

Disconnects form the access point.

This function disconnects the WIFI device form the WIFI network.

Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Fails disconnecting.
int8_t TSMART_LHINGS_WIFI_Init ( void  )

Initializes WIFI interface.

Initializes the hardware configuration of the WIFI module and the associated OS mechanisms.

Returns
  • TSMART_PASS - OK
  • TSMART_FAIL - Not possible to get software resources.
Examples:
lhings_wifi.c.
int8_t TSMART_LHINGS_WIFI_Start ( void  )

Starts the WIFI interface.

This function starts the WIFI interface for LHINGS middleware.

Returns
  • TSMART_PASS - OK.
  • TSMART_FAIL - Fails Event mask.
Examples:
lhings_wifi.c.
void TSMART_LHINGS_WIFI_Stop ( void  )

Stops the WIFI interface.

This function Turns off the WIFI device.

Examples:
lhings_wifi.c.