Yep, I would say this is the right way fo doing it. In the case you get a string with "Hello123", obviously you will get the decimal values of the chars and those of the char numbers so you always can convert to ASCII.
Furthermore, you can tune your automatically generated JAVA classes very easily to display the way you prefer. I mean, they are not either decimal or hex, but just integers. 2011/2/23 崔晓宗 <[email protected]>: > You can define a struct just follow this > tutorial http://docs.tinyos.net/index.php/Mote-mote_radio_communication > > typedef nx_struct BlinkToRadioMsg { > nx_uint8_t string[10]; > nx_uint16_t i; > } BlinkToRadioMsg; > > besides , I add " char c;" in Blink and there is no compiling error. > > > 2011/2/23 Shamali Gunawardena <[email protected]> >> >> Ok so everything transmitted will be received in its decimal format and I >> have to convert it. Am I correct? In that case I would run into another >> problem. say I get a combination of integers and strings (eg Hello123) then >> how can I decide on what to convert and what not to for example 72 could >> mean its H or the number 72. unless I know the length or the type of the >> data received I will not be able to interpret it. >> and why doesn't the char work ? how can I declare an array with >> nx_uint8_t. >> >> I am sorry for the repeated mail. but am desperate to go past this point. >> >> Regards, >> >> Shamali >> >> ________________________________ >> From: 崔晓宗 <[email protected]> >> To: Shamali Gunawardena <[email protected]>; >> [email protected] >> Sent: Wed, February 23, 2011 2:38:21 PM >> Subject: Re: [Tinyos-help] sending a string from tinyos >> >> 0x48 is equal to 72 in decimal, if you receive them on PC, you can turn >> them into 'H'. >> >> 2011/2/23 Shamali Gunawardena <[email protected]> >>> >>> thanks for the reply. How do you define it. >>> >>> I tried with just sending one character first. (the variable name is >>> character) >>> >>> 1. char charcter; (doesn't work) - compilation problem >>> 2. nx_uint8_t character- assigned the value 'H' and 0x48 to the message. >>> In both cases the received value was 72 (the decimal value) >>> >>> How do I get around that. >>> >>> regards, >>> >>> Shamali >>> ________________________________ >>> From: 崔晓宗 <[email protected]> >>> To: Shamali Gunawardena <[email protected]>; >>> [email protected] >>> Sent: Wed, February 23, 2011 1:49:36 PM >>> Subject: Re: [Tinyos-help] sending a string from tinyos >>> >>> you can send the string as a char array, which is similar to sending >>> integers. >>> 2011/2/23 Shamali Gunawardena <[email protected]> >>>> >>>> Hi, >>>> >>>> This is a pretty basic question. I need to know how I can send a string >>>> (eg Hello) in nesC. I know how to send integers (unit_16_t and etc) >>>> How do I specify the data type and how do I assign the value. >>>> >>>> thanks >>>> >>>> Regards, >>>> >>>> Shamali >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Tinyos-help mailing list >>>> [email protected] >>>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >>> >>> >>> >>> -- >>> Regards, >>> Xiaozong Cui >>> >> >> >> >> -- >> Regards, >> Xiaozong Cui >> > > > > -- > Regards, > Xiaozong Cui > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
