void buzzvstig_elem_serialize(buzzmsg_payload_t buf, const buzzobj_t key, const buzzvstig_elem_t data) { buzzobj_serialize (buf, key); buzzobj_serialize (buf, data->data); buzzmsg_serialize_u16(buf, data->timestamp); buzzmsg_serialize_u16(buf, data->robot); }
void buzzvstig_elem_serialize(buzzmsg_payload_t buf, const buzzobj_t key, const buzzvstig_elem_t data) { /* Serialize the key */ buzzobj_serialize(buf, key); /* Serialize the data */ buzzobj_serialize(buf, data->data); /* Serialize the timestamp */ buzzmsg_serialize_u16(buf, data->timestamp); /* Serialize the robot */ buzzmsg_serialize_u16(buf, data->robot); }
void buzzmsg_serialize_string(buzzdarray_t buf, const char* data) { /* Get the length of the string */ uint16_t len = strlen(data); /* Push that into the buffer */ buzzmsg_serialize_u16(buf, len); /* Go through the characters and push them into the buffer */ const char* c = data; while(*c) { buzzdarray_push(buf, (uint8_t*)(c)); ++c; } }