8000 Does advertising.standard.ManufacturerDataField.field_names currently serve a purpose? · Issue #114 · adafruit/Adafruit_CircuitPython_BLE · GitHub
[go: up one dir, main page]

Skip to content
Does advertising.standard.ManufacturerDataField.field_names currently serve a purpose? #114
Open
@alexwhittemore

Description

@alexwhittemore

Correct me where I'm wrong:

The two possible ways to pack multiple bits of (manufacturer) data into an advertisement are

  1. create multiple ManufacturerDataField() items in your ad class.
    Pro: you get to access that data with AlexsAd.firstdataitem syntax, and you get to include-or-not items as you see fit per-broadcast.
    Con: Costs a few bytes to include the data type ID before the data item in the ad.
  2. create a single ManufacturerDataField() item, with a format that includes however many fields, all of which must be populated for any given ad.
    Pro: Saves having to spend a couple bytes per field
    Con: Have to access with AlexsAd.data[index] where you simply have to know the relevance of data at a given index, and data must have some rational "null" value that indicates "I never set that" like 0 for battery voltage, or -1 for "firefighters on scene"

Assuming I understand that architecture right, what purpose does the self.field_names object serve in advertising.standard.ManufacturerDataField on

?

It seems to add some structure and convenience about what the different indices in a ManufacturerDataField tuple mean, but also there doesn't seem to be any actual way to use that. The field_names must be defined at the class level for the class to function right, but then the values passed serve no purpose from that point on other than to consume memory (do they even?).

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

      0