灯光命令
<p>[TOC]</p>
<table>
<thead>
<tr>
<th>4G喇叭</th>
<th>4G开关</th>
<th>WiFi喇叭</th>
<th>WiFi开关</th>
</tr>
</thead>
<tbody>
<tr>
<td><font color="green"><strong>&radic;</strong></font></td>
<td><font color="red"><strong>&times;</strong></font></td>
<td><font color="green"><strong>&radic;</strong></font></td>
<td><font color="red"><strong>&times;</strong></font></td>
</tr>
</tbody>
</table>
<p>支持此功能的设备类型:<font color="green"><strong>&radic;</strong></font>-支持 <font color="red"><strong>&times;</strong></font>-不支持</p>
<h2>设置LED灯光(setLed)</h2>
<p><strong>简要描述</strong>
设置LED灯光。</p>
<p><strong>命令参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必须</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>是</td>
<td>string</td>
<td>setLed</td>
</tr>
<tr>
<td>colors</td>
<td>是</td>
<td>array</td>
<td>8个led灯的颜色(RGB)数组,支持值类型:"#FF0000";"0xFF0000";16711680</td>
</tr>
<tr>
<td>frameId</td>
<td>否</td>
<td>string</td>
<td>帧ID</td>
</tr>
</tbody>
</table>
<ul>
<li><code>colors</code>例子
<pre><code>&quot;colors&quot;: [&quot;#FF0000&quot;,&quot;#00FF00&quot;,&quot;#0000FF&quot;,&quot;#000000&quot;,&quot;#FFFFFF&quot;,&quot;#FFFF00&quot;,&quot;#00FFFF&quot;,&quot;#FF00FF&quot;]
或
&quot;colors&quot;:[&quot;0xFF0000&quot;,&quot;0x00FF00&quot;,&quot;0x0000FF&quot;,&quot;0x000000&quot;,&quot;0xFFFFFF&quot;,&quot;0xFFFF00&quot;,&quot;0x00FFFF&quot;,&quot;0xFF00FF&quot;]
或
&quot;colors&quot;: [16711680,65280,256,0,16777215,16776960,65535,16711935]</code></pre></li>
</ul>
<p><strong>命令示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setLed&quot;,
&quot;colors&quot;: [&quot;#FF0000&quot;,&quot;#00FF00&quot;,&quot;#0000FF&quot;,&quot;#000000&quot;,&quot;#FFFFFF&quot;,&quot;#FFFF00&quot;,&quot;#00FFFF&quot;,&quot;#FF00FF&quot;]
}</code></pre>
<p><strong>应答参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>string</td>
<td>setLed</td>
</tr>
<tr>
<td>result</td>
<td>string</td>
<td>返回结果。ok-成功;其他-具体失败原因</td>
</tr>
<tr>
<td>imei</td>
<td>string</td>
<td>设备imei</td>
</tr>
<tr>
<td>frameId</td>
<td>string</td>
<td>同命令frameId</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
<td>秒级时间戳,WiFi款不支持</td>
</tr>
</tbody>
</table>
<p><strong>应答示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setLed&quot;,
&quot;result&quot;: &quot;ok&quot;,
&quot;imei&quot;: &quot;1745396239780&quot;,
&quot;frameId&quot;: &quot;1745396239780&quot;,
&quot;timestamp&quot;: 1745396759
}</code></pre>
<p><strong>备注</strong>
无</p>
<h2>设置幻彩灯光情景模式(setLedMode1)</h2>
<p><strong>简要描述</strong>
设置LED灯光情景模式,可实现流光幻彩效果设置。</p>
<p><strong>命令参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必须</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>是</td>
<td>string</td>
<td>setLedMode1</td>
</tr>
<tr>
<td>colors</td>
<td>是</td>
<td>array</td>
<td>8个led灯的颜色(RGB)数组,支持值类型:"#FF0000";"0xFF0000";16711680</td>
</tr>
<tr>
<td>hasClockwise</td>
<td>否</td>
<td>bool</td>
<td>旋转方向,true-顺时针;false-逆时针</td>
</tr>
<tr>
<td>speed</td>
<td>否</td>
<td>int</td>
<td>速度,1-10</td>
</tr>
<tr>
<td>frameId</td>
<td>否</td>
<td>string</td>
<td>帧ID</td>
</tr>
</tbody>
</table>
<p><strong>命令示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setLedMode1&quot;,
&quot;colors&quot;: [&quot;#FF0000&quot;,&quot;#00FF00&quot;,&quot;#0000FF&quot;,&quot;#000000&quot;,&quot;#FFFFFF&quot;,&quot;#FFFF00&quot;,&quot;#00FFFF&quot;,&quot;#FF00FF&quot;],
&quot;hasClockwise&quot;:false,
&quot;speed&quot;:5
}</code></pre>
<p><strong>应答参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>string</td>
<td>setLedMode1</td>
</tr>
<tr>
<td>result</td>
<td>string</td>
<td>返回结果。ok-成功;其他-具体失败原因</td>
</tr>
<tr>
<td>imei</td>
<td>string</td>
<td>设备imei</td>
</tr>
<tr>
<td>frameId</td>
<td>string</td>
<td>同命令frameId</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
<td>秒级时间戳,WiFi款不支持</td>
</tr>
</tbody>
</table>
<p><strong>应答示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setLedMode1&quot;,
&quot;result&quot;: &quot;ok&quot;,
&quot;imei&quot;: &quot;1745396239780&quot;,
&quot;frameId&quot;: &quot;1745396239780&quot;,
&quot;timestamp&quot;: 1745396759
}</code></pre>
<p><strong>备注</strong>
无</p>
<h2>设置灯光闪烁模式(setLedMode2)</h2>
<p><strong>简要描述</strong>
设置灯光闪烁模式。</p>
<p><strong>命令参数</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>必须</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>是</td>
<td>string</td>
<td>setLedMode2</td>
</tr>
<tr>
<td>colors</td>
<td>是</td>
<td>array</td>
<td>8个led灯的颜色(RGB)数组,支持值类型:"#FF0000";"0xFF0000";16711680</td>
</tr>
<tr>
<td>onMs</td>
<td>是</td>
<td>int</td>
<td>亮毫秒数</td>
</tr>
<tr>
<td>offMs</td>
<td>是</td>
<td>int</td>
<td>灭毫秒数</td>
</tr>
<tr>
<td>durationMs</td>
<td>是</td>
<td>int</td>
<td>持续毫秒数,0-表示一直持续闪烁</td>
</tr>
<tr>
<td>frameId</td>
<td>否</td>
<td>string</td>
<td>帧ID</td>
</tr>
</tbody>
</table>
<p><strong>命令示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setLedMode2&quot;,
&quot;colors&quot;: [&quot;#FF0000&quot;,&quot;#00FF00&quot;,&quot;#0000FF&quot;,&quot;#000000&quot;,&quot;#FFFFFF&quot;,&quot;#FFFF00&quot;,&quot;#00FFFF&quot;,&quot;#FF00FF&quot;],
&quot;onMs&quot;: 100,
&quot;offMs&quot;: 300,
&quot;durationMs&quot;: 5000,
&quot;frameId&quot;: &quot;1745396239780&quot;
}</code></pre>
<p><strong>应答参数说明</strong></p>
<table>
<thead>
<tr>
<th>参数名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>method</td>
<td>string</td>
<td>setLedMode2</td>
</tr>
<tr>
<td>result</td>
<td>string</td>
<td>返回结果。ok-成功;其他-具体失败原因</td>
</tr>
<tr>
<td>imei</td>
<td>string</td>
<td>设备imei</td>
</tr>
<tr>
<td>frameId</td>
<td>string</td>
<td>同命令frameId</td>
</tr>
<tr>
<td>timestamp</td>
<td>int</td>
<td>秒级时间戳,WiFi款不支持</td>
</tr>
</tbody>
</table>
<p><strong>应答示例</strong></p>
<pre><code>{
&quot;method&quot;: &quot;setLedMode2&quot;,
&quot;result&quot;: &quot;ok&quot;,
&quot;imei&quot;: &quot;1745396239780&quot;,
&quot;frameId&quot;: &quot;1745396239780&quot;,
&quot;timestamp&quot;: 1745396759
}</code></pre>
<p><strong>备注</strong>
无</p>