Wednesday, 9 April 2014

sensor programming

Dialect of C with support for
components
Components provide and require interfaces
Create application by wiring together components using
configurations
Whole-program compilation and analysis
nesC compiles entire application into a single C file
Compiled to mote binary by back-end C compiler (e.g., gcc)
Allows aggressive cross-component inlining
Static data-race detection
Important restrictions
No function pointers (makes whole-program analysis difficult)
No dynamic memory allocation
No dynamic component instantiation/destruction
.
These static requirements enable analysis and optimization
nesC interfaces are bidirectional
Command:
Function call from one component requesting service from another
Event:
Function call indicating completion of service by a component
Grouping commands/events together makes inter-component protocols clear
interface Timer {
command result_t start(char type, uint32_t interval);
command result_t stop();
event result_t fired();
}
interface SendMsg {
command result_t send(TOS_Msg *msg, uint16_t length);
event result_t sendDone(TOS_Msg *msg, result_t success);
http://www.satimagingcorp.com/media/images/alos-satellite-sensor.jpg                                                                                                      

Modules
contain implementation code
Configurations
wire other components together
An application is defined with a single top-level configuration
TimerM
StdControl
Timer
Clock
module TimerM {
provides {
interface StdControl;
interface Timer;
}
uses interface Clock;
} implementation {
command result_t Timer.start(char type, uint32_t interval) { ... }
command result_t Timer.stop() { ... }
event void Clock.tick() { ... }
}
                     "News powered by " 
                   
 
                       
     


No comments:

Post a Comment

About Me

Popular Posts

Designed By Seo Blogger Templates