TinyOS Naming Conventions
Last updated 28 August 2002 |
This document outlines the naming conventions used in TinyOS. They are strongly influenced by the Java coding conventions.
Identifier Type | Rules for Naming | Examples |
Interfaces | Interfaces should be verbs or nouns, in mixed case with the first letter of each internal word capitalized. |
ADC |
Components |
Components should be nouns, in mixed case with the first letter of each internal word capitalized. There are two special cases of component names; those terminating with an uppercase C and those terminating with an uppercase M. These are used to distinguish interfaces from components and configurations from modules. The uppercase C stands for Component. It is used to distinguish between an interface (e.g Timer) and a component that provides the interface (e.g TimerC). The uppercase M stands for Module. 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 would have to explicitly wire its subcomponents. |
Counter |
Files | Filenames should be the name of the type contained within; all nesC files have ".nc" as a suffix. |
Counter.nc |
Applications | Applications should be the name of the top level component, with trailing Cs removed. If an application tests a piece of TinyOS code, its first word should be "Test." If an application tests TinyOS hardware, its first word should be "Verify." If an application was part of a demonstration, its first word should be "Demo." |
CntToRfm |
Commands, Events and Tasks | Commands, events and tasks should 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 should be the command suffixed with "Done" or "Complete". Commands that directly access hardware should be prefixed with "TOSH_" and follow the constant naming conventions (described below). |
sendMsg |
Variables | Variables should be nouns, in mixed case with the first letter of each internal word capitalized, with the first letter lowercase. They should be descriptive, although temporary and loop variables (e.g. the ubiquitous i) may be used. |
bool state |
Constants | Constants should be in all caps, with underscores delimiting internal words. |
TOS_UART_ADDR |