Difference between revisions of "EIS Service SDK"

From ESS-WIKI
Jump to: navigation, search
Line 128: Line 128:
  
 
== Function for Service ==
 
== Function for Service ==
<pre>SV_CODE SV_GetCapability( const char *ServiceName, char *outBuffer,  int bufSize )</pre>
 
  
*'''Description''': Query All of Service Name
+
'''<span style="color:#FF0000;"><span style="font-size:larger;">SV_CODE SV_GetCapability( const char *ServiceName, char *outBuffer,&nbsp; int bufSize )</span></span>'''
 +
 
 +
*'''Description''': Get Service's Capability
 
*'''Parameter''':
 
*'''Parameter''':
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - char * outBuf &nbsp;(out): &nbsp;point of result buffer size ( recomd: 1024 bytes ) => { "Service":{"e":[{"n":"HDD_PMQ},{"n":"Modebus"}] }
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- const char * ServiceName (in): &nbsp; &nbsp;Service Name => HDD_PMQ
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;int &nbsp; &nbsp; bufsize &nbsp; &nbsp; &nbsp;(in): &nbsp;max size of buffer
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- char * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;outBuffer &nbsp; &nbsp; (out): &nbsp; &nbsp; buffer point for Service's Info Spec&nbsp;( Recommend:4096 characters&nbsp;)
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- int &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bufSize &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(in): &nbsp; &nbsp; Max buffer size ( Recommend: 4096 )&nbsp;
  
 
*'''Return value:'''
 
*'''Return value:'''
Line 144: Line 147:
  
  
<pre>SV_CODE SV_AutoReportStart( const char *ServiceName , char *inData, int inDataLen  );</pre>
 
  
*'''Description''': Query All of Service Name
+
 
 +
 
 +
'''<span style="color:#FF0000;"><span style="font-size:larger;">SV_CODE SV_AutoReportStart( const char *ServiceName , char *inData, int inDataLen&nbsp; );</span></span>'''
 +
 
 +
*'''Description''': Start Auto Report
 
*'''Parameter''':
 
*'''Parameter''':
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - char * outBuf &nbsp;(out): &nbsp;point of result buffer size ( recomd: 1024 bytes ) => { "Service":{"e":[{"n":"HDD_PMQ},{"n":"Modebus"}] }
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- const char * ServiceName (in): &nbsp; &nbsp;Service Name => HDD_PMQ
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- char * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inData (in): &nbsp; &nbsp; Start JSON Data
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;int &nbsp; &nbsp; bufsize &nbsp; &nbsp; &nbsp;(in): &nbsp;max size of buffer
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- int &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; inDataLen (in): &nbsp; &nbsp; Data Length
  
 
*'''Return value:'''
 
*'''Return value:'''
Line 160: Line 168:
  
  
<pre>SV_CODE  SV_AutoReportStop( const char *ServiceName, char *inData, int inDataLen );</pre>
 
  
*'''Description''': Query All of Service Name
+
 
 +
 
 +
<span style="color:#FF0000;"><span style="font-size:larger;">'''SV_CODE&nbsp; SV_AutoReportStop( const char *ServiceName, char *inData, int inDataLen );'''</span></span>
 +
 
 +
*'''Description''': Stop Auto Report
 
*'''Parameter''':
 
*'''Parameter''':
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - char * outBuf &nbsp;(out): &nbsp;point of result buffer size ( recomd: 1024 bytes ) => { "Service":{"e":[{"n":"HDD_PMQ},{"n":"Modebus"}] }
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- const char * ServiceName (in): &nbsp; &nbsp;Service Name => HDD_PMQ
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- char * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inData (in): &nbsp; &nbsp; Start JSON Data
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;int &nbsp; &nbsp; bufsize &nbsp; &nbsp; &nbsp;(in): &nbsp;max size of buffer
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- int &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; inDataLen (in): &nbsp; &nbsp; Data Length
  
 
*'''Return value:'''
 
*'''Return value:'''
Line 176: Line 189:
  
  
<pre>SV_CODE SV_Action( const char *ServiceName , char *szAction,  void *pUserData );</pre>
 
  
*'''Description''': Query All of Service Name
+
<span style="color:#FF0000;">'''<span style="font-size:larger;">SV_CODE SV_Action( const char *ServiceName , char *szAction,&nbsp; void *pUserData );</span>'''</span>
 +
 
 +
*'''Description''': Action function for Get / Set&nbsp;Command
 
*'''Parameter''':
 
*'''Parameter''':
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - char * outBuf &nbsp;(out): &nbsp;point of result buffer size ( recomd: 1024 bytes ) => { "Service":{"e":[{"n":"HDD_PMQ},{"n":"Modebus"}] }
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;- const char * ServiceName (in) : &nbsp; &nbsp;Service Name => HDD_PMQ
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;- char * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; szAction (in) : &nbsp; &nbsp;Action Command with JSON
  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&nbsp;int &nbsp; &nbsp; bufsize &nbsp; &nbsp; &nbsp;(in): &nbsp;max size of buffer
+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;- void * &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pUserData ( in): &nbsp; &nbsp;User data will return when result is callbacked
  
 
*'''Return value:'''
 
*'''Return value:'''

Revision as of 05:06, 3 July 2017

Definition

Service Return Code

typedef enum {                                                        
    SV_ER_NOT_IMPLEMENT                = -13,   /*        Does Not Support this command        (501)        */
    SV_ER_TIMEOUT                      = -12,   /*        Request Timeout                      (408)        */
    SV_ER_SYS_BUSY                     = -11,   /*        System is busy                       (503)        */
    SV_ER_VALUE_OUT_OF_RNAGE           = -10,   /*        Value is out of range                (416)        */
    SV_ER_SYNTAX_ERROR                 =  -9,   /*        Format is correct but syntax error   (422)        */
    SV_ER_FORMAT_ERROR                 =  -8,   /*        Format error                         (415)        */
    SV_ER_REQUEST_ERROR                =  -7,   /*        Request error                        (400)        */
    SV_ER_RESOURCE_LOSE                =  -6,   /*        SenHub disconnect                    (410)        */
    SV_ER_RESOURCE_LOCKED              =  -5,   /*        Resource is in setting               (426)        */
    SV_ER_NOT_FOUND                    =  -4,   /*        Resource Not Found                   (404)        */
    SV_ER_WRITE_ONLY                   =  -3,   /*        Read Only                            (405)        */
    SV_ER_READ_ONLY                    =  -2,   /*        Write Only                           (405)        */
    SV_ER_FAILED                       =  -1,   /*        Failed                               (500)        */
    SV_OK                              =   0,   /*        Success                              (200)        */
    SV_INITILIZED                      =   1,   /*        Library had initilized                            */
} SV_CODE;

Service Status

typedef enum
{
    SV_UNINIT = 0,
    SV_INIT   = 1,
    SV_JOINED = 2,
    SV_LEAVED = 3,
}SV_STATUS;

Service Event Callback Function

typedef SV_CODE (SVCALL *Service_Cb) ( SV_EVENT e, char *ServiceName, void *inData, int dataLen, void *UserData )

Service Event Type

typedef enum
{
    SV_E_JoinServiceSystem,        // Connected to the Service System
    SV_E_LeaveServiceSystem,       // Disconnected from the Service System
    SV_E_RegisterService,          // Registed a new Service ( ex: HDD_PMQ Plugin )
    SV_E_DeregisterService,        // Deregisted a Service
    SV_E_UpdateServiceCapability,  // Update Service's Capability
    SV_E_UpdateData,               // Update Service's data value
    SV_E_ActionResult,             // Get / Set Reply
    SV_E_EventNotify,              // EventNotify
}SV_EVENT;

Functions

Initial & Uninitial 

SV_CODE SV_Initialize( Service_Cb fn, void *pInUserData )

  • Description:Initialize the Service SDK
  • Parameter:

           Service_Cb     fn: point of callback function

            void* pInUserData: user data will pass when callback

  • Return value:

            SV_CODE  -         SV_OK        : Successful
                                  SV_ER_FAILED : Failed to call

  • History:   06/26/2017 Modified


SV_CODE SV_Uninitialize( );

  • Description: UnInitialize the Service SDK
  • Parameter: NONE
  • Return value:

           SV_CODE  - SV_OK                : Successful
                                SV_ER_FAILED  : Failed to call

  • History:   06/26/2017 Modified

Information

SV_CODE SV_GetVersion(char *outVersion, int bufSize ); 

  • Description: Get version of Service SDK
  • Parameter:

      - char * outVersion (out): point of result buffer size ( recomd: 128 bytes ) =>v1.0.1
      - int    bufsize     (in): max size of buffer

  • Return value:

        SV_CODE  - SV_OK               : Successful
                           - SV_ER_FAILED: Failed to call

  • History:   06/26/2017 Modified



SV_STATUS SV_GetServiceStatus( );

  • Description: Get status of Service System
  • Parameter:

             NONE

  • Return value:

                  SERVICE_STATUS - SV_UNINIT: SDK NOT Initilize
                                                  - SV_INIT     : Init Status
                                                  - SV_JOINED: Joined to Service System
                                                  - SV_LEAVED: Leaved from Service System

  • History:   06/26/2017 Modified



SV_CODE SV_Query_Service( char *outBuf, int bufSize );

  • Description: Query All of Service Name
  • Parameter:

            - char * outBuf  (out):  point of result buffer size ( recomd: 1024 bytes ) => { "Service":{"e":[{"n":"HDD_PMQ},{"n":"Modebus"}] }

            - int     bufsize      (in):  max size of buffer

  • Return value:

           SV_CODE  - SV_OK               : Successful
                               - SV_ER_FAILED: Failed to call

  • History:   06/26/2017 Modified

Function for Service

SV_CODE SV_GetCapability( const char *ServiceName, char *outBuffer,  int bufSize )

  • Description: Get Service's Capability
  • Parameter:

           - const char * ServiceName (in):    Service Name => HDD_PMQ

           - char *            outBuffer     (out):     buffer point for Service's Info Spec ( Recommend:4096 characters )

           - int                  bufSize            (in):     Max buffer size ( Recommend: 4096 ) 

  • Return value:

           SV_CODE  - SV_OK               : Successful
                               - SV_ER_FAILED: Failed to call

  • History:   06/26/2017 Modified



SV_CODE SV_AutoReportStart( const char *ServiceName , char *inData, int inDataLen  );

  • Description: Start Auto Report
  • Parameter:

           - const char * ServiceName (in):    Service Name => HDD_PMQ

           - char *                      inData (in):     Start JSON Data

           - int                      inDataLen (in):     Data Length

  • Return value:

           SV_CODE  - SV_OK               : Successful
                               - SV_ER_FAILED: Failed to call

  • History:   06/26/2017 Modified



SV_CODE  SV_AutoReportStop( const char *ServiceName, char *inData, int inDataLen );

  • Description: Stop Auto Report
  • Parameter:

           - const char * ServiceName (in):    Service Name => HDD_PMQ

           - char *                      inData (in):     Start JSON Data

           - int                      inDataLen (in):     Data Length

  • Return value:

           SV_CODE  - SV_OK               : Successful
                               - SV_ER_FAILED: Failed to call

  • History:   06/26/2017 Modified


SV_CODE SV_Action( const char *ServiceName , char *szAction,  void *pUserData );

  • Description: Action function for Get / Set Command
  • Parameter:

           - const char * ServiceName (in) :    Service Name => HDD_PMQ

            - char *                     szAction (in) :    Action Command with JSON

            - void *                 pUserData ( in):    User data will return when result is callbacked

  • Return value:

           SV_CODE  - SV_OK               : Successful
                               - SV_ER_FAILED: Failed to call

  • History:   06/26/2017 Modified