I think you can use Java: new String( byte[] )
where byte[] is the relevant data from your packet.
I always have to go over and over the Java types
when it comes to converting from one to another,
so I may have forgotten a couple of necessary hoops.
MS
Spidernet Lists wrote:
Hi,
I am doing a similar thing... but i am sending "helloworld" from one
mote to another and from that mote, send it to PC via serial.. i am able
to send "helloworld" from one mote to another but not the other part...
so Rf is like
typedef nx_struct BlinkToRadioMsg {
uint8_ t num[7];
} BlinkToRadioMsg;
uint8_t num1[] = "Hello!";
In TImer0.fired event, i write
BlinkToRadioMsg* btrpkt =
(BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL));
if (call Packet.maxPayloadLength() < sizeof(BlinkToRadioMsg)) {
return;
}
strcpy(btrpkt->num, num1);
Remember to include <string.h>, this is implemented in tinyos-2.x and
BlinkToRadio application...
Also, if you know the other part, that is how to send "helloworld" from
mote to PC, plz let me know. Anyone else who knows how will i decode the
PAYLOAD received on BaseStationCC2240 , please tel me, I am able to get
ascii equivalent hex numbers of "Hello!" on PC via serial interface but
before that i need to convert back to ascii and need to send ascii to
serial.. Any help is appreciated...
Cheers!!!!!!!!!
VJ
Cheers!!!!
VJ
Chan kenniel wrote:
Dear all,
Could any one here help me out with telling me how to write a
helloworld nesC program, then put it into TOS_Msg of the oscopeMsg
program? Actually what I wanna implement is send the string data
"helloworld" from a mote to PC, then in PC side use MIG to unpack the
packet, and show the result "helloworld". I know I can use
SerialForwarder with OscopeMsg to display data on PC, but I don't know
how to put the source data like "helloworld" into a packet to send, I
have read the OscilloscopeM.nc file, but don't know how they put data
into TOS_Msg variable, So could anyone help me with how to put source
data into TOS_MSg please?
Or if you I was wrong and you have any suggestion, all are extremely
appreciate. Thanks very much.
--
Best wishes,
Kenneth Chan
------------------------
Wish you have a good day!
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[EMAIL PROTECTED]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[EMAIL PROTECTED]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[EMAIL PROTECTED]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help