| | |
| | | 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")) { |
| | | |
| | |
| | | } |
| | | 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")) { |
| | |
| | | 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 = ""; |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |