REST命令控制Player

本文介绍如何使用Postman工具通过REST API控制CnarioPlayr,涵盖设备列表获取、设备Pin列表及Pin值获取,以及Pin值设置的方法。详细展示了URL格式与返回值样例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文用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>},{…},{…}]}

转载于:https://www.cnblogs.com/ycdchina/p/9767673.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值