Reads a value out of an inbound message tuple. More...
#include <pebble.h>Go to the source code of this file.
Functions | |
| int32_t | tuple_int_or (const Tuple *tuple, int32_t fallback) |
| Reads an int tuple, whatever width the phone sent it at. | |
| const char * | tuple_str_or (const Tuple *tuple, const char *fallback) |
| Reads a cstring tuple, or the fallback when it is not one that can be read. | |
Reads a value out of an inbound message tuple.
The SDK hands the phone's message over as tuples, each one a key, a type, a length, and the bytes. This unwraps that shape and hands the bytes to wire_read.h, which owns the actual reading. The split is the point: the tuple is the SDK's business and the width is not, and the width is where the reading goes wrong.
Everything that reads an inbound value goes through here. A decoder that unwraps a tuple itself is trusting the type to tell it the width, which the type does not do.