I'd have to see more of the file with the line numbers to have a
stronger opinion, but there are a couple problems with the snippet
you sent...
First the brackets are not correct around the case stmt.
Second defining "bool sound" locally as you seem to be
trying to do makes it a pointless state variable since
it gets initialized to TRUE on every pass and then gets
forgotten again due to C scoping rules.
To fix the bracketing, this may be what you were thinking:
case TOG_SOUNDER:
{
bool sound=TRUE;
if (sound) call Sounder.start();
else call Sounder.stop();
sound=!sound;
}
break;
however you probably want to but the
bool sound=TRUE;
somewhere outside all the function decls so it is a global.
Hope this is a good start...
MS
jurin dan wrote:
hi,
i'm trying to do the lesson 7 exercise of tinyos tutorial. but i'm
dealing with error during compilation. here is what i have done.(i'm
using tinyos v1.1.10)
*first step:* in SimpleCmd.nc i add "SimpleCmdM.Sounder ->Sounder;"
*second* *step:* in SimpleCmdM.nc i add in "uses", "interface
StdControl as Sounder;" and in "command result_t StdControl.init()" i
add "call Sounder.init();"
*third step:* also in SimpleCmdM.nc i add this code for command:
{
bool sound=TRUE;
case TOG_SOUNDER:
if (sound) call Sounder.start();
else call Sounder.stop();
sound=!sound;
break;
}
*fourth step:* in SimpleCmdMsg.h i add commandes types like
TOG_SOUNDER=5
after all this i *regenerate java class *and *recompile
BcastInject.java *
When i made compilation (make mica2) i got this *error message*:
$ make mica2
compiling Bcast to a mica2 binary
ncc -o build/mica2/main.exe -Os -board=micasb -target=mica2
-DCC1K_DEF_FREQ=9164
00000 -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all
-finline-limit=100000 -f
nesc-cfile=build/mica2/app.c Bcast.nc -lm
SimpleCmdM.nc:152: parse error before `{'
SimpleCmdM.nc:157: warning: type defaults to `int' in declaration of
`sound'
SimpleCmdM.nc:157: initializer element is not constant
SimpleCmdM.nc:157: (near initialization for `sound')
SimpleCmdM.nc:157: warning: data definition has no type or storage class
SimpleCmdM.nc:158: parse error before `break'
: `ReceiveCmdMsg.receive' not implemented
: `ProcessCmd.execute' not implemented
SimpleCmd.nc:56: cannot find `Sounder'
make: *** [build/mica2/main.exe] Error 1
analysing the message error, i think that error source is in the
command line i wrotte at the *third step*.
could anybody give me a help? thx
------------------------------------------------------------------------
Play Q6 for your chance to WIN
<http://g.msn.com/8HMAENCA/2734??PS=47575> great prizes.
------------------------------------------------------------------------
_______________________________________________
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