各位好!
请教大家个问题:
如何利用kawaii mqtt中的函数
int mqtt_publish(mqtt_client_t* c, const char* topic_filter, mqtt_message_t* msg)发送struct数据?
struct rt_variable
{
rt_uint8_t id;
rt_int32_t value;
};
typedef struct rt_variable *rt_variable_t;
struct rt_upData
{
uint8_t fault_code;
uint8_t channel_no;
char batt_id[32];
uint8_t variables_num;
struct rt_variable *variables;
uint8_t warning_class;
uint8_t warning_no;
};
typedef struct rt_upData *rt_upData_t;
rt_upData_t upData1 = RT_NULL;
msg.payload = (void *)(&upData1);
msg.payloadlen = sizeof(struct rt_upData);
涉及到struct内存对齐原则,导致发送的数据不对,请教大家如何解决该问题?谢谢各位!
更多回帖