| | |
| | | if (!msgRemoved.getAndSet(true)) { |
| | | handler.removeMessages(MSG_NOTIFY_CHA, this); |
| | | } |
| | | |
| | | if (characteristic.getUuid().equals(UUID.fromString(uuid_notify))) { |
| | | System.out.println("chenqi Hex ->" + dumpHex(characteristic.getValue())); |
| | | bleCallback.onSuccess(characteristic); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public String dumpHex(byte[] src) { |
| | | String num = "0123456789ABCDEF"; |
| | | StringBuilder sb = new StringBuilder(); |
| | | // sb.append("[ "); |
| | | for (byte aSrc : src) { |
| | | int high = aSrc >> 4 & 0x0f; |
| | | int low = aSrc & 0x0f; |
| | | sb.append(num.charAt(high)).append(num.charAt(low)).append(" "); |
| | | } |
| | | // sb.append(" ]"); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * indicate |
| | | */ |