Transceiver and the Radio Interface
From CSL Wiki
Introduction
Code found in tos-contrib/transceiver/apps/Transceiver/TransceiverM.nc
The transceiver code has a large amount of radio specific code, which is currently integrated into the (large) file TransceiverM.nc via #ifdef statements.
Removing the radio specific code is very simple, if the type of radio can be specified at compile time. For example, just do a seperate RadioInit(...) function for each radio type, and call from the pared down TransceiverM.nc. Compile the code for the correct radio type, and the correct version of RadioInit can be automatically linked in and called from within the 'generic' Init function. Even if the type of radio is to be specified at run-time, it is still relatively simple to use the same 'shape' function prototypes for the radio specific functions. The radio type will be discovered at startup, and the correct radio specific file can be used seamlessly at run-time.
The other types of #ifdef statements found throughout the transceiver code are USE_MOAP, USE_HOSTMOAP, USE_MOTESYNC and USE_ESSTIMESYNC (see next section). Without knowing the purpose of these statements or what they are likely to be used for in the future, it is difficult to suggest a course of action. #ifdef statements reduce code readability, but if the use of these flags is going to be a permanently included or removed feature in the near future, it is probably best to leave them as they are. However, if these features are going to remain optional at compile time, I believe they should also be removed into seperate files, with empty functions to be called if a particular feature is disabled.
Open Questions
- What are the following flags used for? Are these features going to be permanently optional, or in the future are they likely to be permanently enabled or disabled:
- USE_MOAP
- USE_HOSTMOAP
- USE_MOTESYNC
- USE_ESSTIMESYNC
