Identifier type |
Naming rules |
Example |
Interfaces |
Interfaces should be named by verb or noun. the first letters of the connected words are generally capitalized. |
ADCRange SendMsg BombillaLocks
|
Components |
Components should be named by a noun. the first letters of the connected words are generally capitalized .. Here are two special examples: one is to end with an uppercase letter CT and the other is to end with an uppercase letter M. This is mainly used to distinguish the interface in the accessory from the configuration in the module. C stands:Component. It is mainly used to distinguish between interfaces (such as timer) and interfaces (such as timerc) provided by component ). Uppercase letter MModule. This naming convention is used when a single logical component has both a configuration and a module. an example of this is the timer in TOS/system. the timerc component, providing the timer interface, is a configuration that links its implementation (timerm) to clock and led providers. otherwise, any user of timerc wowould have to explicitly wire its subcomponents. |
CounterIntToRfm IntToRfmM TimerC TimerM UARTM
|
Files |
Filenames shocould be the name of the type contained within; All NESC files have ". nc" as a suffix. |
Counter.ncIntToRfm.nc IntToRfmM.nc TimerC.nc TimerM.nc UARTM.nc
|
Applications |
Applications shoshould be the name of the top level component, with Trailing CS removed. if an application tests a piece of tinyos code, its first word shocould be "test. "If an application tests tinyos hardware, its first word shocould be" verify. "If an application was part of a demonstration, its first word shocould be" demo." |
CntToRfmChirp DemoTracking TestTinyAlloc VerifyMicaHW TestTimer
|
Commands, events and tasks |
Commands, events and tasks shoshould be verbs, in mixed case with the first letter of each internal word capitalized, with the first letter lowercase. if a command/event pair form a split-phased operation, the name of the event shocould be the command suffixed with "done" or "complete ". commands that directly access hardware shocould be prefixed with "Tosh _" and follow the constant naming conventions (described below ). |
sendMsgoutput outputComplete put putDone fired TOSH_SET_RED_LED_PIN();
|
Variables |
Variables shoshould be nouns, in mixed case with the first letter of each internal word capitalized, with the first letter lowercase. They shoshould be descriptive, although temporary and loop variables (e.g. The ubiquitousI) May be used. |
bool stateuint16_t lastCount uint16_t counter result_t writeResult uint8_t noHeader
|
Constants |
Constants shoshould be in all caps, with underscores delimiting internal words. |
TOS_UART_ADDRTOS_BCAST_ADDR TOS_LOCAL_GROUP TOSH_S1PS
|