I reworked UserButtonP.nc, UserButtonC.nc, SwitchToggleC.nc from
tinyos-2.x/tos/platforms/telosb

and their test program tinyos-2.x/apps/tests/telosb/TestUserButton/TestUserButtonC.nc, TestUserButtonAppC.nc to get some practice with generic modules and came across something I don't understand.

IN SwitchToggleC(), the Notify type can be bool

generic module SwitchToggleC() {
  provides interface Get<bool>;
  provides interface Notify<bool>;

but then when instantiated, the globally provided interface is changed to type <button_state_t>

==================
module UserButtonP {
  provides interface Get<button_state_t>;
  provides interface Notify<button_state_t>;
==============

============
configuration UserButtonC {
  provides interface Get<button_state_t>;
  provides interface Notify<button_state_t>;

}
==============

If I change the type to bool everywhere it won't compile.

The Notify interface says,

/opt/tinyos-2.x/tos/interfaces/Notify.nc
======================================
/*
 * @param val_t the type of the object that will be stored
*/
interface Notify<val_t> {
  command error_t enable();
  command error_t disable();
  event void notify( val_t val );
}

Can val_t be bool?  If so, what is going wrong if when I change
val_t everywhere to bool, the compiler message says,

In file included from TestMSP430platfIOC.nc:22:
In component `TestMSP430platfIOP':
TestMSP430platfIOP.nc:82: conflicting types for `Notify.notify'
/opt/tinyos-2.x/tos/interfaces/Notify.nc(TestMSP430platfIOP):74: previous declaration of `Notify.notify'
?

Thanks,

John Griessen
Ecosensory
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to