本文用Postman工具演示通过REST控制Cnario Playr
注意:Player的REST通信默认关闭,使用前需要从Setting>>Remote devices打开Use REST:
命令类型:
1. 获取设备列表:(命令方式 GET )
URL格式:
http://{IP}:8080/cnario/REST/GetDeviceList
示例URL:
http://192.168.1.187:8080/cnario/REST/GetDeviceList
返回值:
{ "GetDeviceListResult": { "Devices": [ "CanvasController", "CanvasControllerDeviceMSI", "LogicalNames", "Realtek Digital Output (Realtek", "SAMSUNG-0 (NVIDIA High Definiti", "SAMSUNG-4 (NVIDIA High Definiti", "SAMSUNG-8 (NVIDIA High Definiti", "SchedulerDevice", "SneakerNetDevice", "SparesManager", "SurfaceDevice_Surface:MSI", "SystemDevice", "Welcome" ], "ServiceStatus": "Success" } }
2. 获取设备Pin列表:(命令方式 GET )
URL格式:
http://{IP}:8080/cnario/REST/GetDevice?devicename={deviceName}
示例URL:
http://192.168.1.187:8080/cnario/REST/GetDevice?devicename=SystemDevice
返回值:(部分)
{ "GetDeviceResult": { "Device": { "DeviceName": "SystemDevice", "DevicePins": [ { "Description": "Total Available Ram", "MajorGrouping": "System Information", "MinorGrouping": "General Information", "PinName": "Total Physical Memory", "PinType": "Info", "PinValue": [ "17104302080" ], "SetDefinition": [], "ValidValueRange": null, "ValueType": "vtDecimal" }, { "Description": "Date", "MajorGrouping": "System Information", "MinorGrouping": "General Information", "PinName": "Date", "PinType": "Info", "PinValue": [ "22/9/2018" ], "SetDefinition": [], "ValidValueRange": null, "ValueType": "vtString" }, { "Description": "Time", "MajorGrouping": "System Information", "MinorGrouping": "General Information", "PinName": "Time", "PinType": "Info", "PinValue": [ "16:38:58" ], "SetDefinition": [], "ValidValueRange": null, "ValueType": "vtString" }, ... ... ] }, "ServiceStatus": "Success" } }
3. 获取设备Pin值:(命令方式 GET )
URL格式:
http://{IP}:8080//Cnario/REST/GetPinValue?deviceName={deviceName}&pinName={pinName}
示例URL:
http://192.168.1.187:8080/cnario/REST/GetPinValue?deviceName=SystemDevice&pinName=Time
返回值:
{ "GetPinValueResult": { "PinValue": [ "16:47:37" ], "ServiceStatus": "Success" } }
4. Pin赋值:(命令方式 GET )
URL格式:
http://{IP}:8080//Cnario/REST/SetPin?deviceName={deviceName}&pinName={pinName}&pinValue={pinValue}
示例URL:
http://192.168.1.187:8080/cnario/REST/SetPin?deviceName=CanvasControllerDeviceMSI&pinName=Operation&pinValue=Stop
返回值:
{ "SetPinResult": { "ServiceStatus": "Success" } }
5. 同时为多个Pin赋值:(命令方式 GET )
URL格式:
http://{IP}:8080//Cnario/REST/SetPins{"setPinsParams":[{"DeviceName":<name of the device>,"PinName":<Name of the pin>,"PinValue":<the new value>},{…},{…}]}