Hi Sara,
There is a test application given in tinyos-2.x:
/apps/tests/TestNetwork
This application does both the network protocols possible with
TINYOS-2.x i.e. Collection (send data from all the nodes to a SINK node)
and also Dissemination (Sending small data items to all the nodes from
the Root Node) and I would say that you should play with this
application
There is another interesting application /apps/Antitheft which does
similar to above but it provides you a GUI interface as well to
disseminate the items in the network.
If you are a beginner, then you can probably take the concept from these
applications and change it a little bit to get periodic data for your
testing purposes. Say you just have three timers firing at different
interval, sending the data to the SINK every time a timer fires and the
skeleton code will look something like this:
{
uses interface Timer<TMilli> as Timer1;
uses interface Timer<TMilli> as Timer2;
uses interface Timer<TMilli> as Timer3;
}
{
Call Timer1. startPeriodic (256);
Call Timer2. startPeriodic (512);
Call Timer3. startPeriodic (1024);
Uint16_t counter1 = 0;
Event void Timer1.fired () {
counter1++;
atomic {
if (!sendBusy)
post sendMessage();
}
}
void sendMessage() {
TestNetworkMsg* msg = (TestNetworkMsg*)call Send.getPayload(&packet,
sizeof(TestNetworkMsg));
uint16_t metric;
am_addr_t parent;
call CtpInfo.getParent(&parent);
call CtpInfo.getEtx(&metric);
msg->source = TOS_NODE_ID;
msg->seqno = seqno;
msg->data = counter1;
msg->parent = parent;
msg->hopcount = 0;
msg->metric = metric;
if (call Send.send(&packet, sizeof(TestNetworkMsg)) != SUCCESS) {
call Leds.led0On();
dbg("TestNetworkC", "%s: Transmission failed.\n", __FUNCTION__);
}
else {
sendBusy = TRUE;
seqno++;
dbg("TestNetworkC", "%s: Transmission succeeded.\n",
__FUNCTION__);
}
}
Similarly you can send data when other timers fire.
Hope this helps. Let me know if you need any more help.
Regards,
Varun
P.S: I am more than happy to help as much as I can so send me as many
queries as you want but also CC your queries to "tinyos-help mailing
list" as there are so many other people in the community who can give
answers from different perspective. This also helps to people who are
looking for your kind of problem/query.
From: sara so [mailto:[email protected]]
Sent: Tuesday, 7 April 2009 6:41 PM
To: Varun Jain
Subject: generate data tinyos
Hi Varun,
I am Sara from Berlin. I found your email while I was searching in
Google and hope that you can help me with the following question!
I want to be able to to generate data periodically from tmote sky node
and send it to the sink. Do you know how can I generate any kind of
data and send it. Is there any application that do that.
thank you for any help
Sara
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help