BLE Advertisement Max Length



  • Hi,

    I am trying to send some data as BLE advertisement on Lopy4, below is the function I am using

    def normal_running_mode():
        bluetooth = Bluetooth()
        bluetooth.advertise(False)
        bluetooth.stop_scan()
        bluetooth.init()
        data = [0x4C,0x00,0x02,0x15,0x00,0x00,0xc8,0x43,0xcc,0x00,0x00,0x00,0x00,0x9c,
        0x00,0x00,0x48,0x42,0x02,0x00,0x00,0x00,0x00,0x9c,0x00,0x00,0xe1,0x42,0x81,0x0a]
        print("ADV Dat is " + str(ubinascii.hexlify(bytes(data))))
        bluetooth.set_advertisement(name = None, manufacturer_data = bytes(data))
        bluetooth.advertise(True)
        time.sleep(300)
    

    however the last 6 bytes of the payload is being dropped as shown in image below, what is the maximum size allowed by the field manufacturer_data. The BLE specification says the Max BLE Advertisement Packet size is 31 bytes and my whole payload is around 30 bytes. How can I send these 30 bytes as Advertisement. I tried using service UUID and service data as shown in the code in this link (https://forum.pycom.io/topic/1911/wipy-as-an-ibeacon/3) but that doesn't work.

    BeaconScan.jpg



  • This post is deleted!

Log in to reply
 

Pycom on Twitter