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

DbConnection.get_char_value_handle() always returns None? #186

@ShannonGreen

Description

@ShannonGreen

Version: 0.15.0 (pip)

When calling BLEAdapter.read_req() with any UUID I always get a NordicSemiException("Characteristic value handler not found") because get_char_value_handle() returns None.

The relevant code in get_char_value_handle() looks like this:

for c in s.chars:
	    if (c.uuid.value == uuid.value) and (
	        c.uuid.base.type == uuid.base.type
	    ):
	        for d in c.descs:
	            if d.uuid.value == uuid.value:
	                return d.handle
return None

I don't think the characteristic value attribute is actually returned by ble_gattc_desc_disc in service_discovery(). I figure someone would have noticed this before though? Should it not simply return c.value_handle (which is populated by ble_gattc_char_disc) instead of iterating through the descriptors?

I can work around this by looking up the handle first with get_char_handle() (which does work) and providing attr_handle=h+1 to read_req(), but I doubt that's the intended use for that parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions