On Wednesday 22 April 2015 14:20:16 Vinicius Costa Gomes wrote:
> Just wondering if something similar to what GATT does would work, using
> binary identifiers instead of string identifiers, emulating what GATT
> does with 16-bit, 32-bits and 128-bit UUIDs for characteristic value
> types.
>
> So the example becomes something like this:
>
> CBORValue value;
> if (!cbor_map_get_value(&request, OIC_HREF_UUID, &value) ||
> !cbor_string_equals(&value, "/a/light"))
> return;
>
> CBORValue rep;
> if (!cbor_map_get_value(&request, OIC_REP_UUID, &rep) ||
> !cbor_value_type(&map) == CBOR_TYPE_MAP)
> return;
>
> // extract properties:
> bool state;
> char *color;
> if (cbor_map_get_value(&map, OIC_LIGHT_STATE_UUID, &value)
> && cbor_value_get_boolean(&value, &state))
> set_light_state(state);
> if (cbor_map_get_value(&map, OIC_LIGHT_COLOR_UUID, &value)
> && cbor_value_get_string(&value, &color)) {
> set_light_color(color);
> free(color);
> }
>
> Without thinking much about, this seems to open some oportunities to
> reduce the payload further.
>
> Sorry if this was already discussed/considered.
Hi Vinicius
As far as I know, replacing the entry key names with integers has not been
discussed or proposed to the standards team. Someone else also mentioned this
to me, but it was just idle discussion at the time.
It would indeed save quite a bit of memory as well as processing power.
How would you propose for custom extensions?
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center