MSDK监听OSDK数据重复
已完成payloadManagerExternal = PayloadCenter.getInstance().getPayloadManager().get(PayloadIndexType.EXTERNAL);
if (payloadManagerExternal != null) {
payloadManagerExternal.removePayloadDataListener(existingListener);
payloadManagerExternal.addPayloadDataListener(existingListener);
}
PayloadDataListener existingListener = new PayloadDataListener() {
@Override
public void onDataFromPayloadUpdate(byte[] data) {
Log.d("TAG", "Received data: " + Arrays.toString(data));
// 处理数据
savePayloadDataToLocal(data);
}
};
private void savePayloadDataToLocal(byte[] data) {
// 将 byte[] 转换为 ASCII 编码字符串
String result = new String(data, StandardCharsets.US_ASCII);
Log.d("TAG", "Received data: " + result);
}
通过监听获取的输入两条两条重复,确认OSDK是100毫秒发送一次数据,数据不重复,但是监听每次收到数据都是收到两条。
2025-01-08 17:31:29.611 23931-23931 TAG com.example.soundvibrationwarning D Received data: [35, 35, 82, 78, 61, 49, 55, 54, 54, 51, 55, 54, 54, 50, 49, 59, 83, 78, 61, 49, 49, 50, 48, 49, 49, 48, 48, 48, 49, 59, 68, 97, 116, 101, 61, 50, 48, 50, 53, 48, 49, 48, 56, 44, 84, 105, 109, 101, 61, 49, 55, 51, 49, 51, 50, 59, 83, 97, 116, 61, 48, 46, 48, 48, 44, 76, 97, 116, 61, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 76, 110, 103, 61, 45, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 72, 61, 48, 46, 48, 48, 59, 72, 83, 61, 48, 46, 48, 48, 44, 86, 83, 61, 48, 46, 48, 48, 59, 67, 72, 52, 61, 48, 44, 108, 105, 103]
2025-01-08 17:31:29.611 23931-23931 TAG com.example.soundvibrationwarning D Received data: ##RN=1766376621;SN=1120110001;Date=20250108,Time=173132;Sat=0.00,Lat=0.00000000,Lng=-0.00000000,H=0.00;HS=0.00,VS=0.00;CH4=0,lig
2025-01-08 17:31:29.611 23931-23931 TAG com.example.soundvibrationwarning D Received data: [35, 35, 82, 78, 61, 49, 55, 54, 54, 51, 55, 54, 54, 50, 49, 59, 83, 78, 61, 49, 49, 50, 48, 49, 49, 48, 48, 48, 49, 59, 68, 97, 116, 101, 61, 50, 48, 50, 53, 48, 49, 48, 56, 44, 84, 105, 109, 101, 61, 49, 55, 51, 49, 51, 50, 59, 83, 97, 116, 61, 48, 46, 48, 48, 44, 76, 97, 116, 61, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 76, 110, 103, 61, 45, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 72, 61, 48, 46, 48, 48, 59, 72, 83, 61, 48, 46, 48, 48, 44, 86, 83, 61, 48, 46, 48, 48, 59, 67, 72, 52, 61, 48, 44, 108, 105, 103]
2025-01-08 17:31:29.611 23931-23931 TAG com.example.soundvibrationwarning D Received data: ##RN=1766376621;SN=1120110001;Date=20250108,Time=173132;Sat=0.00,Lat=0.00000000,Lng=-0.00000000,H=0.00;HS=0.00,VS=0.00;CH4=0,lig
2025-01-08 17:31:29.611 23931-23931 TAG com.example.soundvibrationwarning D Received data: [104, 116, 61, 53, 55, 53, 44, 116, 101, 109, 112, 101, 114, 97, 116, 117, 114, 101, 61, 51, 53, 59, 38, 38, 53, 53, 68, 49, 10, 13]
2025-01-08 17:31:29.611 23931-23931 TAG com.example.soundvibrationwarning D Received data: ht=575,temperature=35;&&55D1
2025-01-08 17:31:29.612 23931-23931 TAG com.example.soundvibrationwarning D Received data: [104, 116, 61, 53, 55, 53, 44, 116, 101, 109, 112, 101, 114, 97, 116, 117, 114, 101, 61, 51, 53, 59, 38, 38, 53, 53, 68, 49, 10, 13]
2025-01-08 17:31:29.612 23931-23931 TAG com.example.soundvibrationwarning D Received data: ht=575,temperature=35;&&55D1
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: [35, 35, 82, 78, 61, 49, 55, 54, 54, 51, 55, 54, 54, 50, 49, 59, 83, 78, 61, 49, 49, 50, 48, 49, 49, 48, 48, 48, 49, 59, 68, 97, 116, 101, 61, 50, 48, 50, 53, 48, 49, 48, 56, 44, 84, 105, 109, 101, 61, 49, 55, 51, 49, 51, 50, 59, 83, 97, 116, 61, 48, 46, 48, 48, 44, 76, 97, 116, 61, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 76, 110, 103, 61, 45, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 72, 61, 48, 46, 48, 48, 59, 72, 83, 61, 48, 46, 48, 48, 44, 86, 83, 61, 48, 46, 48, 48, 59, 67, 72, 52, 61, 48, 44, 108, 105, 103]
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: ##RN=1766376621;SN=1120110001;Date=20250108,Time=173132;Sat=0.00,Lat=0.00000000,Lng=-0.00000000,H=0.00;HS=0.00,VS=0.00;CH4=0,lig
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: [35, 35, 82, 78, 61, 49, 55, 54, 54, 51, 55, 54, 54, 50, 49, 59, 83, 78, 61, 49, 49, 50, 48, 49, 49, 48, 48, 48, 49, 59, 68, 97, 116, 101, 61, 50, 48, 50, 53, 48, 49, 48, 56, 44, 84, 105, 109, 101, 61, 49, 55, 51, 49, 51, 50, 59, 83, 97, 116, 61, 48, 46, 48, 48, 44, 76, 97, 116, 61, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 76, 110, 103, 61, 45, 48, 46, 48, 48, 48, 48, 48, 48, 48, 48, 44, 72, 61, 48, 46, 48, 48, 59, 72, 83, 61, 48, 46, 48, 48, 44, 86, 83, 61, 48, 46, 48, 48, 59, 67, 72, 52, 61, 48, 44, 108, 105, 103]
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: ##RN=1766376621;SN=1120110001;Date=20250108,Time=173132;Sat=0.00,Lat=0.00000000,Lng=-0.00000000,H=0.00;HS=0.00,VS=0.00;CH4=0,lig
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: [104, 116, 61, 53, 55, 52, 44, 116, 101, 109, 112, 101, 114, 97, 116, 117, 114, 101, 61, 51, 53, 59, 38, 38, 54, 56, 50, 68, 10, 13]
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: ht=574,temperature=35;&&682D
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: [104, 116, 61, 53, 55, 52, 44, 116, 101, 109, 112, 101, 114, 97, 116, 117, 114, 101, 61, 51, 53, 59, 38, 38, 54, 56, 50, 68, 10, 13]
2025-01-08 17:31:29.674 23931-23931 TAG com.example.soundvibrationwarning D Received data: ht=574,temperature=35;&&682D
请问是否是有什么设置?
请先登录再写评论。
评论
9 条评论