Hello friends, I'm having trouble sending a data packet in the same time slot as a beacon on TOSSIM. I have a small implementation that activates 8 nodes with 183 time slots. Being that of these 183, 14 slots are active and at the moment they send a beacon of synchronization to the others. Until this point, it's ok! However, following the Mote-mote radio communication tutorial in tinyos-wiki, I inserted a function (BlinkToRadioMsg) to send a new package (theoretically data). If I enter this function in TimerSlot.fired (), below call AMControl.start, when my radio arrives in slot 20, it sends the data packet, but not the beacon. Even because as I make the call in slot 19 AMControl ... it has enough time to start the radio. If you enter the function inside AMControl.startDone (), after locked = true; E}, does not send the data packet, only the beacon and in the terminal presents several warning in the compilation of micaz. The warning is:
nesc1: warning: calls to AMPacket.group in testeC fan out, but there is no combine function specified for the return type nesc1: warning: calls to AMPacket.source in testeC fan out, but there is no combine function specified for the return type nesc1: warning: calls to AMPacket.address in testeC fan out, but there is no combine function specified for the return type nesc1: warning: calls to AMPacket.destination in testeC fan out, but there is no combine function specified for the return type nesc1: warning: calls to AMPacket.type in testeC fan out, but there is no combine function specified for the return type nesc1: warning: calls to AMPacket.isForMe in testeC fan out, but there is no combine function specified for the return type nesc1: warning: calls to AMPacket.localGroup in testeC fan out, but there is no combine function specified for the return type I'm in need of help to know if this wiki implementation really is a data packet and have this data packet sent every 300ms (I already use TMilli) in any of the 14 active slots (default), right after the beacon , Always for node 0 (TOS_NODE_ID = 0) and not in broadcast as it is being done. The following is the code for the test.nc file: #include "teste.h" #include "Timer.h" module testeC @safe() { uses { interface Boot; interface Receive; interface AMSend; interface Timer<TMilli> as TimerSlot; interface LocalTime<TMilli> as Clock; interface SplitControl as AMControl; interface Packet; interface AMPacket; interface Random; interface ParameterInit<uint16_t> as Seed; } } implementation { message_t packet; bool busy = FALSE; message_t pkt; bool locked; bool radio; uint16_t slot, slotin; uint16_t syncwith, syncwithin; uint16_t seqnum, nodeid; uint16_t counter = 0; uint8_t synchops = 0; uint8_t synchopsin; bool padrao[183]; uint8_t numslots = 183; event void Boot.booted() { //call Seed.init(2*TOS_NODE_ID); padrao[0] = padrao[12] = padrao[19] = padrao[20] = padrao[22] = padrao[43] = padrao[60] = padrao[71] = padrao[76] = padrao[85] = padrao[89] = padrao[115] = padrao[121] = padrao[168] = TRUE; syncwith = TOS_NODE_ID; //call AMControl.start(); slot = 0; dbg("teste","BOOT_NO: No %hu boot no slot %hu\n", TOS_NODE_ID, slot); if (TOS_NODE_ID == 0){ synchops = 0; } else { synchops = 255; } call TimerSlot.startPeriodic(55); } event void TimerSlot.fired() { slot++; counter++; slot=slot%numslots; //sem esta verificacao nao para no slot 183 //dbg("teste","TimerSlot.fired: %lu.\n", call Clock.get()); if (padrao[slot]) { dbg("teste","TIME_TO_SEND [%hu]: tempo para enviar o pkt=%lu.\n", slot, call Clock.get()); call AMControl.start(); * //if (!busy) { //BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, sizeof (BlinkToRadioMsg))); //btrpkt->nodeid = TOS_NODE_ID; //btrpkt->counter = counter; //if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS) { //dbg("teste", "ENVIAR_PKT_DADOS: [nodeid %hu], counter %hu no tempo=%lu.\n", nodeid, counter, call Clock.get()); //busy = TRUE; //} //}* //if (radio == TRUE) { //dbg("teste","RADIO_JA_LIGADO: No %hu no slot [%hu] com tempo=%lu.\n", TOS_NODE_ID, slot, call Clock.get()); //if (locked) { //dbg("teste", "FULL_QUEUE_S: sem espaço na fila.\n"); //return; //} //} } else { //dbg("teste","SLOT_INATIVO: No %hu no slot [%hu] com tempo=%lu.\n", TOS_NODE_ID, slot, call Clock.get()); call AMControl.stop(); } } event void AMControl.startDone(error_t err) { radio = TRUE; if (err == SUCCESS) { teste_msg_t* rcm = (teste_msg_t*)call Packet.getPayload(&packet, sizeof(teste_msg_t)); rcm->seqnum = seqnum; rcm->slot = slot; rcm->syncwith = syncwith; rcm->synchops = synchops; if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(teste_msg_t)) == SUCCESS) { dbg("teste", "ENVIAR_BEACON: [numseq %hu], slot %hu no tempo=%lu.\n", seqnum, slot, call Clock.get()); seqnum++; locked = TRUE; } * if (!busy) { BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, sizeof (BlinkToRadioMsg))); btrpkt->nodeid = TOS_NODE_ID; btrpkt->counter = counter; if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS) { dbg("teste", "ENVIAR_PKT_DADOS: [nodeid %hu], counter %hu no tempo=%lu.\n", nodeid, counter, call Clock.get()); busy = TRUE; } }* } else { call AMControl.start(); } return; } event void AMControl.stopDone(error_t err) { radio = FALSE; //dbg("teste","RADIO_PARADO: Radio do No %hu desligado no slot %lu no tempo=%hu.\n", TOS_NODE_ID, slot, call Clock.get()); } event message_t* Receive.receive(message_t* bufPtr, void* payload, uint8_t len) { uint16_t transmissor; uint16_t destino; uint16_t seqnumin; //dbg("teste", "SENTIDO_PKT: [lenght %hhu] time=%lu.\n", len, call Clock.get()); if (len != sizeof(teste_msg_t)) {return bufPtr;} else { teste_msg_t* rcm = (teste_msg_t*)payload; transmissor = call AMPacket.source(bufPtr); destino = call AMPacket.destination(bufPtr); seqnumin = rcm->seqnum; //syncwithin = rcm->syncwith; syncwithin = syncwith; synchopsin = rcm->synchops; slotin = rcm->slot; dbg("teste", "PKT_RECEBIDO: [transmissor %hu numseq %hu slot %hu hops %hu] time=%lu.\n", transmissor, seqnumin, slotin, synchopsin, call Clock.get()); } return bufPtr; } } event void AMSend.sendDone(message_t* bufPtr, error_t error) { if (&packet == bufPtr) { locked = FALSE; } if (&pkt == bufPtr) { busy = FALSE; } dbg("teste", "CONFIRMA_ENVIO: Confirmado o envio do PKT no tempo=%lu.\n", call Clock.get()); } } -- View this message in context: http://tinyos-help.10906.n7.nabble.com/Send-a-data-packet-on-TOSSIM-tp25082.html Sent from the TinyOS - Help mailing list archive at Nabble.com. _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help