Reads the values the phone packs into a message. More...
Go to the source code of this file.
Functions | |
| static int32_t | wire_int_or (bool is_signed, uint16_t length, const uint8_t *value, int32_t fallback) |
Reads a little-endian integer of exactly length bytes. | |
| static bool | wire_cstring_terminated (const char *s, uint16_t length) |
Whether a string of length bytes carries its terminator inside itself. | |
Reads the values the phone packs into a message.
The phone is free to send an integer one, two, or four bytes wide, and it says which by the length it puts beside the value rather than by the type. The values sit back to back with nothing between them, so a reader that takes the type's word for the width and grabs four bytes off a one-byte value walks straight into whatever is packed behind it. That is what these are for: the width decides how many bytes get read, and anything else is refused.
Header only on purpose. There is one caller on the watch (tuple_read.c) and the bodies are smaller than a call would be, so they fold into it and nothing is spent on getting there.