标签:sde ice test ldd das img 无法 obj auth
https://cumulocity.com/guides/device-sdk/rest/#overview
启动阶段将设备连接到Cumulocity IoT,并更新清单中的设备数据。它还执行操作所需的清理任务。它包括以下步骤:
循环阶段如下。它会不断更新清单,写入测量值,警报和事件并根据需要执行操作。可以将其视为设备关闭之前执行的设备“主循环”。该循环包括以下步骤:
使用BasicAuth,输入用户名和密码。
POST:https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects
Content-Type:application/vnd.com.nsn.cumulocity.managedObject+json
Accept:application/vnd.com.nsn.cumulocity.managedObject+json
Request Body:
{ "c8y_IsDevice" : {}, "name" : "RestDevice0408" }
Response Body:
{ "owner": "{username}", "additionParents": { "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802/additionParents", "references": [] }, "childDevices": { "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802/childDevices", "references": [] }, "childAssets": { "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802/childAssets", "references": [] }, "creationTime": "2020-04-08T15:15:57.302+08:00", "lastUpdated": "2020-04-08T15:15:57.302+08:00", "childAdditions": { "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802/childAdditions", "references": [] }, "name": "RestDevice0408", "assetParents": { "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802/assetParents", "references": [] }, "deviceParents": { "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802/deviceParents", "references": [] }, "self": "https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802", "id": "21802", "c8y_IsDevice": {} }
Postman截图
创建新设备后,现在可以按照步骤1中所述将其与内置标识符相关联。这确保了该设备在下一次启动后就可以在Cumulocity IoT中找到自己。
如果不进行设备注册,后面也无法通过c8y_Serial获取设备。
POST:https://{tenant}.mciotextension.cn1.mindsphere-in.cn/identity/globalIds/21802/externalIds
Content-Type:application/vnd.com.nsn.cumulocity.externalId+json
Accept:application/vnd.com.nsn.cumulocity.externalId+json
Request Body:
{ "type" : "c8y_Serial", "externalId" : "serial202004081525" }
PUT:https://{tenant}.mciotextension.cn1.mindsphere-in.cn/inventory/managedObjects/21802
Content-Type:application/vnd.com.nsn.cumulocity.managedObject+json
Request Body:
{ "c8y_Software": { "pi-driver": "pi-driver-3.4.6.jar", "pi4j-gpio-extension": "pi4j-gpio-extension-0.0.5.jar" } }
Postman截图:
POST:https://{tenant}.mciotextension.cn1.mindsphere-in.cn/measurement/measurements
Content-Type:application/vnd.com.nsn.cumulocity.measurement+json
Request Body:
{ "source": { "id": "21802" }, "time": "2020-04-08T15:52:40.152", "type": "mytype", "MyMeasurement": { "AR_TEST_VAR1": { "value": 15, "unit": "dBm" }, "AR_TEST_VAR2": { "value": 25, "unit": "%" }, "AR_TEST_VAR3": { "value": 30, "unit": "。" } } }
Postman截图:
--END--
使用Rest连接MindSphere IoT Extention
标签:sde ice test ldd das img 无法 obj auth
原文地址:https://www.cnblogs.com/quchunhui/p/12626796.html