-
Couldn't load subscription status.
- Fork 58
Description
Correct me where I'm wrong:
The two possible ways to pack multiple bits of (manufacturer) data into an advertisement are
- create multiple ManufacturerDataField() items in your ad class.
Pro: you get to access that data withAlexsAd.firstdataitemsyntax, 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. - 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 withAlexsAd.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
| self.field_names = field_names |
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?).