[Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft/Root
AntiTheftRootAppC.nc, NONE, 1.1 AntiTheftRootC.nc, NONE,
1.1 Makefile, NONE, 1.1
David Gay
idgay at users.sourceforge.net
Fri Mar 30 09:59:25 PDT 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft/Nodes
AntiTheftAppC.nc, NONE, 1.1 AntiTheftC.nc, NONE, 1.1 Makefile,
NONE, 1.1 antitheft.h, NONE, 1.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/support/make sim-fast.extra, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/apps/AntiTheft/Root
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv11971/Root
Added Files:
AntiTheftRootAppC.nc AntiTheftRootC.nc Makefile
Log Message:
antitheft demo app
--- NEW FILE: AntiTheftRootAppC.nc ---
#include "../AntiTheft/antitheft.h"
configuration AntiTheftRootAppC { }
implementation
{
components AntiTheftRootC, MainC, LedsC, CollectionC,
new DisseminatorC(settings_t, DIS_SETTINGS),
ActiveMessageC, SerialActiveMessageC, CC1000CsmaRadioC,
new SerialAMReceiverC(AM_SETTINGS) as SettingsReceiver,
new SerialAMSenderC(AM_ALERTS) as AlertsForwarder;
AntiTheftRootC.Boot -> MainC;
AntiTheftRootC.SerialControl -> SerialActiveMessageC;
AntiTheftRootC.RadioControl -> ActiveMessageC;
AntiTheftRootC.LowPowerListening -> CC1000CsmaRadioC;
AntiTheftRootC.CollectionControl -> CollectionC;
AntiTheftRootC.SettingsReceive -> SettingsReceiver;
AntiTheftRootC.SettingsUpdate -> DisseminatorC;
AntiTheftRootC.RootControl -> CollectionC;
AntiTheftRootC.AlertsReceive -> CollectionC.Receive[COL_ALERTS];
AntiTheftRootC.AlertsForward -> AlertsForwarder;
AntiTheftRootC.Leds -> LedsC;
}
--- NEW FILE: AntiTheftRootC.nc ---
module AntiTheftRootC
{
uses
{
interface Boot;
interface SplitControl as SerialControl;
interface SplitControl as RadioControl;
interface LowPowerListening;
interface DisseminationUpdate<settings_t> as SettingsUpdate;
interface Receive as SettingsReceive;
interface StdControl as CollectionControl;
interface RootControl;
interface Receive as AlertsReceive;
interface AMSend as AlertsForward;
interface Leds;
}
}
implementation
{
event void Boot.booted()
{
call SerialControl.start();
call RadioControl.start();
}
event void SerialControl.startDone(error_t error) { }
event void SerialControl.stopDone(error_t error) { }
event void RadioControl.startDone(error_t error) {
if (error == SUCCESS)
{
call LowPowerListening.setLocalDutyCycle(200);
call CollectionControl.start();
call RootControl.setRoot();
}
}
event void RadioControl.stopDone(error_t error) { }
event message_t *SettingsReceive.receive(message_t* msg, void* payload, uint8_t len)
{
settings_t *newSettings = payload;
if (len == sizeof(*newSettings))
{
call Leds.led2Toggle();
call SettingsUpdate.change(newSettings);
}
return msg;
}
message_t fwdMsg;
bool fwdBusy;
event message_t *AlertsReceive.receive(message_t* msg, void* payload, uint8_t len)
{
alert_t *newAlert = payload;
call Leds.led0Toggle();
if (len == sizeof(*newAlert) && !fwdBusy)
{
alert_t *fwdAlert = call AlertsForward.getPayload(&fwdMsg);
*fwdAlert = *newAlert;
if (call AlertsForward.send(AM_BROADCAST_ADDR, &fwdMsg, sizeof *fwdAlert) == SUCCESS)
fwdBusy = TRUE;
}
return msg;
}
event void AlertsForward.sendDone(message_t *msg, error_t error) {
if (msg == &fwdMsg)
fwdBusy = FALSE;
}
}
--- NEW FILE: Makefile ---
PFLAGS += -I%T/lib/net/ctp -I%T/lib/net -I%T/lib/net/le
COMPONENT=AntiTheftRootAppC
include $(MAKERULES)
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft/Nodes
AntiTheftAppC.nc, NONE, 1.1 AntiTheftC.nc, NONE, 1.1 Makefile,
NONE, 1.1 antitheft.h, NONE, 1.1
- Next message: [Tinyos-2-commits]
CVS: tinyos-2.x/support/make sim-fast.extra, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list