@cpzxrobot/sdk 1.2.42 → 1.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/device_gateway.ts +27 -0
- package/device_type_gateway.ts +1 -0
- package/device_types/readme.md +12 -0
- package/dist/device_gateway.js +24 -0
- package/package.json +1 -1
package/device_gateway.ts
CHANGED
|
@@ -344,6 +344,20 @@ export class DeviceGateway extends Object {
|
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
// 设备生产商 GET /api/v2/device/manufacturers
|
|
348
|
+
manufacturers(): Promise<any> {
|
|
349
|
+
return this.context.ready.then(() => {
|
|
350
|
+
return this.context.axios.get("/api/v2/device/manufacturers")
|
|
351
|
+
.then((res) => {
|
|
352
|
+
if (res.data.code != 200) {
|
|
353
|
+
throw res.data.message;
|
|
354
|
+
}
|
|
355
|
+
return res.data;
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
347
361
|
get ctrl() {
|
|
348
362
|
return {
|
|
349
363
|
// 获取设备控制参数
|
|
@@ -370,6 +384,19 @@ export class DeviceGateway extends Object {
|
|
|
370
384
|
return res.data;
|
|
371
385
|
});
|
|
372
386
|
});
|
|
387
|
+
},
|
|
388
|
+
|
|
389
|
+
//GET /api/v2/device/ctrl/{id}/{paramType}/configs
|
|
390
|
+
configs: (deviceId: number, type: string): Promise<any> => {
|
|
391
|
+
return this.context.ready.then(() => {
|
|
392
|
+
return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/configs`)
|
|
393
|
+
.then((res) => {
|
|
394
|
+
if (res.data.code != 200) {
|
|
395
|
+
throw res.data.message;
|
|
396
|
+
}
|
|
397
|
+
return res.data;
|
|
398
|
+
});
|
|
399
|
+
});
|
|
373
400
|
}
|
|
374
401
|
};
|
|
375
402
|
}
|
package/device_type_gateway.ts
CHANGED
package/device_types/readme.md
CHANGED
package/dist/device_gateway.js
CHANGED
|
@@ -252,6 +252,18 @@ class DeviceGateway extends Object {
|
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
+
// 设备生产商 GET /api/v2/device/manufacturers
|
|
256
|
+
manufacturers() {
|
|
257
|
+
return this.context.ready.then(() => {
|
|
258
|
+
return this.context.axios.get("/api/v2/device/manufacturers")
|
|
259
|
+
.then((res) => {
|
|
260
|
+
if (res.data.code != 200) {
|
|
261
|
+
throw res.data.message;
|
|
262
|
+
}
|
|
263
|
+
return res.data;
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}
|
|
255
267
|
get ctrl() {
|
|
256
268
|
return {
|
|
257
269
|
// 获取设备控制参数
|
|
@@ -277,6 +289,18 @@ class DeviceGateway extends Object {
|
|
|
277
289
|
return res.data;
|
|
278
290
|
});
|
|
279
291
|
});
|
|
292
|
+
},
|
|
293
|
+
//GET /api/v2/device/ctrl/{id}/{paramType}/configs
|
|
294
|
+
configs: (deviceId, type) => {
|
|
295
|
+
return this.context.ready.then(() => {
|
|
296
|
+
return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/configs`)
|
|
297
|
+
.then((res) => {
|
|
298
|
+
if (res.data.code != 200) {
|
|
299
|
+
throw res.data.message;
|
|
300
|
+
}
|
|
301
|
+
return res.data;
|
|
302
|
+
});
|
|
303
|
+
});
|
|
280
304
|
}
|
|
281
305
|
};
|
|
282
306
|
}
|