NesC Programming Language

24
Himali Saxena

description

NesC Programming Language. Himali Saxena. Topics. Configurations and Wiring Configuration implementation Basic Rules for declaration/definition Auto Wiring initialization ‘C’ and ‘P’ implementation The ‘as’ keyword and other namespace tricks Pass Through Wiring Combine Functions - PowerPoint PPT Presentation

Transcript of NesC Programming Language

Page 1: NesC  Programming Language

Himali Saxena

Page 2: NesC  Programming Language

Topics Configurations and Wiring

Configuration implementation Basic Rules for declaration/definition Auto Wiring initialization ‘C’ and ‘P’ implementation The ‘as’ keyword and other namespace tricks Pass Through Wiring Combine Functions

Parameterized Wiring

Page 3: NesC  Programming Language

Configurations and WiringConfiguration : A Component whose

implementation is component wiringCompose module into larger abstractions

Wiring : Connecting two components such that one module to be able to call another

Page 4: NesC  Programming Language

Configuration Implementationimplementation { component-list ,

connection-list}The component–list lists the components thar

are used to build this configurationThe connection-list specifies how these

components are wired to each other and to the configuration’s specification

Page 5: NesC  Programming Language

An Example

Page 6: NesC  Programming Language

Basic Rules for DeclaringUse component keyword to tell the names of

the component it is wiring Any number of components names can follow

components, order doesn’t matterCan have multiple component statementsThree operators : -- >, < -- and =Direct wiring ( -- > or < --) always goes to a

user to a provider.= operator exports interfaces

Page 7: NesC  Programming Language

Example

Page 8: NesC  Programming Language

Contd…

Page 9: NesC  Programming Language

An Example (= operator)

Page 10: NesC  Programming Language

Auto Wiring Initialization

Page 11: NesC  Programming Language

C and P ImplementationC implementation : Externally usable

abstractionP implementation : an internal

implementation

Page 12: NesC  Programming Language
Page 13: NesC  Programming Language

The ‘as’ Keyword and other namespace tricksThe as keyword allows to rename an

interface in a signatureThe as keyword can also be used within

configurations

Page 14: NesC  Programming Language
Page 15: NesC  Programming Language

Pass Through WiringPass through wiring is when a configuration

wires two interfaces in its signature together. It must wire a uses to a provides, and it does so with = operator.

Page 16: NesC  Programming Language

Multiple Wiring, Fan-in, and Fan-out

Page 17: NesC  Programming Language

Combine FunctionNesC provides mechanism of combine

functions to specify return valueA fan-ot always involves calling N functions

with identical signatures, the caller’s return value is the result of applying the combine function to the return values of all of the callees

When NesC compiles application, it autogenerates a fan-out function which applies the combine function

Page 18: NesC  Programming Language

An Example

Page 19: NesC  Programming Language

Parameterized Wiring

Page 20: NesC  Programming Language

Contd…

Page 21: NesC  Programming Language

Another way of defining parameter

Page 22: NesC  Programming Language

DefaultsA default handler is an implementation of a

function that’s used if no implementation is wired in. If a component wires to the interface, then the implementation is used. Otherwise, the (or signal) goes to the default handler.

Page 23: NesC  Programming Language
Page 24: NesC  Programming Language

Referenceshttp://www.tinyos.net/tinyos-2.x/doc/pdf/

tinyos-programming.pdfDavid Gay , Philip Levis , Robert von Behren ,

Matt Welsh , Eric Brewer , David Culler, The nesC language: A holistic approach to networked embedded systems, Proceedings of the ACM SIGPLAN 2003 conference on Programming language design and implementation, June 09-11, 2003, San Diego, California, USA

David Gay, Philip Levis, David Culler, Eric Brewer, “nesC 1.1 Language Reference Manual” May 2003