Hi, i'm new in TinyOS programming.
I'm facing problem when i casting a variable.
I have different types of messages. When the end point receives each
message it has to check the type of message to decide a response.
I'm using UDP.recvfrom and cast the variable void *data to a messag_hdr
where i have the field msgtype. I evaluate this field with a switch
instruction
After i know the msgtype i cast again the *data to the message type
selected. The problem is that when i read the content of the casted
packet, all the content is 0.
This the code
event void Echo.recvfrom(struct sockaddr_in6 *from, void *data,
uint16_t len, struct ip_metadata *meta) {
msg_hdr_t *hmsg;
hmsg = (msg_hdr_t*)data;
switch (hmsg->msgtype){
case CONNACK:
printf("Type of packet is: %u\n",hmsg->msgtype);
printf("Receiving packet CONNACK\n");
connack = (connack_msg_t*)data;
printf("Mesagge id of packet is: %u\n",connack->msgid);
printfflush();
break;
}
}
Any suggestion, your help would be appreciated.
Ernesto.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help