Difference between revisions of "IoTGateway/DataProcess"

From ESS-WIKI
Jump to: navigation, search
(SQL Field)
(Data Extend Information and SQL Structure for Handler to Manager)
Line 190: Line 190:
 
'''<big>SQL Params structure. This stuucture is designed for Hanlder pass its log behavior.</big>'''
 
'''<big>SQL Params structure. This stuucture is designed for Hanlder pass its log behavior.</big>'''
 
  typedef struct SQLParams
 
  typedef struct SQLParams
  {
+
  {
 +
  int  nVer;              // Version of SQL Param : 1
 
   int  nAction;          // 0: Insert or Update, 1: Delete, 2: Query
 
   int  nAction;          // 0: Insert or Update, 1: Delete, 2: Query
 
   char *pszPrimaryKey;    // NULL => Auto Index
 
   char *pszPrimaryKey;    // NULL => Auto Index
 
   char **pszOutDataPoint; // Pass this point to save result of query
 
   char **pszOutDataPoint; // Pass this point to save result of query
 
   char *pszGeneralInfo;  //  
 
   char *pszGeneralInfo;  //  
   int  *int;              // status code
+
   int  *pnStatus;              // status code
 
   void *pExtend1;
 
   void *pExtend1;
 
   void *pExtend2;
 
   void *pExtend2;
Line 204: Line 205:
 
  typedef struct DataExInfo
 
  typedef struct DataExInfo
 
  {
 
  {
   int  nVer;            // Struct version,  ( 1 )
+
   int  nVer;            // Data Ex Info version: 1
 
   void *pSqlParams;      // address of SQL parameters structure
 
   void *pSqlParams;      // address of SQL parameters structure
 
   void *pExtend1;        // Reserved
 
   void *pExtend1;        // Reserved
 
   void *pExtend2;        // Reserved
 
   void *pExtend2;        // Reserved
 
  }DATAEX_INFO, DataEx_Info;
 
  }DATAEX_INFO, DataEx_Info;

Revision as of 04:54, 6 September 2016

Data Format and SQL Field is designed for Data e-motion, Mqtt Reliability Data Channel.

SQL Field

SQLite Table Fields ( Auto Index)
Item Field Name Type Need Format Example
1 Key Unsigned Int Must   6886 (serial number)
2 SecondKey Text Optional   Default: Hanle Name: SUSHandler
3 Protocol_Param Text Optional JSON Refer to "Protocol Params in JSON Format"
4 Message Text Optional   {IoTGW { …. } )
5 Send Flag Optional 0 or 1 1 or 0
6 Time Unsigned Int Must   33325 ( UTC in sec )
7 General Text Optional   any type format


SQLite Table Fields ( User Assign Key )
Item Field Name Type Need Format Example
1 Key Text Must   /cagent/admin/infoack
2 SecondKey Text Optional   Default: Hanle Name: SUSHandler
3 Protocol_Param Text Optional JSON Refer to "Protocol Params in JSON Format"
4 Message Text Optional   {IoTGW { …. } )
5 Send Flag Optional 0 or 1 1 or 0
6 Time Unsigned Int Must   33325 ( UTC in sec )
7 General Text Optional   any type format


SQLite Methods
Item Method Note
1 Insert *by Primary key

*by Second key ( ex: HandlerName ) ( primary key => auto index )

2 Update by Primary key
3 Query * by Primary key

* by Search rules ( like or updatetime or latest item / order by ? (time ...) )

* All ( order by time )

4 Clean *by Primary Key

*by Search rules ( like or updatetime or latest item / order by ? (time ...) )

*All items of Table

5 Create Table *AutoIndex

*UniqueKey


Protocol Params in JSON Format

{			
  "Protocol":"MQTT",
   "MQTT":{
       "QoS":2,
       "Retain":0
   }						
}

Data Extend Information and SQL Structure for Handler to Manager

SQL Params structure. This stuucture is designed for Hanlder pass its log behavior.

typedef struct SQLParams
{
  int   nVer;              // Version of SQL Param	: 1
  int   nAction;          // 0: Insert or Update, 1: Delete, 2: Query
  char *pszPrimaryKey;    // NULL => Auto Index
  char **pszOutDataPoint; // Pass this point to save result of query
  char *pszGeneralInfo;   // 
  int  *pnStatus;              // status code
  void *pExtend1;
  void *pExtend2;				
}SQL_PARAMS, SQL_Params;    


Data extened Information Structure. Handler can add more information while sending data to WISE Manager.

typedef struct DataExInfo
{	
  int   nVer;            // Data Ex Info version: 1					
  void *pSqlParams;      // address of SQL parameters structure
  void *pExtend1;        // Reserved
  void *pExtend2;        // Reserved
}DATAEX_INFO, DataEx_Info;