Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

BLE CHAR_NOTIFY_EVENT callback with same value (but must be different) #449

@herrfrei

Description

@herrfrei

Board: WiPy 2.0
Firmware: 1.20.2.rc7

I'm trying to read data from a battery management system. This has a TX characteristic where one can write commands to it and a RX where the client gets the answer. The protocol starts with 0xDD and ends a message with 0x77. The info message I want to read is sent in two sub-packages and I get two callback calls. But both contain the second part of the message (ending with 0x77). This occurs all the time when I call the info message command.

Callback is registered with:

char.callback(trigger=Bluetooth.CHAR_NOTIFY_EVENT, handler=self._rx_callback)

And the callback itself is:

def _rx_callback(self, char=None):
    data = char.value()
    print('_rx_callback data={}'.format(hex(data)))

I call a function every 10 seconds that outputs the name and writes the "get info command" to the device:

def print_data(self):
    if self.OD[0x1800][0x2A00]['value']:
        print('Name: %s' % self.OD[0x1800][0x2A00]['value'])
    self.bms_get_base_info()

And here is the output I get:

Name: DL1907xxxx<\r><\n>
_rx_callback data=000019130304010B68FCE277<\r><\n>
_rx_callback data=000019130304010B68FCE277<\r><\n>

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions