From 3c696793619750511f660d2b0ff8b303cb9fd081 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 27 十月 2020 15:21:54 +0800
Subject: [PATCH] 2020-10-27 1.修改音乐协议

---
 hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java |   42 +++++++++++++++++++++++++++++-------------
 1 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
index 61ee5a6..a2a9f11 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
@@ -36,6 +36,7 @@
 import com.hdl.sdk.hdl_core.Util.NetUtil.NetWorkUtil;
 import com.hdl.sdk.hdl_core.Util.SPUtil.SPUtils;
 import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis;
+import com.hdl.sdk.hdl_core.Util.TransformUtil.StringUtil;
 
 import org.greenrobot.eventbus.EventBus;
 
@@ -843,53 +844,65 @@
     public static void audioCtrl(AppliancesInfo info, int type) {
         byte[] musicBytes;
         int command;
+        int sourceId = info.getIntCurState();
         switch (type) {
             case HDLAudio.SET_AUDIO_PLAYSTOP:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x4C, 0x41, 0x59, 0x53, 0x54, 0x4F, 0x50, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x4C, 0x41, 0x59, 0x53, 0x54, 0x4F, 0x50, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "PLAYSTOP");
                 break;
             case HDLAudio.SET_AUDIO_PLAYPAUSE:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{42, 83, 49, 80, 76, 65, 89, 80, 65, 85, 83, 69, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x4C, 0x41, 0x59, 0x50, 0x41, 0x55, 0x53, 0x45, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "PLAYPAUSE");
                 break;
             case HDLAudio.SET_NEXT_SONG:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4E, 0x45, 0x58, 0x54, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4E, 0x45, 0x58, 0x54, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "NEXT");
                 break;
             case HDLAudio.SET_PRE_SONG:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x52, 0x45, 0x56, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x52, 0x45, 0x56, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "PREV");
                 break;
             case HDLAudio.GET_AUDIO_MODE:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x4C, 0x41, 0x59, 0x4D, 0x4F, 0x44, 0x45, 0x3F, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x4C, 0x41, 0x59, 0x4D, 0x4F, 0x44, 0x45, 0x3F, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "PLAYMODE?");
                 break;
             case HDLAudio.SET_AUDIO_MODE_UP:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4D, 0x4F, 0x44, 0x45, 0x2B, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4D, 0x4F, 0x44, 0x45, 0x2B, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "MODE+");
                 break;
             case HDLAudio.SET_AUDIO_MODE_DOWN:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4D, 0x4F, 0x44, 0x45, 0x2D, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4D, 0x4F, 0x44, 0x45, 0x2D, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "MODE-");
                 break;
             case HDLAudio.GET_AUDIO_CURRRENT_INFO:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
                 //*Z1STAUS?褰掍负閿�
-                musicBytes = new byte[]{0x2A, 0x5A, 0x31, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x3F, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x5A, 0x31, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x3F, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "STATUS?");
                 break;
             case HDLAudio.SET_PRE_LIST:
                 HDLAudio.isSetPreNextList = true;
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x52, 0x45, 0x56, 0x4C, 0x49, 0x53, 0x54, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x50, 0x52, 0x45, 0x56, 0x4C, 0x49, 0x53, 0x54, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "PREVLIST");
                 break;
             case HDLAudio.SET_NEXT_LIST:
                 HDLAudio.isSetPreNextList = true;
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4E, 0x45, 0x58, 0x54, 0x4C, 0x49, 0x53, 0x54, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x53, 0x31, 0x4E, 0x45, 0x58, 0x54, 0x4C, 0x49, 0x53, 0x54, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*S" +sourceId + "NEXTLIST");
                 break;
             case HDLAudio.TEXT:
                 command = Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND;
-                musicBytes = new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x4C, 0x49, 0x53, 0x54, 0x30, 0x30, 0x31, 0x30, 0x30, 0x32, 0x31, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x4C, 0x49, 0x53, 0x54, 0x30, 0x30, 0x31, 0x30, 0x30, 0x32, 0x31, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*Z01" +sourceId + "LIST0010021");
                 break;
             default:
                 command = 0;
@@ -920,6 +933,7 @@
     public static void audioCtrl(AppliancesInfo info, int type, int value) {
         byte[] musicBytes;
         int command;
+        int sourceId = info.getIntCurState();
         switch (type) {
             case HDLAudio.GET_AUDIO_LIST:
                 HDLAudio.numStr.clear();
@@ -927,7 +941,8 @@
                 HDLAudio.curListNum = value;
                 command = Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND;
                 //*Z011TYPE0011褰掍綅閿�
-                musicBytes = new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x54, 0x59, 0x50, 0x45, 0x30, 0x30, 0x31, 0x31, 0x0D};
+//                musicBytes = new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x54, 0x59, 0x50, 0x45, 0x30, 0x30, 0x31, 0x31, 0x0D};
+                musicBytes =  StringUtil.GetMusicBytes("*Z01" + sourceId + "TYPE0011");
                 break;
             case HDLAudio.SET_AUDIO_VOL:
                 command = Configuration.AUDIO_CTRL_READ_COMMAND;
@@ -960,11 +975,12 @@
     public static void audioCtrl(AppliancesInfo info, int type, int listId, int songId) {
         byte[] musicBytes;
         int command;
+        int sourceId = info.getIntCurState();
         switch (type) {
 
             case HDLAudio.SET_CHOOSE_PLAY_SONG:
                 command = Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND;
-                musicBytes = HDLAudio.audioChooseSongParse(listId, songId);
+                musicBytes = HDLAudio.audioChooseSongParse(listId, songId, sourceId);
                 break;
             default:
                 command = 0;

--
Gitblit v1.8.0