0

I am trying to make a BLED112 behave like an iBEacon and also advertise few more GATT services. While advertising user data for iBeacon as in Bluegiga examples works fine, I do not know how to also advertise the list of available GATT services. Any ideas are highly appreciated!

Radu
  • 31
  • 3

2 Answers2

0

Take a look at my website for some potential help regarding using the BLED112 and Bluegiga tools: http://www.sureshjoshi.com/tag/bluegiga/

Otherwise, you shouldn't really be explicitly advertising anything. If you've set up your gatt.xml correctly, the GATT characteristics are advertised inherently (it's a BLE thing, not an explicit thing).

Are you sure you're setting them up correctly? Take a look at my BLE113 examples, specifically dealing with gatt.xml and see if there is anything helpful there: https://github.com/sureshjoshi/ble113-firmware-examples

SJoshi
  • 1,866
  • 24
  • 47
0

One approach would be to use the Bluegiga dual-mode advertising as a guide and instead of the Physical Web Beacon, advertise your GATT service there. Assuming you have a 128 bit service UUID of 112233-4455-6677-8899-00AABBCCDDEEFF your advertising data would look like this:

procedure gatt_service_advertisement()

    # Beacon mode
    beaconMode = 1

    #Stop advertisement
    call gap_set_mode(0,0)

    # Length
    service_adv(0:1) = $11  

    # Incomplete list of 128 bit UUIDs (use $07 if the list is complete)
    service_adv(1:1) = $06  

    # GATT Service UUID - should be little endian I think
    service_adv(2:1) = $FF
    service_adv(3:1) = $EE
    ...
    service_adv(16:1) = $11
    service_adv(17:1) = $00

    # Set advertisement interval to 100ms.
    # Use all three advertisement channels
    call gap_set_adv_parameters(160, 160, 7)

    # Set advertisement data
    call gap_set_adv_data(0, 18, service_adv(0:18))

    #set to advertising mode - with user data
    call gap_set_mode(4, gap_undirected_connectable)

end

You can use that procedure to alternate advertisements between iBeacon and your GATT service by calling it in a repeating timer like in the linked dual-mode example.

Another approach would be to advertise the GATT service in the scan response, but without knowing more about your particular use case, it's hard to say if that's an option for you.

forforf
  • 895
  • 7
  • 14