|
|
(3 intermediate revisions by the same user not shown) |
Line 119: |
Line 119: |
| | | |
| | | |
− | ==Media Types for Sensor Markup Language (SENML)== | + | == Media Types for Sensor Markup Language (SENML) == |
| | | |
| '''Semantics''' | | '''Semantics''' |
Line 125: |
Line 125: |
| {| style="border-spacing:0;width:17.009cm;" | | {| style="border-spacing:0;width:17.009cm;" |
| |- style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | | |- style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" |
− | || SenML | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">SenML</span> |
− | || JSON | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">JSON</span> |
− | || Type | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Type</span> |
− | || Description | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Description</span> |
| |- | | |- |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Base Name</span> | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Base Name</span> |
Line 173: |
Line 173: |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | sv | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | sv |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | String | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | String |
− | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | String of the entry |
| |- | | |- |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Boolean Value | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Boolean Value |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | bv | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | bv |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Boolean | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Boolean |
− | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | Boolean of the entry |
| |- | | |- |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Value Sum | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Value Sum |
Line 194: |
Line 194: |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Integer</span> | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Integer</span> |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Update time. A time in seconds that represents the maximum time before this sensor will provide an updated reading for a measurement.</span> | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">Update time. A time in seconds that represents the maximum time before this sensor will provide an updated reading for a measurement.</span> |
− | |-
| |
| |} | | |} |
− |
| |
| | | |
| ==The Data Type of Sensor Data Type== | | ==The Data Type of Sensor Data Type== |
Line 230: |
Line 228: |
| | | |
| | | |
− | ==Advantech Sensor Semantics== | + | == Advantech Sensor Semantics == |
| | | |
| {| style="border-spacing:0;width:17.009cm;" | | {| style="border-spacing:0;width:17.009cm;" |
| |- style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | | |- style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" |
− | || SenML
| + | | SenML |
− | || JSON
| + | | JSON |
− | || Type
| + | | Type |
− | || Description
| + | | Description |
| |- | | |- |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Min Range Value | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Min Range Value |
Line 263: |
Line 261: |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Integer | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Integer |
| | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">The health status of network or device. Range: -1 ~ 100</span> | | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | <span style="color:#000000;">The health status of network or device. Range: -1 ~ 100</span> |
| + | <span style="color:#000000;">Good: > 80, Average: 60 ~ 80, Below Average: 40~60, Bad:0~40, -1: Off line or Fault</span> |
| | | |
− | <span style="color:#000000;">Good: > 80, Average: 60 ~ 80, Below Average: 40~60, Bad:0~40, -1: Off line or Fault</span>
| |
| |- | | |- |
− | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Message |
− | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | msg |
− | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | String |
− | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | | + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | Message for resource |
| |- | | |- |
| + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | Extension |
| + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | exten |
| + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;" | String |
| + | | style="border:0.5pt solid #00000a;padding-top:0cm;padding-bottom:0cm;padding-left:0.199cm;padding-right:0.191cm;color:#000000;" | Field for exten |
| |} | | |} |
| | | |
| + | '''Example''' |
| | | |
− | '''Example'''<br />
| + | <big>{"n":"Room Temp","u":"Cel","v":0,"min":0,"max":100,"asm":"r","type":"d","rt":"ucum.Cel","st":"ipso","exten":"sid=3303"}</big><br/> |
− | | |
− | <big>{"n":"Room Temp","u":"Cel","v":0,"min":0,"max":100,"asm":"r","type":"d","rt":"ucum.Cel","st":"ipso","exten":"sid=3303"}</big> | |
− | <br /><br />
| |
− | | |
− | =Application Program Interface (API)=
| |
− | | |
− | | |
− | ==Event of Callback==
| |
− | | |
− | typedef enum {
| |
− | // Interface: 1000 ~ 1999
| |
− | SN_Inf_UpdateInterface_Data = 1000, // Update Interface data
| |
− |
| |
− | // Sensor Hub: 2000 ~ 2999
| |
− | SN_SenHub_Register = 2000, // A SenHub connected
| |
− | SN_SenHub_SendInfoSpec = 2001, // Report the resource information of SenHub
| |
− | SN_SenHub_AutoReportData = 2002, // Auto report data value of SenHub
| |
− | SN_SenHub_Disconnect = 2003, // A SenHub disconnected
| |
− |
| |
− | SN_SetResult = 3000, // Return the result of setting value
| |
− | } SN_EVENT_ID;
| |
− | | |
− | ==Command ID==
| |
− | <span style="color:#0000ff;">typedef</span> <span style="color:#0000ff;">enum </span>{
| |
− | SN_Set_ReportSNManagerDataCbf <nowiki>= 3000, </nowiki><span style="color:#008000;">// Set Event Callback function point </span>
| |
− | } SN_CTL_ID;
| |
− | | |
− | ==Return Code Definition==
| |
− | <span style="color:#0000ff;">typedef</span> <span style="color:#0000ff;">enum </span>{
| |
− | SN_ER_NOT_IMPLEMENT <nowiki>= -13, </nowiki><span style="color:#008000;"> // Dose Not Support this command (501)</span>
| |
− | SN_ER_TIMEOUT <nowiki>= -12 </nowiki><span style="color:#008000;"> // Request Timeout (408)</span>
| |
− | SN_ER_SYS_BUSY <nowiki>= -11 </nowiki><span style="color:#008000;"> // System is busy (503)</span>
| |
− | SN_ER_VALUE_OUT_OF_RANGE <nowiki>= -10 </nowiki><span style="color:#008000;"> // Value is out of range (416)</span>
| |
− | SN_ER_SYNTAX_ERROR <nowiki>= -9 </nowiki><span style="color:#008000;"> // Format is correct but syntax error (422)</span>
| |
− | SN_ER_FORMAT_ERROR <nowiki>= -8 </nowiki><span style="color:#008000;"> // Format error (415) </span>=
| |
− | SN_ER_REQUEST_ERROR <nowiki>= -7 </nowiki><span style="color:#008000;"> // Request error (400)</span>
| |
− | SN_ER_RESOURCE_LOSE <nowiki>= -6 </nowiki><span style="color:#008000;"> // Resource is lose (410)</span>
| |
− | SN_ER_RESOURCE_LOCKED <nowiki>= -5, </nowiki><span style="color:#008000;"> // Resource is in setting (426)</span>
| |
− | SN_ER_NOT_FOUND <nowiki>= -4, </nowiki><span style="color:#008000;"> // Resource Not Found (404)</span>
| |
− | SN_ER_WRITE_ONLY <nowiki>= -3, </nowiki><span style="color:#008000;"> // Write Only (405)</span>
| |
− | SN_ER_READ_ONLY <nowiki>= -2, </nowiki><span style="color:#008000;"> // Read Only (405)</span>
| |
− | SN_ER_FAILED <nowiki>= -1, </nowiki><span style="color:#008000;"> // Failed (500)</span></div>
| |
− | SN_OK <nowiki>= 0, </nowiki><span style="color:#008000;"> // Successfully (200)</span></div>
| |
− | SN_INITILIZED <nowiki>= 1, </nowiki><span style="color:#008000;"> // Library had initilized</span></div>
| |
− | } SN_CODE;
| |
− | | |
− | ==Structure Definition==
| |
− | | |
− | <span style="color:#0000ff;">typedef</span> <span style="color:#0000ff;">struct</span> _SenHubInfo
| |
− | {
| |
− | <span style="color:#0000ff;">char</span> sMAC[MAX_SN_MAC]; <span style="color:#008000;"> // MAC: remove '-' and ':'</span>
| |
− | <span style="color:#0000ff;">char</span> sHostName[MAX_SN_HOSTNAME]; <span style="color:#008000;"> // WISE1020-MAC(4)</span>
| |
− | <span style="color:#0000ff;">char</span> sSN[MAX_SN_SNO]; <span style="color:#008000;"> // MAC: remove '-' and ':'</span>
| |
− | <span style="color:#0000ff;">char</span> sProduct[MAX_SN_PRODUCT_NAME]; <span style="color:#008000;"> // WISE1020</span>
| |
− | <span style="color:#0000ff;">void</span> *pExtened; <span style="color:#008000;"> // Reserve for extension</span>
| |
− | }SenHubInfo<nowiki>;</nowiki>
| |
− | | |
− | ==Sensor Network Manager API Definition==
| |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;">'''SNMCODE SN_Manager_Initialize( );'''</span>
| |
− | | |
− | | |
− | '''Description'''
| |
− | | |
− | This function initializes the Sensor Network Manager API Library. You must call this function before using this module.
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | None
| |
− | | |
− | | |
− | '''Return Values '''
| |
− | | |
− | SNM__OK: Successfully to initialize the Sensor Network Manager module.
| |
− | | |
− | SNM_FAILED: Failed to initialize the Sensor Network Manager module.
| |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;">'''SNMCODE SN_Manager_Uninitialize();'''</span>
| |
− | | |
− | | |
− | '''Description'''
| |
− | | |
− | This function uninitialized the Sensor Network Manager Module. You must call this function before closing this module to release resources.
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | None
| |
− | | |
− | | |
− | '''Return Values '''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM__OK: S{{anchor|OLELINK43}} {{anchor|OLELINK42}} uccessfully to uninitialized {{anchor|OLELINK12}} {{anchor|OLELINK11}} the Sensor Network Manager module.</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM_FAILED : Failed to uninitialized the Sensor Network Manager module.</div>
| |
− | | |
− | | |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;">'''SNMCODE SN_Manager_GetCapability(</span><span style="background-color:#d9d9d9;color:#0000ff;">char</span><span style="background-color:#d9d9d9;"> **'''</span><span style="background-color:#d9d9d9;"> ppzDataBuffer</span><span style="background-color:#d9d9d9;">''', </span><span style="background-color:#d9d9d9;color:#0000ff;">int</span><span style="background-color:#d9d9d9;"> *pnLen );'''</span>
| |
− | | |
− | | |
− | '''Description'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">This function is used to get all interfaces information of this IoT Gateway in JSON Format.</div>
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><nowiki>*ppzDataBuffer</nowiki></div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[out] {{anchor|OLELINK63}} {{anchor|OLELINK62}} {{anchor|OLELINK61}} the {{anchor|OLELINK60}} {{anchor|OLELINK59}} point to the Sensor Network Interfaces??information data with JSON format</div>
| |
− | | |
− | <nowiki>*pnLen</nowiki>
| |
− | | |
− | [out] the length of the data in ppzDataBuffer
| |
− | | |
− | | |
− | '''Return Values '''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM__OK: Get the IoTGW interface information {{anchor|OLELINK41}} {{anchor|OLELINK40}} successfully.</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM_FAILED: Failed to get IoTGW interface information.</div>
| |
− | | |
− | | |
− | {{anchor|OLELINK142}} {{anchor|OLELINK153}} {{anchor|OLELINK152}} '''Example:'''
| |
− | | |
− | '''Condition'''
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">Communication Type: <span style="background-color:#d8d8d8;">WSN</span></div>
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">Number of WSN Interface: <span style="background-color:#d8d8d8;">2</span></div>
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">Name of Interfaces: <span style="background-color:#d8d8d8;">WSN0, WSN1</span></div>
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">MAC of Interfaces: <span style="background-color:#d8d8d8;">0000852CF4B7B0E8, 0000852CF4B7B0E7</span></div>
| |
− | | |
− | | |
− | | |
− | | |
− | "IoTGW": {
| |
− | | |
− | "WSN": {
| |
− | | |
− | "WSN0": {
| |
− | | |
− | "Info": {
| |
− | | |
− | "e": [{"n":"SenHubList","sv":"","asm":"r"},
| |
− | | |
− | {"n":"Topology","sv":"","asm":"r"},{"n":"Health","v":100,"asm":"r"},
| |
− | | |
− | {"n":"Name","sv":"WSN0","asm":"r"}],
| |
− | | |
− | "bn":"Info"
| |
− | | |
− | },
| |
− | | |
− | "bn":"0000852CF4B7B0E8",
| |
− | | |
− | "ver":1
| |
− | | |
− | },
| |
− | | |
− | | |
− | "WSN1": {
| |
− | | |
− | "Info": {
| |
− | | |
− | "e": [{"n":"SenHubList","sv":"","asm":"r"},
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">{"n":"Topology","sv":"","asm":"r"},{"n":"Health","v":100,"asm":"r"},</div>
| |
− | | |
− | {"n":"Name","sv":"WSN1","asm":"r"}],
| |
− | | |
− | "bn":"Info"
| |
− | | |
− | },
| |
− | | |
− | "bn":"0000852CF4B7B0E7",
| |
− | | |
− | "ver":1
| |
− | | |
− | },
| |
− | | |
− | "bn":"WSN"
| |
− | | |
− | },
| |
− | | |
− | "ver": 1
| |
− | | |
− | }
| |
− | | |
− | | |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;">'''SNMCODE SN_Manager_ActionProc'''</span><span style="background-color:#d9d9d9;">( </span><span style="background-color:#d9d9d9;color:#0000ff;">const</span><span style="background-color:#d9d9d9;"> </span><span style="background-color:#d9d9d9;color:#0000ff;">int</span><span style="background-color:#d9d9d9;"> nCtlId, </span>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>*</nowiki></span>{{anchor|OLELINK124}} {{anchor|OLELINK123}} {{anchor|OLELINK122}} <span style="background-color:#d9d9d9;">pParam1</span><span style="background-color:#d9d9d9;">, </span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>*pParam2, </nowiki></span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>*pRev1, </nowiki></span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>*pRev2 );</nowiki></span></div>
| |
− | | |
− | '''Description'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">This function is used to set callback function or others parameters depended on nCtlId. </div>
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">nCtlId</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[in] control id. Refer to <span style="background-color:#d8d8d8;">SN_CTL_ID</span></div>
| |
− | | |
− | {{anchor|OLELINK125}} {{anchor|OLELINK126}} <nowiki>*</nowiki>{{anchor|OLELINK146}} {{anchor|OLELINK145}} pParam1
| |
− | | |
− | [in] the point to parameter 1 ( data type depend on SN_CTL_ID)
| |
− | | |
− | <nowiki>*pParam2</nowiki>
| |
− | | |
− | [in] the point to parameter 2 ( data type depend on SN_CTL_ID)
| |
− | | |
− | <nowiki>*pPev1</nowiki>
| |
− | | |
− | [in] {{anchor|OLELINK202}} {{anchor|OLELINK201}} {{anchor|OLELINK200}} {{anchor|OLELINK199}} reserved for later use. Must be ?ULL??
| |
− | <div style="margin-left:0cm;margin-right:0cm;"><nowiki>*pPev2</nowiki></div>
| |
− | | |
− | [in] reserved for later use. Must be ?ULL??
| |
− | | |
− | '''Return Values '''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM__OK: Successfully {{anchor|OLELINK137}} {{anchor|OLELINK136}} {{anchor|OLELINK135}} to call this function.</div>
| |
− | | |
− | <div style="margin-left:1.905cm;margin-right:0cm;">>0 : Failed to call this function.</div>
| |
− | | |
− | | |
− | | |
− | | |
− | | |
− | | |
− | '''Example:'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">nCtlId: <span style="background-color:#d8d8d8;">SN_Set_ReportSNManagerDataCbf</span></div>
| |
− | | |
− | <nowiki>*</nowiki>pParam1: {{anchor|OLELINK151}} {{anchor|OLELINK150}} {{anchor|OLELINK149}} <span style="background-color:#d9d9d9;">ReportSNManagerDataCbf</span>
| |
− | | |
− | | |
− | the <u>ReportSNManagerDataCbf</u> that specify the callback function to be used to notify event.
| |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;color:#0000ff;">typedef</span><span style="background-color:#d9d9d9;"> </span><span style="background-color:#d9d9d9;color:#0000ff;">int</span><span style="background-color:#d9d9d9;"> (*</span>{{anchor|OLELINK148}} {{anchor|OLELINK147}} <span style="background-color:#d9d9d9;">'''ReportSNManagerDataCbf'''</span><span style="background-color:#d9d9d9;">) ( </span><span style="background-color:#d9d9d9;color:#0000ff;">const</span><span style="background-color:#d9d9d9;"> </span><span style="background-color:#d9d9d9;color:#0000ff;">int</span><span style="background-color:#d9d9d9;"> </span>{{anchor|OLELINK44}} <span style="background-color:#d9d9d9;">nEventI</span><span style="background-color:#d9d9d9;">D, </span>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">const</span><span style="background-color:#d9d9d9;"> </span><span style="background-color:#d9d9d9;color:#0000ff;">char</span><span style="background-color:#d9d9d9;"> *pzDataBuffer, </span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">const</span><span style="background-color:#d9d9d9;"> </span><span style="background-color:#d9d9d9;color:#0000ff;">int</span><span style="background-color:#d9d9d9;"> nDataLen, </span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>**</nowiki></span>{{anchor|OLELINK87}} {{anchor|OLELINK86}} {{anchor|OLELINK85}} <span style="background-color:#d9d9d9;">ppOutParam</span><span style="background-color:#d9d9d9;">, </span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>*</nowiki></span>{{anchor|OLELINK263}} {{anchor|OLELINK262}} <span style="background-color:#d9d9d9;">pParam1</span><span style="background-color:#d9d9d9;">,</span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;"><span style="background-color:#d9d9d9;color:#0000ff;">void</span><span style="background-color:#d9d9d9;"> <nowiki>*pRev1 );</nowiki></span></div>
| |
− | | |
− | | |
− | '''Description'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">This function is used to receive events that trigger by Sensor Network Manager module. (ex: A New SenHub Connected/Disconnected/Auto Report Sensor Data/Auto Report Interface Data).</div>
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">nEventID</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[in] event id. Refer to <span style="background-color:#d9d9d9;">SN_EVENT_ID</span></div>
| |
− | | |
− | {{anchor|OLELINK82}} {{anchor|OLELINK84}} {{anchor|OLELINK83}} *{{anchor|OLELINK213}} {{anchor|OLELINK212}} {{anchor|OLELINK211}} {{anchor|OLELINK181}} {{anchor|OLELINK180}} {{anchor|OLELINK79}} {{anchor|OLELINK78}} {{anchor|OLELINK77}} pzDataBuffer
| |
− | | |
− | [in] the point to data with JSON format
| |
− | | |
− | {{anchor|OLELINK66}} {{anchor|OLELINK65}} {{anchor|OLELINK64}} nDataLen
| |
− | | |
− | {{anchor|OLELINK69}} {{anchor|OLELINK68}} {{anchor|OLELINK67}} [in] the length of the data in pzDataBuffer
| |
− | | |
− | {{anchor|OLELINK256}} {{anchor|OLELINK255}} <nowiki>**</nowiki>{{anchor|OLELINK217}} {{anchor|OLELINK216}} {{anchor|OLELINK215}} ppOutParam
| |
− | | |
− | [out] {{anchor|OLELINK257}} User can {{anchor|OLELINK260}} {{anchor|OLELINK259}} {{anchor|OLELINK258}} specify the address or context value when ?{anchor|OLELINK220}} {{anchor|OLELINK219}} {{anchor|OLELINK218}} <span style="color:#ff0000;">SN_SenHub_Register</span>??event called,
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">It would be sent back when callback function gets called with this SenHub? </div>
| |
− | | |
− | <div style="margin-left:2.54cm;margin-right:0cm;">events (SN_SenHub_SendInfoSpec, SN_SenHub_AutoReportData,</div>
| |
− | | |
− | <div style="margin-left:2.54cm;margin-right:0cm;">,SN_SenHub_Disconnect)</div>
| |
− | | |
− | {{anchor|OLELINK108}} {{anchor|OLELINK107}} <nowiki>*</nowiki>{{anchor|OLELINK261}} {{anchor|OLELINK266}} {{anchor|OLELINK265}} {{anchor|OLELINK264}} pParam1
| |
− | | |
− | [in] the point of data. The data type depends on ?N Event ID??
| |
− | | |
− | <nowiki>*pRev1</nowiki>
| |
− | | |
− | [in] reserved for later use.
| |
− | | |
− | | |
− | {{anchor|OLELINK157}} {{anchor|OLELINK159}} {{anchor|OLELINK158}} '''Return Values '''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM__OK: Process the callback event successfully.</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SNM_FAILED: Failed to process the callback event</div>
| |
− | | |
− | '''Example of Event Code:'''
| |
− | | |
− | | |
− | # <span style="background-color:#d8d8d8;">'''SN_Inf_UpdateInterface_Data:'''</span>
| |
− | | |
− | | |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;"></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">'''Condition'''</div>
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">Communication Type: <span style="background-color:#d8d8d8;">WSN</span></div>
| |
− | | |
− | <div style="margin-left:0.563cm;margin-right:0cm;">Name of Interface: <span style="background-color:#d8d8d8;">WSN0</span></div>
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">MAC of Interface: <span style="background-color:#d8d8d8;">0000852CF4B7B0E8</span></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">{{anchor|OLELINK191}} {{anchor|OLELINK190}} {{anchor|OLELINK189}} Sensor Hubs connected: <span style="background-color:#d8d8d8;">0000000EC6F0F830 ,0000000EC6F0F831</span></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">Network Health Status: <span style="background-color:#d8d8d8;">60</span></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">Neighbor: <span style="background-color:#d8d8d8;">0000000EC6F0F830</span></div>
| |
− | | |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pzDataBuffer : Update Interface Data</div>
| |
− | | |
− | "IoTGW": {
| |
− | | |
− | "WSN": {
| |
− | | |
− | "WSN0"{
| |
− | | |
− | "Info": {
| |
− | | |
− | "e": [{"n":"SenHubList","sv":"{{anchor|OLELINK188}} {{anchor|OLELINK187}} {{anchor|OLELINK186}} 0000000EC6F0F830 ,0000000EC6F0F831"},
| |
− | | |
− | {"n":"Neighbor","sv":"0000000EC6F0F830"},
| |
− | | |
− | {"n":"Health","v":60}],
| |
− | | |
− | "bn":"Info"
| |
− | | |
− | }
| |
− | | |
− | "bn":"0000852CF4B7B0E8",
| |
− | | |
− | "ver":1
| |
− | | |
− | },
| |
− | | |
− | "bn":"WSN"
| |
− | | |
− | },
| |
− | | |
− | "ver": 1
| |
− | | |
− | | |
− | <div style="color:#ff0000;"></div># <span style="background-color:#d8d8d8;">'''SN_SenHub_Register'''</span>
| |
− | | |
− | | |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;"></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">'''Condition'''</div>
| |
− | | |
− | <div style="margin-left:1.905cm;margin-right:0cm;">Sensor Hub: <span style="background-color:#d8d8d8;">0000000EC6F0F830 </span></div>
| |
− | | |
− | <div style="margin-left:1.905cm;margin-right:0cm;">Name of Sensor Hub: <span style="background-color:#d8d8d8;">Room</span></div>
| |
− | | |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pzDataBuffer </div>
| |
− | | |
− | <div style="margin-left:0.847cm;margin-right:0cm;">[in] Empty char buffer point</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">ppOutParam</div>
| |
− | | |
− | [out] the point that storage the user specify address or context value.
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pParam1</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">[in] the point of data structure. ??span style="color:#ff0000;">SenHubInfo</span>??/div>
| |
− | | |
− | | |
− | # <span style="background-color:#d8d8d8;">'''SN_SenHub_SendInfoSpec:'''</span>
| |
− | | |
− | | |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;"></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">{{anchor|OLELINK222}} {{anchor|OLELINK224}} {{anchor|OLELINK223}} '''Condition'''</div>
| |
− | | |
− | <div style="margin-left:0.423cm;margin-right:0cm;">''' '''{{anchor|OLELINK207}} {{anchor|OLELINK206}} {{anchor|OLELINK205}} {{anchor|OLELINK204}} {{anchor|OLELINK203}} Sensor Hub: <span style="background-color:#d8d8d8;">0000000EC6F0F830</span><span style="background-color:#d8d8d8;"> </span></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">Name of Sensor Hub: <span style="background-color:#d8d8d8;">Room</span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">Sensors of SenHub: <span style="background-color:#d8d8d8;">temp1, co2, digital output</span></div>
| |
− | | |
− | | |
− | pzDataBuffer : Send SenHub Information
| |
− | | |
− | {
| |
− | | |
− | "SenHub":{
| |
− | | |
− | "SenData": {
| |
− | | |
− | "e": [{"n":" temp1", "u":"Cel","v":0,"min":0,"max":100,"asm":"r","type":"d","rt":"ucum.Cel","st":"ipso","exten":""},
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">{"n":"co2","u":"ppm","v":0,"min":0,"max":100000,"asm":"r","type":"d","rt":"ucum.ppm","st":"ipso","exten":""},</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">{"n":"digital output", "u":"","bv":0,"asm":"rw","type":"b","rt":"gpio.dout","st":"ipso","exten":""}], </div>
| |
− | | |
− | "bn":"SenData"
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">},</div>
| |
− | | |
− | "Info": {
| |
− | | |
− | "e": [ {"n":"Name","sv":"{{anchor|OLELINK210}} {{anchor|OLELINK209}} {{anchor|OLELINK208}} Room","asm":"rw"},
| |
− | | |
− | {"n":"sw","sv":"1.0.0.2","asm":"r"},
| |
− | | |
− | {"n":"reset","bv":0,"asm":"rw"}],
| |
− | | |
− | "bn":"Info"
| |
− | | |
− | },
| |
− | | |
− | ?et??{
| |
− | | |
− | "e": [ {"n":"Neighbor","sv":"0000000EC6F0F831","asm":"r"},
| |
− | | |
− | {"n":"Health","v":88,"asm":"r"},
| |
− | | |
− | {"n":"sw","sv":??.0.0.1??"asm":"r"}],
| |
− | | |
− | "bn":"Net"
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">},</div>
| |
− | | |
− | "ver": 1
| |
− | | |
− | }
| |
− | | |
− | }
| |
− | | |
− | {{anchor|OLELINK228}} {{anchor|OLELINK229}} ppOutParam:
| |
− | | |
− | [in] the point of address or context value that pass by user at <span style="color:#ff0000;">SN_SenHub_Register </span>event<span style="color:#ff0000;">.</span>
| |
− | | |
− | | |
− | # <span style="background-color:#d8d8d8;">'''SN_SenHub_AutoReportData'''</span>
| |
− | | |
− | | |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">{{anchor|OLELINK235}} {{anchor|OLELINK237}} {{anchor|OLELINK236}} </div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">'''Condition'''</div>
| |
− | | |
− | <div style="margin-left:1.905cm;margin-right:0cm;">Sensor Hub: <span style="background-color:#d8d8d8;">0000000EC6F0F830</span><span style="background-color:#d8d8d8;"> </span></div>
| |
− | | |
− | <div style="margin-left:1.905cm;margin-right:0cm;">Name of Sensor Hub: <span style="background-color:#d8d8d8;">Room</span></div>
| |
− | | |
− | <div style="margin-left:1.905cm;margin-right:0cm;">{{anchor|OLELINK225}} {{anchor|OLELINK227}} {{anchor|OLELINK226}} Sensors of SenHub: <span style="background-color:#d8d8d8;">temp1 (v:17), co2(v:1001), digital output(bv:0)</span></div>
| |
− | | |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pzDataBuffer : Update SenHub Data</div>
| |
− | | |
− | {
| |
− | | |
− | "SenHub":{
| |
− | | |
− | "SenData": {
| |
− | | |
− | "e": [{"n":"temp1","v":17},
| |
− | | |
− | {"n":"co2", "v":1001},
| |
− | | |
− | {"n":"digital output", "bv":0}],
| |
− | | |
− | "bn":"SenData",
| |
− | | |
− | "ver":1
| |
− | | |
− | },
| |
− | | |
− | "Info": {
| |
− | | |
− | "e": [{"n":"Health","v":100,"asm":"r"},
| |
− | | |
− | {"n":"Name","sv":"Room","asm":"rw"},
| |
− | | |
− | {"n":"IoTGW","sv":"0000852CF4B7B0E8","asm":"r"}],
| |
− | | |
− | "bn":"Info"
| |
− | | |
− | },
| |
− | | |
− | "ver": 1
| |
− | | |
− | }
| |
− | | |
− | }
| |
− | | |
− | | |
− | ppOutParam:
| |
− | | |
− | [in] the point of address or context value that pass by user at <span style="color:#ff0000;">SN_SenHub_Register </span>event<span style="color:#ff0000;">.</span>
| |
− | | |
− | | |
− | <div style="margin-left:0.847cm;margin-right:0cm;"></div># <span style="background-color:#d8d8d8;">'''SN_SenHub_Disconnect'''</span>
| |
− | | |
− | | |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;"></div>
| |
− | | |
− | <div style="margin-left:1.482cm;margin-right:0cm;">Condition</div>
| |
− | | |
− | <div style="margin-left:2.328cm;margin-right:0cm;">Sensor Hub: <span style="background-color:#d8d8d8;">0000000EC6F0F830</span></div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pzDataBuffer : {{anchor|OLELINK252}} {{anchor|OLELINK251}} {{anchor|OLELINK250}} Empty char buffer point</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">ppOutParam:</div>
| |
− | | |
− | [in] the point of address or context value that pass by user at <span style="color:#ff0000;">SN_SenHub_Register </span>event<span style="color:#ff0000;">.</span>
| |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;">'''char* SN_Manager_GetData(const char *pszInURI, const ACTION_MODE mode);'''</span>
| |
− | | |
− | | |
− | '''Description'''
| |
− | | |
− | This function is used to get values of resource of sensor network manager
| |
− | | |
− | ( ex: network interface, sensor hub, or sensor ).
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pszInURI</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[in] uri path of resource. </div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;"> Example:</div>
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">SenHub: SenHub? UID/bn/bn/n or SenHub? UUID/bn/bn</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;"> Interface: bn/bn/Interface? MAC/bn/n</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">mode</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[in] mode of getting ( cache or direct mode)</div>
| |
− | | |
− | | |
− | '''Return Values '''
| |
− | | |
− | {?tatusCode??200, ?esult??{JSON Object}}
| |
− | | |
− | | |
− | StatusCode : Please refer [Appendix C] for status code.
| |
− | | |
− | Result : Result of getting in JSON format
| |
− | | |
− | | |
− | '''Example:'''
| |
− | | |
− | Get the SenHub (0000000EC6F0F830)? temp1 value
| |
− | | |
− | pzInURI: 0000000EC6F0F830/SenHub/SenData/temp1 mode: cache
| |
− | | |
− | '''Result:'''
| |
− | | |
− | {?tatusCode??200, ?esult?? {"n":"temp1","v":17}}
| |
− | | |
− | | |
− | '''Syntax'''
| |
− | | |
− | <span style="background-color:#d9d9d9;">'''char* SN_Manager_SetData(const char *pszInURI, const char *pszValue );'''</span>
| |
− | | |
− | | |
− | '''Description'''
| |
− | | |
− | This function is used to get value of resource of sensor network manager in asynchronous.
| |
− | | |
− | ( ex: network interface, sensor hub, or sensor ). This function would check the set resource and value is correct and settable. If all parameters are correct and returns accept this request immediately. Then it will set value to resource and return the result in asynchronous.
| |
− | | |
− | | |
− | '''Parameters'''
| |
− | | |
− | <div style="margin-left:0cm;margin-right:0cm;">pszInURI</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[in] path of resource. (Note: Need to specify to ???resource not ?n??)</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">pszValue</div>
| |
− | | |
− | <div style="margin-left:1.69cm;margin-right:0cm;">[in] the set value in JSON format</div>
| |
− | | |
− | | |
− | '''Return Values '''
| |
− | | |
− | {?tatusCode??200, ?esult??{JSON Object}}
| |
− | | |
− | | |
− | StatusCode : Please refer [Appendix C] for status code.
| |
− | | |
− | Result : Result of setting in JSON format
| |
− | | |
− | | |
− | | |
− | | |
− | '''2.5 Application Sample Code'''
| |
− | | |
− | Please refer to the distribution package for the sample code.
| |
| | | |
| =Appendix= | | =Appendix= |
This document defines these Advantech Sensor Network Manager APIs and Sensor Data Format for using in Advantech wireless sensor network device.
This document describes how to use the Advantech Sensor Network Manager (Adv SNM) module to get/set IoT sensor network information, data, or status for your sensor device.
It includes get IoT gateway interface capability, get/set sensor hub information / sensor data, auto register / deregister sensor network hub, and auto report sensor data.
The IPSO Application Framework makes use of IETF standards as building blocks for a simple and efficient RESTful design model for IP smart objects. The framework may be used over either HTTP or CoAP web transfer protocols.
HTTP, REST, XML, JSON, COAP and other key components of web technology are powerful mechanisms in an Internet of Things application.
IPSO Smart Object[2] Guidelines provide a common design pattern, an object model, that can effectively use the IETF CoAP protocol to provide high level interoperability between Smart Object devices and connected software applications on other devices and services
The common object model is based on the Lightweight M2M (LWM2M 1.0) specification from the Open Mobile Alliance. OMA LWM2M is a device management and service architecture specification based on IETF CoAP, and provides a simple and flexible object template (object model) for constrained device management.
The object model from OMA LWM2M is reused to define application level IPSO Smart Objects. This enables the OMA Name Authority (OMNA) to be used to register new objects, and enables existing LWM2M compliant device libraries and server software to be used as an infrastructure for IPSO Smart Objects