Help Center > > Developer Guide> SDK Usage Guide on the Device Side> LiteOS SDK Integration Development Guide> Processfor Connecting Devices to OceanConnect on the Device Side> Data Structure

Data Structure

Updated at: Aug 28, 2019 GMT+08:00
  • Enumerated type of commands delivered by OceanConnect
 typedef enum   
  {   
      ATINY_GET_MANUFACTURER,         /*Obtain the manufacturer name.*/ 
      ATINY_GET_MODEL_NUMBER,         /*Obtain device models defined and used by the manufacturer.*/ 
      ATINY_GET_SERIAL_NUMBER,        /*Obtain the device SN.*/ 
      ATINY_GET_FIRMWARE_VER,         /*Obtain the firmware version number.*/ 
      ATINY_DO_DEV_REBOOT,            /*Deliver device resetting commands.*/  
      ATINY_DO_FACTORY_RESET,         /*Restore factory resetting.*/ 
      ATINY_GET_POWER_SOURCE,         /*Obtain power supplies.*/ 
      ATINY_GET_SOURCE_VOLTAGE,       /*Obtain device voltage.*/ 
      ATINY_GET_POWER_CURRENT,        /*Obtain device current.*/ 
      ATINY_GET_BATERRY_LEVEL,        /*Obtain the battery level.*/ 
      ATINY_GET_MEMORY_FREE,          /*Obtain idle memory.*/ 
      ATINY_GET_DEV_ERR,              /*Obtain the device status, such as used-up memory and low battery level.*/ 
      ATINY_DO_RESET_DEV_ERR,         /*Obtain the device resetting status.*/ 
      ATINY_GET_CURRENT_TIME,         /*Obtain the current time.*/ 
      ATINY_SET_CURRENT_TIME,         /*Set the current time.*/ 
      ATINY_GET_UTC_OFFSET,           /*Obtain the UTC difference.*/ 
      ATINY_SET_UTC_OFFSET,           /*Set the UTC difference.*/ 
      ATINY_GET_TIMEZONE,             /*Obtain the time zone.*/ 
      ATINY_SET_TIMEZONE,             /*Set the time zone.*/ 
      ATINY_GET_BINDING_MODES,        /*Obtain the binding mode.*/ 
      ATINY_GET_FIRMWARE_STATE,       /*Obtain the firmware upgrade status.*/ 
      ATINY_GET_NETWORK_BEARER,       /*Obtain the network bearer type, such as GSM and WCDMA. */ 
      ATINY_GET_SIGNAL_STRENGTH,      /*Obtain the network signal strength.*/ 
      ATINY_GET_CELL_ID,              /*Obtain the network cell ID.*/ 
      ATINY_GET_LINK_QUALITY,         /*Obtain network link quality.*/  
      ATINY_GET_LINK_UTILIZATION,     /*Obtain network link usage.*/ 
      ATINY_WRITE_APP_DATA,           /*Write command words delivering service data.*/ 
      ATINY_UPDATE_PSK,               /*Update PSK command words.*/ 
      ATINY_GET_LATITUDE,             /*Obtain device latitude.*/ 
      ATINY_GET_LONGITUDE,            /*Obtain device longitude.*/ 
      ATINY_GET_ALTITUDE,             /*Obtain device height.*/ 
      ATINY_GET_SPEED,                /*Obtain device running speed.*/ 
      ATINY_GET_TIMESTAMP,            /*Obtain timestamp.*/ 
  } atiny_cmd_e;

  • Enumerated type of key events

This enumerated type is used to notify users of the statuses of LiteOS SDK device-cloud interconnect components.

typedef enum  
 {  
     ATINY_REG_OK,              /*Device registration successful*/ 
     ATINY_REG_FAIL,            /*Device registration failed*/ 
     ATINY_DATA_SUBSCRIBLE,     /*Starting data subscription. Devices allow to report data */ 
     ATINY_DATA_UNSUBSCRIBLE,   /*Canceling data subscription. Devices stop reporting data*/ 
     ATINY_FOTA_STATE           /*Firmware upgrade status*/
 } atiny_event_e;
  • LwM2M parameter structure
typedef struct  
 {  
     char* binding;                             /*U or UQ is currently supported.*/
     int   life_time;                           /*LwM2M protocol life cycle, which is set to 50000 by default.*/
     unsigned int  storing_cnt;                 /*Number of LwM2M cache data packets*/
 } atiny_server_param_t;
  • Security and server parameter structure
typedef struct  
 {  
     bool  is_bootstrap;      /*Whether the bootstrap server is used.*/ 
     char* server_ip;         /*Server IP address, which can be represented by character strings and supports IPv4 and IPv6.*/ 
     char* server_port;       /*Server port number.*/ 
     char* psk_Id;            /*PSK ID.*/ 
     char* psk;               /*PSK*/ 
     unsigned short psk_len;  /*PSK length*/ 
 } atiny_security_param_t;
  • Enumerated type of reported data

Type of data reported by users, which can be expanded based on users' applications.

typedef enum  
 {  
     FIRMWARE_UPDATE_STATE = 0;  /*LWM2M protocol life cycle, which is set to 50000 by default.*/ 
     APP_DATA                     /*User data*/ 
 } atiny_report_type_e;
  • Server parameter structure
typedef struct  
 {  
     atiny_server_param_t   server_params;  
     atiny_security_param_t security_params[2];  /*One IoT server and one bootstrap server are supported.*/ 
 } atiny_param_t;

  • Device parameter structure
typedef struct   
 {   
     char* endpoint_name;    /*Device ID generated for northbound application*/  
     char* manufacturer;     /*Manufacturer name generated for northbound application*/ 
     char* dev_type;         /*Device type generated for northbound application*/ 
 } atiny_device_info_t;
  • Reported data structure

The following enumerated values indicate user data types. For example, data is sent successfully; data has been sent but is not acknowledged. The specific information is as follows:

typedef enum  
 {  
     NOT_SENT = 0,        /*To-be-reported data has not been sent.*/ 
     SENT_WAIT_RESPONSE,  /*To-be-reported data has been sent and is waiting for response.*/ 
     SENT_FAIL,           /*To-be-reported data sending failed.*/ 
     SENT_TIME_OUT,       /*To-be-reported data has been sent and waiting for response times out.*/ 
     SENT_SUCCESS,        /*To-be-reported data sending successful.*/ 
     SENT_GET_RST,        /*To-be-reported data has been sent but the receiver sends an RST packet.*/ 
     SEND_PENDING,        /*To-be-reported data is waiting for sending.*/ 
 } data_send_status_e;  

//Users can use the following data structure to report data:

  typedef struct _data_report_t  
 {  
     atiny_report_type_e type;    /*Reported data type, such as service data and remaining battery level.*/  
     int cookie;                  /*Data cookie, which is used to distinguish data during ACK callback.*/  
     int len;                     /*Data length, which must be not greater than MAX_REPORT_DATA_LEN.*/  
     uint8_t* buf;                /*First address of the data buffer.*/  
     atiny_ack_callback callback; /*ACK callback, whose value is data_send_status_e.*/  
 } data_report_t;

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel