[Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft/Root
AntiTheftRootAppC.nc, 1.1, 1.2 AntiTheftRootC.nc, 1.1, 1.2
David Gay
idgay at users.sourceforge.net
Mon Apr 2 13:38:08 PDT 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft README.txt, NONE,
1.1 tutorial-slides.ppt, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft/Nodes
AntiTheftAppC.nc, 1.1, 1.2 AntiTheftC.nc, 1.1, 1.2 antitheft.h,
1.1, 1.2
- 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-serv22995/Root
Modified Files:
AntiTheftRootAppC.nc AntiTheftRootC.nc
Log Message:
comments, etc
Index: AntiTheftRootAppC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/AntiTheft/Root/AntiTheftRootAppC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AntiTheftRootAppC.nc 30 Mar 2007 16:59:23 -0000 1.1
--- AntiTheftRootAppC.nc 2 Apr 2007 20:38:06 -0000 1.2
***************
*** 1,26 ****
! #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;
}
--- 1,58 ----
! // $Id$
! /*
! * Copyright (c) 2007 Intel Corporation
! * All rights reserved.
! *
! * This file is distributed under the terms in the attached INTEL-LICENSE
! * file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
! * 94704. Attention: Intel License Inquiry.
! */
! /**
! * Top-level configuration for root-node code for the AntiTheft demo app.
! * Instantiates the dissemination and collection services, and does all
! * the necessary wiring.
! *
! * @author David Gay
! */
! #include "../Nodes/antitheft.h"
configuration AntiTheftRootAppC { }
implementation
{
! /* First wire the low-level services (booting, serial port, radio).
! There is no standard name for the actual radio component, so we use
! #ifdef to get the right one for the current platform. */
! components AntiTheftRootC, MainC, LedsC, ActiveMessageC, SerialActiveMessageC;
! #if defined(PLATFORM_MICA2)
! components CC1000CsmaRadioC as Radio;
! #elif defined(PLATFORM_MICAZ)
! components CC2420ActiveMessageC as Radio;
! #else
! #error "The AntiTheft application is only supported for mica2 and micaz nodes"
! #endif
AntiTheftRootC.Boot -> MainC;
AntiTheftRootC.SerialControl -> SerialActiveMessageC;
AntiTheftRootC.RadioControl -> ActiveMessageC;
! AntiTheftRootC.LowPowerListening -> Radio;
! AntiTheftRootC.Leds -> LedsC;
!
! /* Next, instantiate and wire a disseminator (to send settings) and a
! serial receiver (to receive settings from the PC) */
! components new DisseminatorC(settings_t, DIS_SETTINGS),
! new SerialAMReceiverC(AM_SETTINGS) as SettingsReceiver;
AntiTheftRootC.SettingsReceive -> SettingsReceiver;
AntiTheftRootC.SettingsUpdate -> DisseminatorC;
+ /* Finally, instantiate and wire a collector (to receive theft alerts) and
+ a serial sender (to send the alerts to the PC) */
+ components CollectionC, new SerialAMSenderC(AM_ALERTS) as AlertsForwarder;
+
+ AntiTheftRootC.CollectionControl -> CollectionC;
AntiTheftRootC.RootControl -> CollectionC;
AntiTheftRootC.AlertsReceive -> CollectionC.Receive[COL_ALERTS];
AntiTheftRootC.AlertsForward -> AlertsForwarder;
}
Index: AntiTheftRootC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/apps/AntiTheft/Root/AntiTheftRootC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AntiTheftRootC.nc 30 Mar 2007 16:59:23 -0000 1.1
--- AntiTheftRootC.nc 2 Apr 2007 20:38:06 -0000 1.2
***************
*** 1,2 ****
--- 1,20 ----
+ // $Id$
+ /*
+ * Copyright (c) 2007 Intel Corporation
+ * All rights reserved.
+ *
+ * This file is distributed under the terms in the attached INTEL-LICENSE
+ * file. If you do not find these files, copies can be found by writing to
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
+ * 94704. Attention: Intel License Inquiry.
+ */
+ /**
+ * Root node code for the antitheft demo app, just acts as a bridge with the PC:
+ * - disseminates settings received from the PC
+ * - acts as a root forthe theft alert collection tree
+ * - forwards theft alerts received from the collection tree to the PC
+ *
+ * @author David Gay
+ */
module AntiTheftRootC
{
***************
*** 21,24 ****
--- 39,43 ----
implementation
{
+ /* Start the radio and serial ports when booting */
event void Boot.booted()
{
***************
*** 29,33 ****
event void SerialControl.startDone(error_t error) { }
event void SerialControl.stopDone(error_t error) { }
! event void RadioControl.startDone(error_t error) {
if (error == SUCCESS)
{
--- 48,56 ----
event void SerialControl.startDone(error_t error) { }
event void SerialControl.stopDone(error_t error) { }
! event void RadioControl.startDone(error_t error) {
! /* Once the radio has started, we can setup low-power listening, and
! start the collection and dissemination services. Additionally, we
! set ourselves as the (sole) root for the theft alert dissemination
! tree */
if (error == SUCCESS)
{
***************
*** 39,42 ****
--- 62,67 ----
event void RadioControl.stopDone(error_t error) { }
+ /* When we receive new settings from the serial port, we disseminate
+ them by calling the change command */
event message_t *SettingsReceive.receive(message_t* msg, void* payload, uint8_t len)
{
***************
*** 54,58 ****
bool fwdBusy;
! event message_t *AlertsReceive.receive(message_t* msg, void* payload, uint8_t len)
{
alert_t *newAlert = payload;
--- 79,86 ----
bool fwdBusy;
! /* When we (as root of the collection tree) receive a new theft alert,
! we forward it to the PC via the serial port */
! event message_t *AlertsReceive.receive(message_t* msg, void* payload,
! uint8_t len)
{
alert_t *newAlert = payload;
***************
*** 62,65 ****
--- 90,95 ----
if (len == sizeof(*newAlert) && !fwdBusy)
{
+ /* Copy payload (newAlert) from collection system to our serial
+ message buffer (fwdAlert), then send our serial message */
alert_t *fwdAlert = call AlertsForward.getPayload(&fwdMsg);
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft README.txt, NONE,
1.1 tutorial-slides.ppt, NONE, 1.1
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/AntiTheft/Nodes
AntiTheftAppC.nc, 1.1, 1.2 AntiTheftC.nc, 1.1, 1.2 antitheft.h,
1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list