|
| 1 | +# coding=utf8 |
| 2 | + |
| 3 | +# Copyright 2018 JDCLOUD.COM |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | +# NOTE: This class is auto generated by the jdcloud code generator program. |
| 18 | + |
| 19 | +from jdcloud_sdk.core.jdcloudrequest import JDCloudRequest |
| 20 | + |
| 21 | + |
| 22 | +class CollectorWriteMessageRequest(JDCloudRequest): |
| 23 | + """ |
| 24 | + 写入采集器数据 |
| 25 | + """ |
| 26 | + |
| 27 | + def __init__(self, parameters, header=None, version="v2"): |
| 28 | + super(CollectorWriteMessageRequest, self).__init__( |
| 29 | + '/regions/{regionId}/loongrayinstances/{instanceId}/writeCollectorProperty', 'POST', header, version) |
| 30 | + self.parameters = parameters |
| 31 | + |
| 32 | + |
| 33 | +class CollectorWriteMessageParameters(object): |
| 34 | + |
| 35 | + def __init__(self, instanceId, regionId, identifier, data): |
| 36 | + """ |
| 37 | + :param instanceId: Hub实例Id |
| 38 | + :param regionId: 区域Id |
| 39 | + :param identifier: 当前的链接码 |
| 40 | + :param data: 当前待写入的数据 |
| 41 | +如指定播放设备,寄存地址:13对应16进制0x0D,寄存器值:2 |
| 42 | +{ |
| 43 | + "13":2 |
| 44 | +} |
| 45 | +如播放控制,寄存地址:14对应16进制0x0E,寄存器值:1 |
| 46 | +{ |
| 47 | + "14": 1 |
| 48 | +} |
| 49 | +如音量设置,寄存地址:15对应16进制0x0F,寄存器值:10,取值范围0~30 |
| 50 | +{ |
| 51 | + "15": 10 |
| 52 | +} |
| 53 | +如指定文件夹和文件播放,寄存地址:16对应16进制0x10,寄存器值:1 |
| 54 | +寄存器值为两字节,第一个字节为文件夹,第二个字节为文件名 |
| 55 | +如0x01文件夹,0x03文件名,0x0103换算为10进制为259 |
| 56 | +{ |
| 57 | + "16": 259 |
| 58 | +} |
| 59 | +如组合播放,寄存器地址:17、18和19,寄存器值:257、258和259,寄存器值的算法和指定文件夹和文件播放是一致的,如259可换算为0x01文件夹,0x03文件名 |
| 60 | +{ |
| 61 | + "17": 257, |
| 62 | + "18": 258, |
| 63 | + "19": 259 |
| 64 | +} |
| 65 | +如播放广告,寄存地址:32对应16进制0x20,寄存器值:259,寄存器值的算法和指定文件夹和文件播放是一致的,如259可换算为0x01文件夹,0x03文件名 |
| 66 | +{ |
| 67 | + "32": 259 |
| 68 | +} |
| 69 | +如指定文件夹循环播放,寄存地址:33对应16进制0x21,寄存器值:256,寄存器值的算法,如256可换算为0x0100文件夹 |
| 70 | +{ |
| 71 | + "33": 256 |
| 72 | +} |
| 73 | +如指定文件夹随机播放,寄存地址:34对应16进制0x22,寄存器值:256,寄存器值的算法,如256可换算为0x0100文件夹 |
| 74 | +{ |
| 75 | + "34": 256 |
| 76 | +} |
| 77 | +如指定曲目播放,寄存地址:35对应16进制0x23,寄存器值:13,歌曲选择范围为0~3000 |
| 78 | +{ |
| 79 | + "35": 13 |
| 80 | +} |
| 81 | +
|
| 82 | + """ |
| 83 | + |
| 84 | + self.instanceId = instanceId |
| 85 | + self.regionId = regionId |
| 86 | + self.identifier = identifier |
| 87 | + self.protocol = None |
| 88 | + self.data = data |
| 89 | + |
| 90 | + def setProtocol(self, protocol): |
| 91 | + """ |
| 92 | + :param protocol: (Optional) 当前的协议类型,非必填项 |
| 93 | +
|
| 94 | + """ |
| 95 | + self.protocol = protocol |
| 96 | + |
0 commit comments