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.修改音乐协议
---
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java | 8 ++
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java | 10 +++
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java | 42 +++++++++----
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLAudio/HDLAudio.java | 67 +++++++++++++---------
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AudioActivity.java | 17 +++++
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java | 1
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java | 6 ++
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java | 19 ++++++
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java | 3
9 files changed, 129 insertions(+), 44 deletions(-)
diff --git a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AudioActivity.java b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AudioActivity.java
index a5428a8..ff0d885 100644
--- a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AudioActivity.java
+++ b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/AudioActivity.java
@@ -22,6 +22,18 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * 闊虫簮璇存槑锛�
+ * 1------------------------SD-CARD
+ * 2------------------------NAS-HDD
+ * 3------------------------SERVER //鏆傛湭鐢�
+ * 4------------------------WEB-RADIO //鏆傛湭鐢�
+ * 5------------------------RADIO
+ * 6------------------------AUDIO-IN
+ * 7------------------------INTERCOM //鏆傛湭鐢�
+ * 8------------------------ BLUETOOTH
+ * 9------------------------ S/PDIF //AUDIO_IN2
+ */
public class AudioActivity extends AppCompatActivity {
private Button getCurSongInfoBtn, playPauseBtn, playStopBtn, preSongBtn, nextSongBtn, volMinBtn, volMidBtn, volMaxBtn, modeBtn, nextListBtn, preListBtn;
private AppliancesInfo appliancesInfo;
@@ -31,6 +43,7 @@
private TextView curSongInfoTv, curSongNameTv;
private int curListNum;//鐢变簬涓嶅悓鍘傚晢闇�姹傦紝蹇呴』鑷璁板綍褰撳墠鐨勫垪琛ㄥ彿
private boolean isInit;//璁板綍鏄惁鍒濆鍖�
+ private int SourceId = 1;//闊虫簮ID鍙�
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -56,6 +69,10 @@
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
+
+ //璁剧疆闊虫簮鍙�
+ appliancesInfo.setIntCurState(SourceId);
+
adapter = new ArrayAdapter<String>(AudioActivity.this, android.R.layout.simple_list_item_1, listString);
listView.setAdapter(adapter);
HDLCommand.audioCtrl(appliancesInfo, HDLAudio.GET_AUDIO_CURRRENT_INFO);//鑾峰彇褰撳墠闊充箰淇℃伅銆傝繑鍥炲綋鍓嶆瓕鏇层�佹墍鏈変俊鎭��
diff --git a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java
index cb5db34..69bed2c 100644
--- a/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java
+++ b/app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java
@@ -27,6 +27,7 @@
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.ThirdPartyBgmInfoEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.WarningInfoEvent;
import com.hdl.sdk.hdl_core.Util.NetUtil.NetWorkUtil;
+import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis;
import com.hdl.sdk.hdl_sdk.R;
import com.hdl.sdk.hdl_sdk.utlis.HDLLog;
@@ -79,7 +80,14 @@
initView();
setOnClick();
+// String str = "#Z018TYPE0010,music121";
+// String result = str.substring(4, 5);
+// HDLLog.I("result:"+result);
+
// hideTestButton();
+
+ double AA = HDLUtlis.byteToDouble((byte)0, (byte)0, (byte)134, (byte) 160);
+ HDLLog.I("byteToDouble:"+AA);
}
private void initView() {
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLAudio/HDLAudio.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLAudio/HDLAudio.java
index 19c9d39..aff1911 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLAudio/HDLAudio.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLAudio/HDLAudio.java
@@ -193,7 +193,8 @@
EventBus.getDefault().post(new AudioInfoEvent(CALLBACK_CURRENT_VOLUME, 79 - (Integer.parseInt(volNum)), audioInfo));
} else if (isExitData(arrMusicData[0], "TYPE")) {
Log.i("djl","Type ----> musicData = "+musicData);
- byte[] musicBytes = audioGetListParse(curListNum, 1);
+ String sourceId = musicData.substring(4, 5);
+ byte[] musicBytes = audioGetListParse(curListNum, 1, sourceId);
sendAudioData(getDatas, musicBytes);
} else if (isExitData(arrMusicData[0], "LIST")) {
@@ -203,7 +204,8 @@
}
int intNum = Integer.parseInt(num);
if (curListNum == intNum) {//鍒ゆ柇鍥炲鐨勬暟鎹槸鍚︿负褰撳墠鍒楄〃鏁�
- byte[] musicBytes = audioGetListParse(curListNum, 2);
+ String sourceId = musicData.substring(4, 5);
+ byte[] musicBytes = audioGetListParse(curListNum, 2, sourceId);
sendAudioData(getDatas, musicBytes);
}
} else if (isExitData(arrMusicData[0], "SONG")) {
@@ -306,15 +308,18 @@
strAsc += intAsc / 10;
strAsc += intAsc % 10;
}
- String byteAsc = stringToAscii(strAsc);
- String[] arrAsc = byteAsc.split(",");
- int a1 = Integer.parseInt(arrAsc[0]);
- int a2 = Integer.parseInt(arrAsc[1]);
- return new byte[]{0x2A, 0x5A, 0x31, 0x56, 0x4F, 0x4C, (byte) a1, (byte) a2, 0x0D};
+// String byteAsc = stringToAscii(strAsc);
+// String[] arrAsc = byteAsc.split(",");
+// int a1 = Integer.parseInt(arrAsc[0]);
+// int a2 = Integer.parseInt(arrAsc[1]);
+// return new byte[]{0x2A, 0x5A, 0x31, 0x56, 0x4F, 0x4C, (byte) a1, (byte) a2, 0x0D};
+
+ byte[] musicBytes = StringUtil.GetMusicBytes("*Z1VOL" + strAsc);
+ return musicBytes;
}
}
- public static byte[] audioChooseSongParse(int value1, int value2) {
+ public static byte[] audioChooseSongParse(int value1, int value2, int sourceId) {
int listNum = value1;
int songNum = value2 + 1;
String songNumStrAsc = "";
@@ -335,25 +340,28 @@
listNumStrAsc += listNum;
}
- String songNumByteAsc = stringToAscii(songNumStrAsc);
- String listNumByteAsc = stringToAscii(listNumStrAsc);
-
- String[] songNumArrAsc = songNumByteAsc.split(",");
- String[] listNumArrAsc = listNumByteAsc.split(",");
-
- int a1 = Integer.parseInt(songNumArrAsc[0]);
- int a2 = Integer.parseInt(songNumArrAsc[1]);
- int a3 = Integer.parseInt(songNumArrAsc[2]);
-
- int b1 = Integer.parseInt(listNumArrAsc[0]);
- int b2 = Integer.parseInt(listNumArrAsc[1]);
- int b3 = Integer.parseInt(listNumArrAsc[2]);
+// String songNumByteAsc = stringToAscii(songNumStrAsc);
+// String listNumByteAsc = stringToAscii(listNumStrAsc);
+//
+// String[] songNumArrAsc = songNumByteAsc.split(",");
+// String[] listNumArrAsc = listNumByteAsc.split(",");
+//
+// int a1 = Integer.parseInt(songNumArrAsc[0]);
+// int a2 = Integer.parseInt(songNumArrAsc[1]);
+// int a3 = Integer.parseInt(songNumArrAsc[2]);
+//
+// int b1 = Integer.parseInt(listNumArrAsc[0]);
+// int b2 = Integer.parseInt(listNumArrAsc[1]);
+// int b3 = Integer.parseInt(listNumArrAsc[2]);
//*Z011SONG001
- return new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x53, 0x4F, 0x4E, 0x47, 0x30
- , 0x30, 0x31, (byte) b1, (byte) b2, (byte) b3, (byte) a1, (byte) a2, (byte) a3, 0x32, 0x0D};
+// return new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x53, 0x4F, 0x4E, 0x47, 0x30
+// , 0x30, 0x31, (byte) b1, (byte) b2, (byte) b3, (byte) a1, (byte) a2, (byte) a3, 0x32, 0x0D};
+
+ byte[] musicBytes = StringUtil.GetMusicBytes("*Z01" + sourceId+ "SONG" +listNumStrAsc + songNumStrAsc + "2");
+ return musicBytes;
}
- private static byte[] audioGetListParse(int num, int type) {
+ private static byte[] audioGetListParse(int num, int type, String sourceId) {
String strAsc = "";
if (num < 10) {
strAsc = "00" + num;
@@ -368,10 +376,15 @@
int a2 = Integer.parseInt(arrAsc[1]);
int a3 = Integer.parseInt(arrAsc[2]);
if (type == 1) {
- return new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x4C, 0x49, 0x53,
- 0x54, 0x30, 0x30, 0x31, (byte) a1, (byte) a2, (byte) a3, 0x31, 0x0D};
+// return new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x4C, 0x49, 0x53,
+// 0x54, 0x30, 0x30, 0x31, (byte) a1, (byte) a2, (byte) a3, 0x31, 0x0D};
+ byte[] musicBytes = StringUtil.GetMusicBytes("*Z01" + sourceId + "LIST001" + strAsc + "1");
+ return musicBytes;
+
} else {
- return new byte[]{42, 90, 48, 49, 49, 83, 79, 78, 71, 48, 48, 49, (byte) a1, (byte) a2, (byte) a3, 48, 48, 49, 49, 13};
+// return new byte[]{0x2A, 0x5A, 0x30, 0x31, 0x31, 0x53, 0x4F, 0x4E, 0x47, 0x30, 0x30, 0x31, (byte) a1, (byte) a2, (byte) a3, 0x30, 0x30, 0x31, 0x31, 0x0D};
+ byte[] musicBytes = StringUtil.GetMusicBytes("*Z01" + sourceId + "SONG001" + strAsc + "0011");
+ return musicBytes;
}
}
}
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;
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
index 54518fe..0254adc 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -2545,6 +2545,7 @@
* @param getDatas
*/
private static void handleAudioData(UdpDataBean getDatas) {
+// HDLLog.info("澶勭悊HDL闊充箰鍗忚");
outter:
for (int i = 0, len = devicesDataList.size(); i < len; i++) {
if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
@@ -2554,7 +2555,7 @@
for (int j = 0, len2 = infos.size(); j < len2; j++) {
if (infos.get(j).getBigType() == Configuration.AUDIO_BIG_TYPE) {
//鏆傛椂鍙敮鎸佹棫鐗堣儗鏅煶涔�
- if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_MUSIC_MODULE) {
+ if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_MUSIC_MODULE || infos.get(j).getDeviceType() == HDLApConfig.TYPE_MUSIC_NEW_MODULE) {
HDLAudio.parseAudioData(getDatas, infos.get(j));
}
break outter;
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java
index 57390c6..4834bac 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java
@@ -20,7 +20,6 @@
/**
* Created by djl on 2017/3/17.
*/
-
public class HDLUdpCore {
// private static MulticastSocket msr6000 = null;
// private static MulticastSocket msr6008 = null;
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java
index 0152844..0c6d8a7 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java
@@ -135,6 +135,12 @@
case 1:
isWant = true;
break;
+ case 2:
+ isWant = true;
+ break;
+ case 3:
+ isWant = true;
+ break;
case 7:
isWant = true;
break;
@@ -286,9 +292,11 @@
break;
case 2:
appliancesInfo.setDeviceName("閫昏緫鐏帶鍒�");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_CCT);
break;
case 3:
appliancesInfo.setDeviceName("閫昏緫鐏疪GB");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_RGB);
break;
case 4:
appliancesInfo.setDeviceName("閫昏緫鐏疪GBW");
@@ -333,7 +341,7 @@
appliancesInfo.setPort(port);
appliancesInfo.setIpAddress(ipAddress);
- if(littleType == 7 || littleType == 8){
+ if(littleType == 2 ||littleType == 3 ||littleType == 7 || littleType == 8){
appliancesInfo.setCtrlCommand(Configuration.LIGHT_RGB_CTRL_COMMAND);
appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_RGB_CTRL_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.LIGHT_RGB_STATE_COMMAND);
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java
index 4f23557..514bda7 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java
@@ -63,6 +63,12 @@
return byteArrayToFloat(mByte);
}
+
+ public static double byteToDouble(byte b1, byte b2, byte b3, byte b4) {
+ return b1 * 256 * 256 * 256 + b2 * 256 * 256 + b3 * 256 + b4;
+ }
+
+
/**
* byte[4]鏁扮粍 杞崲涓篺loat绫诲瀷
*
diff --git a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
index 6e81c1c..69a1715 100644
--- a/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
+++ b/hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
@@ -84,7 +84,24 @@
+ (byte) ((b >> 1) & 0x1) + (byte) ((b >> 0) & 0x1);
}
-
+ /**
+ * 闊充箰鍛戒护鍙樻垚byte鏁扮粍
+ * @param commandString
+ * @return
+ */
+ public static byte [] GetMusicBytes (String commandString){
+ byte [] bytes = new byte[0];
+ try {
+ bytes = commandString.getBytes("US-ASCII");
+ byte [] sendBytes = new byte [bytes.length + 1];
+ sendBytes [bytes.length] = 0x0D;
+ System.arraycopy (bytes, 0, sendBytes, 0, bytes.length);
+ return sendBytes;
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return bytes;
+ }
+ }
// private byte[] formatStyleHDLResponse(String responsePart1, String responsePart2, int maxLen) throws UnsupportedEncodingException {
--
Gitblit v1.8.0