Hi
I want to write a C++ program to send data from PC to a base station mote (app
BaseStation) , and this one, send the data received to another mote. I have
problems with the format packet I have to send (I connect to SerialForwarder
and receive data). I have the following code (to do it, I used:
http://www.tinyos.net/tinyos-2.x/doc/html/tep113.html):
____________________________________________________________________
char lenmsg = 13;
unsigned char buff[13];
int i = 0;
buff[i++]
= 0x7E; // Framing byte
buff[i++] = 0x40; // Protocol byte:
SerialP
buff[i++] = 0x09; // Sequence number?
buff[i++] = 0x00;
// Packet format dispatch byte
buff[i++] = 0xFF; // Message dest address
buff[i++]
= 0xFF; // Message dest address
buff[i++] = 0x01; // Packet size
buff[i++]
= 0x00; // Group ID
buff[i++] = 0x06; // Message Type
//buff[i++]
= 0x5D; // 0x06 isn't a scape, so I don't need it
buff[i++] = 0x56;
// Data
buff[i++] = 0x00; // CRC ?? I don't know how to calculate CRC
buff[i++] = 0x00; // CRC
buff[i++]
= 0x7E; // Framing byte */
send(fd, &lenmsg, 1, 0);
send(fd,
(char*)buff, lenmsg, 0);
____________________________________________________________________
I can see in the counter of packets written in the SerialForwarder (java
version) that the packet is send, but it doesn't reach the basestation. I don't
know if I'm using the right packet format to send data to SerialForwarder,
because I thing the code above is for serial communication, not to
SerialForwarder communication. I tested the following code (SerialAM message),
but I had the same result:
____________________________________________________________________
char lenmsg = 13;
unsigned char buff[13];
int i = 0;
buff[i++] = 0xFF; // Message dest address
buff[i++]
= 0xFF; // Message dest address
buff[i++] = 0x01; // Packet size
buff[i++]
= 0x00; // Group ID
buff[i++] = 0x06; // Message Type
buff[i++] = 0x56;
// Data
send(fd, &lenmsg, 1, 0);
send(fd,
(char*)buff, lenmsg, 0);
____________________________________________________________________
Any suggestion?
Thanks
David
_________________________________________________________________
Sé el protagonista de GQ con Messenger y Vodafone Blackberry. ¡Y gana premios!
http://serviciosmoviles.es.msn.com/messenger/vodafone.aspx_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help