Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

473
Visualizações
Android, How to properly scan and filter ble UUID's

I am working with BluetoothLe on Android (min API : 21+). Currently the procedure of filtering service uuid's works, but not quite as expected. Below is a code segment used for setting up the basic scanner parameters, this is what currently works. Based on areas of other work with Ble, (iOS, Embedded Hardware) it becomes apparent that there are abilities to filter Ble devices based on their 16-bit UUID assignments only. Which brings me to Android... I realized android has had a rather rough start to Ble and its rather segmented ecosystem of devices, but I fail to see how/why android cant follow similar paths with the UUID's like other platforms. As all the UUID's coming from the Bluetooth SIG are 16-bit identifiers only with a mere definition of a UUID_BASE (00000000-0000-1000-8000-00805F9B34FB).

...
// devices UUID service
ParcelUuid parcelUuid = new ParcelUuid(UUID.fromString("1F0E0D0C-0B0A-0909-0807-060504030201"));
// devices UUID service mask
ParcelUuid parcelUuidMask = new ParcelUuid(UUID.fromString("00000D0C-0000-0000-0000-000000000000"));

// Filters and Settings
scanFilter = new ScanFilter.Builder().setServiceUuid(parcelUuid, parcelUuidMask).build();
scanFilterList.add(scanFilter);
scanSettings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_POWER).build();

// Scanning Started
mBluetoothLeScanner.startScan(scanFilterList, scanSettings, scanCallback);
...

With all that stated above, I have two Embedded Hardware devices broadcasting Two of their own UUID Services that are very similar to one another but different non the less. Below are those UUID's, in all accounts only the MSB(Most Signifigant Byte) is the differentiator amongst them all. Also there Device Names are different.

Device One:
Service 1 - 1F0E0D0C-0B0A-0909-0807-060504030201
Service 2 - 2F0E0D0C-0B0A-0909-0807-060504030201

Device Two:
Service 1 - EF0E0D0C-0B0A-0909-0807-060504030201
Service 2 - FF0E0D0C-0B0A-0909-0807-060504030201

Common Identifier amongst the UUID's:
0x0D0C

From the code segment provided earlier, the ParcelUuid that is used in the setServiceUuid method appears to require an exact match for the scanner to even return a device, despite the matching mask needed. How then, do you make the request to the drivers/hardware to filter only by 16-bit Identifiers instead of the full 128-bit Identifiers?? Because the model I have presented above with the two different devices, each with their own Service UUID's different from the other, isn't capable of scanning and returning all the devices wanted or expected.

I feel like the problem I'm having is two-fold but needs to addressed, because I cant seem to find the answer anywhere. I have searched high and low for all forum post, stack questions/answer that touch on this topic but none of them appear to pop out as what I'm looking for. I'm not sure if my understanding of filtering on android is faulty, if android is missing features, or inability to find such features in the supplied classes of android. I have a few thoughts on how to accomplish this "feature" in software but it will be rather ugly, time consuming, and taxing on the battery. One such example is scanning openly and filtering it manually. But I think there is or should be a feature to support 128-bit AND 16-bit UUID filtering when scanning through devices.

Can anyone help shed light on this????

Also, apologies for the length of this posted question...

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

The mask i should be opposite - use 1's for bits to include and 0's for those that should be ignored.

filter:  1F0E0D0C-0B0A-0909-0807-060504030201
mask:    0000FFFF-0000-0000-0000-000000000000

Result is that any device which has '0D0C' is included. You'd probably want a "tighter" filter with more similarities in it than this.

over 4 years ago · Santiago Trujillo Relatório

0

I'm not sure exactly what you want to filter on, but if you simply want to apply the filter ????0D0C-????-????-????-????????????, you should have the parcelUuid set to 00000D0C-0000-0000-0000-000000000000 and the parcelUuidMask set to 0000FFFF-0000-0000-0000-000000000000.

over 4 years ago · Santiago Trujillo Relatório

0

You should filter the BLE based on MAC addresses , they filter like a charm and perhaps if you have found the solution for the UUID filtering please do share.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda