0

大家好,我想问你是否知道在最旧版本的 TinyOs 中从 message_t 中提取数据的方法,有 TOS_Msg 和 TOS_MsgPtr 但在 message_t 中我找不到方法,请帮助我,我想知道是否有任何数据类型来存储数据,如表或数组列表

typedef nx_struct message_localization{
    nx_uint8_t   NodeId;
    bool       ancre_nature;
    nx_uint8_t   x_coordinate;
    nx_uint8_t   y_coordinate; 
    x_uint8_t   energie_transmited;

 } message_localization_t;
4

1 回答 1

0

Packet界面有一个getPayload您想要的命令:

command void *getPayload(message_t *msg, uint8_t len);

有关更多信息,请参阅文档

要访问数据字段,您可以执行以下操作:

message_t msg;
message_localization_t *payload =
    (message_localization_t *)call Packet.getPayload(
        &msg, sizeof(message_localization_t));
payload->x_coordinate = x;
payload->y_coordinate = y;
/* and so on */

为方便起见,相同的命令包含在接口SendAMSend. Packet并由配置AMSend提供。ActiveMessageC

于 2015-02-25T18:56:28.420 回答