Closed AliMoal closed 10 months ago
Thanks! Looks pretty good. I would like to see a minor change to the API: instead of adding the presentation format as an optional parameter to the Metadata
struct, let's use a builder-style API (like we use for Properties
).
So new
would just take properties
and set the presentation format to None
.
Then there would be a method called presentation(self, presentation: Presentation) -> Self
. You should also change the with_security
constructor to a similar builder method security(self, security: Security) -> Self
.
That way users only have to deal with the optional pieces that they care about and you would create the metadata with a call like Metadata::new(my_properites).presentation(my_presentation).security(my_security)
;
Thanks! Looks pretty good. I would like to see a minor change to the API: instead of adding the presentation format as an optional parameter to the
Metadata
struct, let's use a builder-style API (like we use forProperties
).So
new
would just takeproperties
and set the presentation format toNone
.Then there would be a method called
presentation(self, presentation: Presentation) -> Self
. You should also change thewith_security
constructor to a similar builder methodsecurity(self, security: Security) -> Self
.That way users only have to deal with the optional pieces that they care about and you would create the metadata with a call like
Metadata::new(my_properites).presentation(my_presentation).security(my_security)
;
I guess I understood what you mean. Yes, that's the better method. I will change the code to this way and let you know.
@alexmoon Please check the new changes. Thanks
According to the issue (#222), which tells Softdevice reserved CPFD's UUID, this PR is providing Characteristic Presentation Format Descriptor (CPFD) based on SoftDevice API and BLE documentation. Examples also are updated according to new APIs. Please merge this PR. Thanks.