user3121051
user3121051

Reputation: 21

field 'info' must be a network type

I'm a beginner and I try to create a struct in nesc for a tinyos app, but i have this error that i don't know how to fix. Any ideas? The code of the struct is:

typedef nx_struct Message
{
nx_uint16_t ID
float info;
} messaget;

Upvotes: 0

Views: 161

Answers (2)

Yaoshicn
Yaoshicn

Reputation: 144

You missed a ; after nx_uint16_t ID. A sample message may go like this:

typedef nx_struct test_message
{
    nx_uint16_t ID
    float info;
} test_message_t;

If you want to learn more about how to use structs to define message formats and directly access messages. You may refer to section 3.5.3 Platform-independent types in TinyOS Programming , a Book by David Gay and Philip A. Levis.

Upvotes: 0

James Allen
James Allen

Reputation: 7159

I think you're just missing a semicolon after ID. Also, the name you are giving your type is very close to message_t which is already used by TinyOS - I would recommend giving it a more descriptive name, like MyInformationMessage_t.

Upvotes: 0

Related Questions