Skip to content

NimBLEUUID: initializing from a 16-bit ID and toString are not consistent #871

Open
@bmedici

Description

@bmedici

When you initialize a NimBLEUUID with a 16-bit id, like in:

  • NimBLECharacteristic("1234",...
  • NimBLEUUID("1234")
    Only the string without 0x prefix is accepted and working.

But when you try to get the string representation of the ID from a characteristic or a service UUID, it's build with sprintf("0x%04"... which is not consistent with the input described above.

And I can"t find any simple way to get a numeric version of this ID, for example to call to16String, which could return 0x1234 (the uint16_t number).

The consequence is that I'm not able, as the same time and from the same set of values (characteristics ID for example), to

  • select services and chars and subscribe to notifications with these IDs
  • match the received notifications from the set of values, because the keys should be without "0x" prefix (ex: "1234"), and the received notifications expose the characteristic ID with this prfiex within the generated string ("0x1234").

Any suggestion on how to be able to feed and get the same format for these IDs, preferably strings, in the same format ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions