Hi, TOSH_DATA_LENGTH sets the available memory for the payload. The actual payload length is set up by the last parameter of AMSend.send (len).
Andirs On Tue, Oct 16, 2012 at 6:12 PM, ANDRIA Lama <lamaand...@yahoo.fr> wrote: > > Hi, > > Someone know how to change payload size dynamically? > My algorithm is like that, > > My payload size is 1, I send my data every 1s, and after 10s (counter = > 10), I want to update my packet size to 1 (TOSH_DATA_LENGTH + 1). > > I'm posting some of my code according to my logic I would do. > > 1) pld_send.h > > #ifndef TOSH_DATA_LENGTH > #define TOSH_DATA_LENGTH 1 > #endif > > enum { > TIMER_PERIOD_MILLI = 1000, > AM_PLD_SEND =3, > }; > > typedef nx_struct pld_send { > nx_uint16_t data; > nx_uint8_t fillBytes[TOSH_DATA_LENGTH]; > }pld_send_t > > 2) PldSendC.nc > > event void RadioControl.startDone(error_t radioBooted) { > > if ((counter & 0x0A) && TOSH_DATA_LENGTH !=26)) > TOSH_DATA_LENGTH = TOSH_DATA_LENGTH + 1; > > fillBytes[TOSH_DATA_LENGTH] = TOSH_DATA_LENGTH ; > > if ((call AMSend.send(AM_BROADCAST_ADDR, &VarStorePacket, > sizeofpld_send_t))) == SUCCESS) { > call Leds.led2Toggle(); > } > } > > Am I right? > Please help me. > > > _______________________________________________ > Tinyos-help mailing list > Tinyos-help@millennium.berkeley.edu > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >
_______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help