Skip to content

Writing a peripheral characteristic sends back data #382

@Digitelektro

Description

@Digitelektro

Dear ukBaz!

Scenario: I have a characteristic with Write and and Indicate properties. When a central writes this characteristic, the peripheral notifies back the data. I think it is because the code updates the characteristic value which eventually triggers the write_value. This is not good for at least two reasons:

  • Unnecessary communication
  • Central shouldn't update the characteristic value, it should be the peripheral task to decide if it wants to update its value

I have a command characteristic where every command sent from central gets back an ACK response from the peripheral. But Central gets back the same command first that it has just sent... I hope you get what is the problem with it.

I commented out a line from localGATT.py:

def WriteValue(self, value, options):  # pylint: disable=invalid-name
        """
        DBus method for setting the characteristic value

        :return: value
        """
        if self.write_callback:
            self.write_callback(dbus_tools.dbus_to_python(value),
                                dbus_tools.dbus_to_python(options))
        # This is commented out: 
        # self.Set(constants.GATT_CHRC_IFACE, 'Value', value)

This solves the problem for me, but I don't know if it doesn't mess up something else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions