nrf-softdevice
nrf-softdevice copied to clipboard
More efficient handling of 128-bit uuids
The softdevice handles 128bit uuids in a funny manner: you register them at runtime to get an "uuid type", and then to use it you specify the type, and bytes 12-13. This means if you do a custom service that requires many UUIDs, you can save flash and ram by making them only differ in bytes 12-13: you only register the "base" uuid once, then use the same uuid type with just different bytes 12-13.
If we want to take advantage of this we could make a macro like this:
uuids!(
FOO_SVC = "4a04fbec-229b-11eb-98bd-2f03a9d5f786";
FOO_CHAR_1 = "4a04fbec-229b-11eb-98bd-2f030000f786";
FOO_CHAR_2 = "4a04fbec-229b-11eb-98bd-2f030001f786";
FOO_CHAR_3 = "4a04fbec-229b-11eb-98bd-2f030002f786";
FOO_CHAR_4 = "4a04fbec-229b-11eb-98bd-2f030003f786";
FOO_CHAR_5 = "4a04fbec-229b-11eb-98bd-2f030004f786";
FOO_CHAR_6 = "4a04fbec-229b-11eb-98bd-2f030005f786";
)
which would generate code to register the "base uuid" just once if uuids are equal in bytes other than 12-13