gre_io_serialize
gre_io_serialized_data_t* gre_io_serialize(
gre_io_serialized_data_t * buffer,
const char * event_target,
const char * event_name,
const char * event_format,
const void * event_data,
int event_nbytes
)
Serialize individual event items (see gre/io_mgr.h) into a single buffer for transmission using Storyboard IO.
Parameters
| Parameter | Type | Description |
|---|---|---|
buffer | gre_io_serialized_data_t* | The buffer that will contain the serialized data or NULL if a new buffer should be allocated. |
event_target | const char* | The name of the event target model element (screen, layer, control, render extension), or NULL to send to the default target (application level). |
event_name | const char* | The name of the event. |
event_format | const char* | The format description of the data (ex. "1s0 string") or NULL if no data is being sent. |
event_data | const void* | A pointer to the data to transmit, or NULL if no data is being sent. |
event_nbytes | int | The number of data bytes to transmit, or NULL if no data is transmitted. |
Returns
| Type | Description |
|---|---|
gre_io_serialized_data_t* | A buffer with the serialized data or NULL on error. It may be necessary for the internal buffer to be re-sized or re-allocated if the new data payload is larger than the previous one. |
Example
nbuffer = gre_io_serialize(nbuffer, NULL, "cluster_update",
"2u1 speed 2u1 rpm 2u1 fuel 2u1 battery 2u1 oil 2u1 odometer 2u1 trip",
&event_data, sizeof(event_data));
if(!nbuffer) {
fprintf(stderr, "Can't serialized data to buffer, exiting\n");
break;
}