Hi,

I have a problem with the Collection protocol.

When I call CollectionSenderC.send(...) I never get a
sendDone(error_t) signaled. When I try to resend then
CollectionSenderC.send(...) returns EBUSY.

I have not set up a root node yet but I think sendDone() should be
signaled after a while and deliver an error when no route can be
found.

Thanks in advance for any hints!

Nicola

#include "Pakets.h"

module SensorMoteC {
        uses {
                interface Boot;
                interface DbgMessenger;
                interface SensingControl;
                interface SplitControl as RadioControl;
                interface StdControl as RoutingControl;
                interface Send as CollectionSend;
        }
}
implementation{
        
        message_t packet;
        bool collectionSendBusy = FALSE;
        
        void sendMeasurementData(measuringData_t data);
        
        event void Boot.booted() {
                if( TOS_NODE_ID == BASE_NODE_ID ) {
                        call DbgMessenger.beep(10);
                        return;
                }
                call RadioControl.start();
        }
        
        event void RadioControl.startDone(error_t error) {
                if(error == SUCCESS) {
                        call RoutingControl.start();
                        call SensingControl.startSensing();
                }
                else {
                        call DbgMessenger.beep(10);
                        call RadioControl.start();
                }
        }
        
        event void RadioControl.stopDone(error_t error) {}
        
        event void SensingControl.readDone(measuringData_t data, error_t error) 
{
                if(!collectionSendBusy && error == SUCCESS) {
                        sendMeasurementData(data);
                }
                else {
                        call DbgMessenger.beep(10);
                }
        }
        
        void sendMeasurementData(measuringData_t data) {
                error_t error;
                measuringData_t* payload;
                payload = (measuringData_t*) call 
CollectionSend.getPayload(&packet);
                payload->origin = data.origin;
                payload->sensorID = data.sensorID;
                payload->timestamp = data.timestamp;
                payload->value = data.value;
                
                error = call CollectionSend.send(&packet, 
sizeof(measuringData_t));
                if (error != SUCCESS) collectionSendBusy = TRUE;
                else call DbgMessenger.beep(10);
        }
        
        event void CollectionSend.sendDone(message_t* msg, error_t error) {
                if(error != SUCCESS) {
                        call DbgMessenger.beep(10);
                }
                collectionSendBusy = FALSE;
        }
}


And the wiring:
==========
#include "Global.h"

configuration SensorMoteAppC {
}
implementation {
        components SensorMoteC as App;
        
        components MainC;
        App.Boot -> MainC.Boot;
        
        components DbgMessengerC;
        App.DbgMessenger -> DbgMessengerC;
        
        /* Sensing Control*/
        components SensingControlC;
        App.SensingControl -> SensingControlC;
        
        /* Collection Stuff */
        components ActiveMessageC, CollectionC, new 
CollectionSenderC(COLLECTION_ID);
        App.RadioControl -> ActiveMessageC;
        App.RoutingControl -> CollectionC;
        App.CollectionSend -> CollectionSenderC;
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to