Is there any proper documentation from Android Team why filter in BLE is not working for android 4.4 and 4.3 devices?

一笑奈何 提交于 2020-01-17 08:32:08

问题


Is there any proper reason from Android team why BLE filter is not working for Android 4.3 and 4.4 devices? I need to explain this issue to my client.

private List<UUID> parseUuids(byte[] advertisedData) {
    List<UUID> uuids = new ArrayList<UUID>();

    ByteBuffer buffer = ByteBuffer.wrap(advertisedData).order(ByteOrder.LITTLE_ENDIAN);
    while (buffer.remaining() > 2) {
        byte length = buffer.get();
        if (length == 0) break;

        byte type = buffer.get();
        switch (type) {
            case 0x02: // Partial list of 16-bit UUIDs
            case 0x03: // Complete list of 16-bit UUIDs
                while (length >= 2) {
                    uuids.add(UUID.fromString(String.format(
                            "%08x-0000-1000-8000-00805f9b34fb", buffer.getShort())));
                    length -= 2;
                }
                break;

            case 0x06: // Partial list of 128-bit UUIDs
            case 0x07: // Complete list of 128-bit UUIDs
                while (length >= 16) {
                    long lsb = buffer.getLong();
                    long msb = buffer.getLong();
                    uuids.add(new UUID(msb, lsb));
                    length -= 16;
                }
                break;

            default:
                buffer.position(buffer.position() + length - 1);
                break;
        }
    }

    return uuids;
}

来源:https://stackoverflow.com/questions/44109461/is-there-any-proper-documentation-from-android-team-why-filter-in-ble-is-not-wor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!