Rework rpl-udp example. Now using simple-udp. Simplified and easier to configure.
This commit is contained in:
parent
3bb8123038
commit
653e43e7de
|
@ -1,11 +1,4 @@
|
|||
all: udp-client udp-server udp-client-packet-debug
|
||||
|
||||
CONTIKI=../..
|
||||
|
||||
ifdef SERVER_REPLY
|
||||
CFLAGS+=-DSERVER_REPLY=$(SERVER_REPLY)
|
||||
endif
|
||||
ifdef PERIOD
|
||||
CFLAGS+=-DPERIOD=$(PERIOD)
|
||||
endif
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
/* Hardcoded global IPv6 address of the server.
|
||||
* Must match link-local */
|
||||
#define INIT_SERVER_IPADDR(ipaddr) \
|
||||
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0x0212, 0x7401, 0x0001, 0x0101)
|
||||
|
||||
#endif /* PROJECT_CONF_H_ */
|
|
@ -7,7 +7,7 @@
|
|||
<project EXPORT="discard">[APPS_DIR]/collect-view</project>
|
||||
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
|
||||
<simulation>
|
||||
<title>Data collection network using IPv6 and RPL</title>
|
||||
<title>RPL-UDP Example -- Packet Debug</title>
|
||||
<randomseed>generated</randomseed>
|
||||
<motedelay_us>5000000</motedelay_us>
|
||||
<radiomedium>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<identifier>sky1</identifier>
|
||||
<description>Sky Mote Type #sky1</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-udp/udp-server.c</source>
|
||||
<commands EXPORT="discard">make clean udp-server.sky TARGET=sky DEFINES=TEST_MORE_ROUTES=1</commands>
|
||||
<commands EXPORT="discard">make clean udp-server.sky TARGET=sky</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-udp/udp-server.sky</firmware>
|
||||
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||
|
@ -48,7 +48,7 @@
|
|||
<identifier>sky2</identifier>
|
||||
<description>Sky Mote Type #sky2</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-udp/udp-client-packet-debug.c</source>
|
||||
<commands EXPORT="discard">make clean packet-debug.sky TARGET=sky</commands>
|
||||
<commands EXPORT="discard">make clean udp-client-packet-debug.sky TARGET=sky</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-udp/udp-client-packet-debug.sky</firmware>
|
||||
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||
|
@ -70,8 +70,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>48.435974731198804</x>
|
||||
<y>-66.16503914182063</y>
|
||||
<x>30.051578821079996</x>
|
||||
<y>-64.69428746901113</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -88,8 +88,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>4.049356309774755</x>
|
||||
<y>98.28771308774003</y>
|
||||
<x>21.31366587648077</x>
|
||||
<y>-34.91404431659299</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -106,8 +106,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>127.9689727848476</x>
|
||||
<y>91.71883780610729</y>
|
||||
<x>57.165216906562264</x>
|
||||
<y>-34.02362118358309</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -124,8 +124,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>57.897299848739024</x>
|
||||
<y>92.47229665488265</y>
|
||||
<x>75.1786320042507</x>
|
||||
<y>-60.441618586411096</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -142,8 +142,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>47.34887596588397</x>
|
||||
<y>-30.341495695501195</y>
|
||||
<x>59.11488934836</x>
|
||||
<y>-7.544844766953879</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -160,8 +160,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>47.13486576528276</x>
|
||||
<y>32.944481932122315</y>
|
||||
<x>91.720430365082</x>
|
||||
<y>-22.736406051209734</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -178,8 +178,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-11.42091423859419</x>
|
||||
<y>17.879870626121914</y>
|
||||
<x>92.90372351580778</x>
|
||||
<y>2.532304558933846</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -196,8 +196,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>118.92746659954325</x>
|
||||
<y>57.05973076244069</y>
|
||||
<x>120.28246466847423</x>
|
||||
<y>19.133402903417824</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -210,425 +210,11 @@
|
|||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>53.68872892015448</x>
|
||||
<y>59.887319605093715</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>9</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>16.45706316609417</x>
|
||||
<y>23.9075414163248</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>10</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-18.9555027263478</x>
|
||||
<y>75.14274313304935</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>11</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>29.265863595275306</x>
|
||||
<y>85.6911670159044</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>12</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-39.298891643282545</x>
|
||||
<y>-3.9704359883635574</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>13</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>66.93880603404335</x>
|
||||
<y>-42.39683727590697</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>14</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>94.81678343873172</x>
|
||||
<y>26.921376811426246</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>15</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-43.06618588715935</x>
|
||||
<y>30.68867105530305</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>16</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-34.02467970185502</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>17</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-28.750467760427494</x>
|
||||
<y>48.01822457713635</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>18</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>124.95513738974614</x>
|
||||
<y>20.140247172447996</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>19</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>15.703604317318808</x>
|
||||
<y>-47.6710492173345</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>20</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-40.05235049205791</x>
|
||||
<y>92.47229665488265</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>21</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>121.18784314586934</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>22</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>88.03565379975346</x>
|
||||
<y>-44.657213822233054</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>23</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>24.745110502623138</x>
|
||||
<y>-1.7100594420374744</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>24</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>94.06332458995635</x>
|
||||
<y>-2.4635182908128352</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>25</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-4.639784599615941</x>
|
||||
<y>-9.998106778566445</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>26</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-13.681290784920272</x>
|
||||
<y>-50.684884612435944</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>27</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>103.10483077526068</x>
|
||||
<y>96.99304974753483</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>28</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>8.922474678340558</x>
|
||||
<y>59.320107308766765</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>29</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>58.650758697514384</x>
|
||||
<y>2.8106936506146916</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>30</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>90.59867707439</x>
|
||||
<y>67.97632874312737</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>31</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
org.contikios.cooja.plugins.SimControl
|
||||
<width>259</width>
|
||||
<z>3</z>
|
||||
<width>249</width>
|
||||
<z>4</z>
|
||||
<height>184</height>
|
||||
<location_x>3</location_x>
|
||||
<location_y>15</location_y>
|
||||
|
@ -639,11 +225,11 @@
|
|||
<skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
|
||||
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
|
||||
<skin>org.contikios.cooja.plugins.skins.AttributeVisualizerSkin</skin>
|
||||
<viewport>2.349818846983307 0.0 0.0 2.349818846983307 150.19773526533348 176.95275613586946</viewport>
|
||||
<viewport>1.3598488697820064 0.0 0.0 1.3598488697820064 6.142207908179105 118.20877091196155</viewport>
|
||||
</plugin_config>
|
||||
<width>520</width>
|
||||
<z>2</z>
|
||||
<height>523</height>
|
||||
<width>234</width>
|
||||
<z>1</z>
|
||||
<height>227</height>
|
||||
<location_x>14</location_x>
|
||||
<location_y>210</location_y>
|
||||
</plugin>
|
||||
|
@ -654,58 +240,46 @@
|
|||
<formatted_time />
|
||||
<coloring />
|
||||
</plugin_config>
|
||||
<width>937</width>
|
||||
<width>1011</width>
|
||||
<z>0</z>
|
||||
<height>213</height>
|
||||
<location_x>265</location_x>
|
||||
<location_y>16</location_y>
|
||||
<height>556</height>
|
||||
<location_x>759</location_x>
|
||||
<location_y>7</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
org.contikios.cooja.plugins.ScriptRunner
|
||||
org.contikios.cooja.plugins.TimeLine
|
||||
<plugin_config>
|
||||
<script>TIMEOUT(12000000, log.log("Total PRR " + totalPRR + "\n"));
|
||||
packetsReceived= new Array();
|
||||
packetsSent = new Array();
|
||||
serverID = 1;
|
||||
nodeCount = 31;
|
||||
totalPRR = 0;
|
||||
|
||||
for(i = 0; i <= nodeCount; i++) {
|
||||
packetsReceived[i] = 0;
|
||||
packetsSent[i] = 0;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
YIELD();
|
||||
|
||||
msgArray = msg.split(' ');
|
||||
if(msgArray[0].equals("DATA")) {
|
||||
if(msgArray.length == 9) {
|
||||
// Received packet
|
||||
senderID = parseInt(msgArray[8]);
|
||||
packetsReceived[senderID]++;
|
||||
|
||||
log.log("SenderID " + senderID + " PRR " + packetsReceived[senderID] / packetsSent[senderID] + "\n");
|
||||
totalReceived = totalSent = 0;
|
||||
for(i = serverID + 1; i <= nodeCount; i++) {
|
||||
totalReceived += packetsReceived[i];
|
||||
totalSent += packetsSent[i];
|
||||
}
|
||||
totalPRR = totalReceived / totalSent;
|
||||
log.log("Total PRR " + totalPRR + " recv " + totalReceived + " sent " + totalSent + "\n");
|
||||
} else if(msgArray.length == 6) {
|
||||
// Sent packet
|
||||
packetsSent[id]++;
|
||||
}
|
||||
}
|
||||
}</script>
|
||||
<active>true</active>
|
||||
<mote>0</mote>
|
||||
<mote>1</mote>
|
||||
<mote>2</mote>
|
||||
<mote>3</mote>
|
||||
<mote>4</mote>
|
||||
<mote>5</mote>
|
||||
<mote>6</mote>
|
||||
<mote>7</mote>
|
||||
<showRadioRXTX />
|
||||
<showRadioHW />
|
||||
<showLEDs />
|
||||
<zoomfactor>681.712557066089</zoomfactor>
|
||||
</plugin_config>
|
||||
<width>651</width>
|
||||
<z>1</z>
|
||||
<height>550</height>
|
||||
<location_x>547</location_x>
|
||||
<location_y>181</location_y>
|
||||
<width>1804</width>
|
||||
<z>3</z>
|
||||
<height>352</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>567</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
org.contikios.cooja.plugins.RadioLogger
|
||||
<plugin_config>
|
||||
<split>150</split>
|
||||
<formatted_time />
|
||||
<showdups>false</showdups>
|
||||
<hidenodests>false</hidenodests>
|
||||
</plugin_config>
|
||||
<width>500</width>
|
||||
<z>2</z>
|
||||
<height>546</height>
|
||||
<location_x>259</location_x>
|
||||
<location_y>12</location_y>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<project EXPORT="discard">[APPS_DIR]/collect-view</project>
|
||||
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
|
||||
<simulation>
|
||||
<title>Data collection network using IPv6 and RPL</title>
|
||||
<title>RPL-UDP Example</title>
|
||||
<randomseed>generated</randomseed>
|
||||
<motedelay_us>5000000</motedelay_us>
|
||||
<radiomedium>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<identifier>sky1</identifier>
|
||||
<description>Sky Mote Type #sky1</description>
|
||||
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-udp/udp-server.c</source>
|
||||
<commands EXPORT="discard">make clean udp-server.sky TARGET=sky DEFINES=TEST_MORE_ROUTES=1</commands>
|
||||
<commands EXPORT="discard">make clean udp-server.sky TARGET=sky</commands>
|
||||
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-udp/udp-server.sky</firmware>
|
||||
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
|
||||
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
|
||||
|
@ -70,8 +70,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>48.435974731198804</x>
|
||||
<y>-66.16503914182063</y>
|
||||
<x>30.051578821079996</x>
|
||||
<y>-64.69428746901113</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -88,8 +88,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>4.049356309774755</x>
|
||||
<y>98.28771308774003</y>
|
||||
<x>21.31366587648077</x>
|
||||
<y>-34.91404431659299</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -106,8 +106,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>127.9689727848476</x>
|
||||
<y>91.71883780610729</y>
|
||||
<x>57.165216906562264</x>
|
||||
<y>-34.02362118358309</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -124,8 +124,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>57.897299848739024</x>
|
||||
<y>92.47229665488265</y>
|
||||
<x>75.1786320042507</x>
|
||||
<y>-60.441618586411096</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -142,8 +142,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>47.34887596588397</x>
|
||||
<y>-30.341495695501195</y>
|
||||
<x>59.11488934836</x>
|
||||
<y>-7.544844766953879</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -160,8 +160,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>47.13486576528276</x>
|
||||
<y>32.944481932122315</y>
|
||||
<x>91.720430365082</x>
|
||||
<y>-22.736406051209734</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -178,8 +178,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-11.42091423859419</x>
|
||||
<y>17.879870626121914</y>
|
||||
<x>92.90372351580778</x>
|
||||
<y>2.532304558933846</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -196,8 +196,8 @@
|
|||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>118.92746659954325</x>
|
||||
<y>57.05973076244069</y>
|
||||
<x>120.28246466847423</x>
|
||||
<y>19.133402903417824</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
|
@ -210,425 +210,11 @@
|
|||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>53.68872892015448</x>
|
||||
<y>59.887319605093715</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>9</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>16.45706316609417</x>
|
||||
<y>23.9075414163248</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>10</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-18.9555027263478</x>
|
||||
<y>75.14274313304935</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>11</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>29.265863595275306</x>
|
||||
<y>85.6911670159044</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>12</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-39.298891643282545</x>
|
||||
<y>-3.9704359883635574</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>13</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>66.93880603404335</x>
|
||||
<y>-42.39683727590697</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>14</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>94.81678343873172</x>
|
||||
<y>26.921376811426246</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>15</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-43.06618588715935</x>
|
||||
<y>30.68867105530305</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>16</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-34.02467970185502</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>17</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-28.750467760427494</x>
|
||||
<y>48.01822457713635</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>18</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>124.95513738974614</x>
|
||||
<y>20.140247172447996</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>19</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>15.703604317318808</x>
|
||||
<y>-47.6710492173345</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>20</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-40.05235049205791</x>
|
||||
<y>92.47229665488265</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>21</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>121.18784314586934</x>
|
||||
<y>-24.313824905298304</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>22</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>88.03565379975346</x>
|
||||
<y>-44.657213822233054</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>23</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>24.745110502623138</x>
|
||||
<y>-1.7100594420374744</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>24</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>94.06332458995635</x>
|
||||
<y>-2.4635182908128352</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>25</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-4.639784599615941</x>
|
||||
<y>-9.998106778566445</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>26</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>-13.681290784920272</x>
|
||||
<y>-50.684884612435944</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>27</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>103.10483077526068</x>
|
||||
<y>96.99304974753483</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>28</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>8.922474678340558</x>
|
||||
<y>59.320107308766765</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>29</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>58.650758697514384</x>
|
||||
<y>2.8106936506146916</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>30</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
<mote>
|
||||
<breakpoints />
|
||||
<interface_config>
|
||||
org.contikios.cooja.interfaces.Position
|
||||
<x>90.59867707439</x>
|
||||
<y>67.97632874312737</y>
|
||||
<z>0.0</z>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspClock
|
||||
<deviation>1.0</deviation>
|
||||
</interface_config>
|
||||
<interface_config>
|
||||
org.contikios.cooja.mspmote.interfaces.MspMoteID
|
||||
<id>31</id>
|
||||
</interface_config>
|
||||
<motetype_identifier>sky2</motetype_identifier>
|
||||
</mote>
|
||||
</simulation>
|
||||
<plugin>
|
||||
org.contikios.cooja.plugins.SimControl
|
||||
<width>259</width>
|
||||
<z>3</z>
|
||||
<width>249</width>
|
||||
<z>4</z>
|
||||
<height>184</height>
|
||||
<location_x>3</location_x>
|
||||
<location_y>15</location_y>
|
||||
|
@ -639,11 +225,11 @@
|
|||
<skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
|
||||
<skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
|
||||
<skin>org.contikios.cooja.plugins.skins.AttributeVisualizerSkin</skin>
|
||||
<viewport>2.349818846983307 0.0 0.0 2.349818846983307 150.19773526533348 176.95275613586946</viewport>
|
||||
<viewport>1.3598488697820064 0.0 0.0 1.3598488697820064 6.142207908179105 118.20877091196155</viewport>
|
||||
</plugin_config>
|
||||
<width>520</width>
|
||||
<z>2</z>
|
||||
<height>523</height>
|
||||
<width>234</width>
|
||||
<z>1</z>
|
||||
<height>227</height>
|
||||
<location_x>14</location_x>
|
||||
<location_y>210</location_y>
|
||||
</plugin>
|
||||
|
@ -654,58 +240,47 @@
|
|||
<formatted_time />
|
||||
<coloring />
|
||||
</plugin_config>
|
||||
<width>937</width>
|
||||
<width>1011</width>
|
||||
<z>0</z>
|
||||
<height>213</height>
|
||||
<location_x>265</location_x>
|
||||
<location_y>16</location_y>
|
||||
<height>556</height>
|
||||
<location_x>759</location_x>
|
||||
<location_y>7</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
org.contikios.cooja.plugins.ScriptRunner
|
||||
org.contikios.cooja.plugins.TimeLine
|
||||
<plugin_config>
|
||||
<script>TIMEOUT(12000000, log.log("Total PRR " + totalPRR + "\n"));
|
||||
packetsReceived= new Array();
|
||||
packetsSent = new Array();
|
||||
serverID = 1;
|
||||
nodeCount = 31;
|
||||
totalPRR = 0;
|
||||
|
||||
for(i = 0; i <= nodeCount; i++) {
|
||||
packetsReceived[i] = 0;
|
||||
packetsSent[i] = 0;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
YIELD();
|
||||
|
||||
msgArray = msg.split(' ');
|
||||
if(msgArray[0].equals("DATA")) {
|
||||
if(msgArray.length == 9) {
|
||||
// Received packet
|
||||
senderID = parseInt(msgArray[8]);
|
||||
packetsReceived[senderID]++;
|
||||
|
||||
log.log("SenderID " + senderID + " PRR " + packetsReceived[senderID] / packetsSent[senderID] + "\n");
|
||||
totalReceived = totalSent = 0;
|
||||
for(i = serverID + 1; i <= nodeCount; i++) {
|
||||
totalReceived += packetsReceived[i];
|
||||
totalSent += packetsSent[i];
|
||||
}
|
||||
totalPRR = totalReceived / totalSent;
|
||||
log.log("Total PRR " + totalPRR + " recv " + totalReceived + " sent " + totalSent + "\n");
|
||||
} else if(msgArray.length == 6) {
|
||||
// Sent packet
|
||||
packetsSent[id]++;
|
||||
}
|
||||
}
|
||||
}</script>
|
||||
<active>true</active>
|
||||
<mote>0</mote>
|
||||
<mote>1</mote>
|
||||
<mote>2</mote>
|
||||
<mote>3</mote>
|
||||
<mote>4</mote>
|
||||
<mote>5</mote>
|
||||
<mote>6</mote>
|
||||
<mote>7</mote>
|
||||
<showRadioRXTX />
|
||||
<showRadioHW />
|
||||
<showLEDs />
|
||||
<zoomfactor>681.712557066089</zoomfactor>
|
||||
</plugin_config>
|
||||
<width>651</width>
|
||||
<z>1</z>
|
||||
<height>550</height>
|
||||
<location_x>547</location_x>
|
||||
<location_y>181</location_y>
|
||||
<width>1804</width>
|
||||
<z>3</z>
|
||||
<height>352</height>
|
||||
<location_x>0</location_x>
|
||||
<location_y>567</location_y>
|
||||
</plugin>
|
||||
<plugin>
|
||||
org.contikios.cooja.plugins.RadioLogger
|
||||
<plugin_config>
|
||||
<split>150</split>
|
||||
<formatted_time />
|
||||
<showdups>false</showdups>
|
||||
<hidenodests>false</hidenodests>
|
||||
</plugin_config>
|
||||
<width>500</width>
|
||||
<z>2</z>
|
||||
<height>546</height>
|
||||
<location_x>259</location_x>
|
||||
<location_y>12</location_y>
|
||||
</plugin>
|
||||
</simconf>
|
||||
|
||||
|
|
|
@ -1,109 +1,43 @@
|
|||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/random.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "net/ipv6/uip.h"
|
||||
#include "net/ipv6/uip-ds6.h"
|
||||
#include "net/ipv6/uip-udp-packet.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "rpl.h"
|
||||
#include "random.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/ipv6/simple-udp.h"
|
||||
#include "net/ipv6/uipbuf.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dev/serial-line.h"
|
||||
#include "net/ipv6/uip-ds6-route.h"
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_INFO
|
||||
|
||||
#define UDP_CLIENT_PORT 8765
|
||||
#define UDP_SERVER_PORT 5678
|
||||
#define WITH_SERVER_REPLY 1
|
||||
#define UDP_CLIENT_PORT 8765
|
||||
#define UDP_SERVER_PORT 5678
|
||||
|
||||
static struct simple_udp_connection udp_conn;
|
||||
|
||||
#define START_INTERVAL (15 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (60 * CLOCK_SECOND)
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
|
||||
#define DEBUG DEBUG_FULL
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
|
||||
#ifndef PERIOD
|
||||
#define PERIOD 60
|
||||
#endif
|
||||
|
||||
#define START_INTERVAL (15 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
#define MAX_PAYLOAD_LEN 30
|
||||
|
||||
static struct uip_udp_conn *client_conn;
|
||||
static struct simple_udp_connection udp_conn;
|
||||
static uip_ipaddr_t server_ipaddr;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(udp_client_process, "UDP client process");
|
||||
PROCESS(udp_client_process, "UDP client -- packet debug");
|
||||
AUTOSTART_PROCESSES(&udp_client_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int seq_id;
|
||||
static int reply;
|
||||
|
||||
static void
|
||||
tcpip_handler(void)
|
||||
{
|
||||
if(uip_newdata()) {
|
||||
reply++;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_packet(void *ptr)
|
||||
{
|
||||
char buf[MAX_PAYLOAD_LEN];
|
||||
rpl_dag_t *dag;
|
||||
seq_id++;
|
||||
sprintf(buf, "Hello %d from the client", seq_id);
|
||||
|
||||
dag = rpl_get_any_dag();
|
||||
|
||||
if(dag != NULL) {
|
||||
uip_udp_packet_sendto(client_conn, buf, strlen(buf),
|
||||
&dag->dag_id, UIP_HTONS(UDP_SERVER_PORT));
|
||||
} else {
|
||||
PRINTF("Have not joined any DAG yet - could not send\n");
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static enum netstack_ip_action
|
||||
ip_input(void)
|
||||
{
|
||||
uint8_t proto = 0;
|
||||
uipbuf_get_last_header(uip_buf, uip_len, &proto);
|
||||
PRINTF("Incoming packet proto: %d from ", proto);
|
||||
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
||||
PRINTF("\n");
|
||||
LOG_INFO("Incoming packet proto: %d from ", proto);
|
||||
LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr);
|
||||
LOG_INFO_("\n");
|
||||
return NETSTACK_IP_PROCESS;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static enum netstack_ip_action
|
||||
ip_output(const linkaddr_t *localdest)
|
||||
{
|
||||
|
@ -111,61 +45,64 @@ ip_output(const linkaddr_t *localdest)
|
|||
uint8_t is_me = 0;
|
||||
uipbuf_get_last_header(uip_buf, uip_len, &proto);
|
||||
is_me = uip_ds6_is_my_addr(&UIP_IP_BUF->srcipaddr);
|
||||
PRINTF("%s packet proto: %d to ", is_me ? "Send" : "Fwd ", proto);
|
||||
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
|
||||
PRINTF("\n");
|
||||
if(is_me && proto == UIP_PROTO_UDP) {
|
||||
/* fake server-ip address here - just to emulate the UDP-example */
|
||||
PRINTF("DATA send to %d 'Hello %d'\n", 1, seq_id);
|
||||
}
|
||||
LOG_INFO("Outgoing packet (%s) proto: %d to ", is_me ? "send" : "fwd ", proto);
|
||||
LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr);
|
||||
LOG_INFO_("\n");
|
||||
return NETSTACK_IP_PROCESS;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
struct netstack_ip_packet_processor packet_processor = {
|
||||
.process_input = ip_input,
|
||||
.process_output = ip_output
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
udp_rx_callback(struct simple_udp_connection *c,
|
||||
const uip_ipaddr_t *sender_addr,
|
||||
uint16_t sender_port,
|
||||
const uip_ipaddr_t *receiver_addr,
|
||||
uint16_t receiver_port,
|
||||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
unsigned count = *(unsigned *)data;
|
||||
LOG_INFO("Received response %u from ", count);
|
||||
LOG_INFO_6ADDR(sender_addr);
|
||||
LOG_INFO_("\n");
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(udp_client_process, ev, data)
|
||||
{
|
||||
static struct etimer periodic;
|
||||
static struct ctimer backoff_timer;
|
||||
static struct etimer periodic_timer;
|
||||
static unsigned count;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
PROCESS_PAUSE();
|
||||
|
||||
PRINTF("UDP client process started nbr:%d routes:%d\n",
|
||||
NBR_TABLE_CONF_MAX_NEIGHBORS, NETSTACK_MAX_ROUTE_ENTRIES);
|
||||
|
||||
/* new connection with remote host */
|
||||
client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL);
|
||||
if(client_conn == NULL) {
|
||||
PRINTF("No UDP connection available, exiting the process!\n");
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT));
|
||||
|
||||
PRINTF("Created a connection with the server ");
|
||||
PRINT6ADDR(&client_conn->ripaddr);
|
||||
PRINTF(" local/remote port %u/%u\n",
|
||||
UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
|
||||
INIT_SERVER_IPADDR(server_ipaddr);
|
||||
/* Initialize UDP connection */
|
||||
simple_udp_register(&udp_conn, UDP_CLIENT_PORT, NULL,
|
||||
UDP_SERVER_PORT, udp_rx_callback);
|
||||
|
||||
/* register packet processor */
|
||||
netstack_ip_packet_processor_add(&packet_processor);
|
||||
|
||||
etimer_set(&periodic, SEND_INTERVAL);
|
||||
etimer_set(&periodic_timer, random_rand() % SEND_INTERVAL);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
|
||||
etimer_set(&periodic_timer, SEND_INTERVAL);
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
if(ev == tcpip_event) {
|
||||
tcpip_handler();
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
|
||||
|
||||
if(rpl_is_reachable()) {
|
||||
LOG_INFO("Sending request %u to ", count);
|
||||
LOG_INFO_6ADDR(&server_ipaddr);
|
||||
LOG_INFO_("\n");
|
||||
simple_udp_sendto(&udp_conn, &count, sizeof(count), &server_ipaddr);
|
||||
count++;
|
||||
} else {
|
||||
LOG_INFO("Not reachable yet %p\n", rpl_get_any_dag());
|
||||
}
|
||||
|
||||
if(etimer_expired(&periodic)) {
|
||||
etimer_reset(&periodic);
|
||||
ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
|
||||
}
|
||||
etimer_reset(&periodic_timer);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
|
|
|
@ -1,247 +1,73 @@
|
|||
/*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/random.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "net/ipv6/uip.h"
|
||||
#include "net/ipv6/uip-ds6.h"
|
||||
#include "net/ipv6/uip-udp-packet.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "rpl.h"
|
||||
#include "random.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/ipv6/simple-udp.h"
|
||||
|
||||
#include "dev/serial-line.h"
|
||||
#include "net/ipv6/uip-ds6-route.h"
|
||||
#include "rpl-dag-root.h"
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_INFO
|
||||
|
||||
#define UDP_CLIENT_PORT 8765
|
||||
#define UDP_SERVER_PORT 5678
|
||||
#define WITH_SERVER_REPLY 1
|
||||
#define UDP_CLIENT_PORT 8765
|
||||
#define UDP_SERVER_PORT 5678
|
||||
|
||||
#define UDP_EXAMPLE_ID 190
|
||||
|
||||
#define DEBUG DEBUG_FULL
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
|
||||
#ifndef PERIOD
|
||||
#define PERIOD 60
|
||||
#endif
|
||||
static struct simple_udp_connection udp_conn;
|
||||
|
||||
#define START_INTERVAL (15 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
#define MAX_PAYLOAD_LEN 30
|
||||
#define SEND_INTERVAL (60 * CLOCK_SECOND)
|
||||
|
||||
static struct uip_udp_conn *client_conn;
|
||||
static struct simple_udp_connection udp_conn;
|
||||
static uip_ipaddr_t server_ipaddr;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(udp_client_process, "UDP client process");
|
||||
PROCESS(udp_client_process, "UDP client");
|
||||
AUTOSTART_PROCESSES(&udp_client_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int seq_id;
|
||||
static int reply;
|
||||
|
||||
static void
|
||||
tcpip_handler(void)
|
||||
udp_rx_callback(struct simple_udp_connection *c,
|
||||
const uip_ipaddr_t *sender_addr,
|
||||
uint16_t sender_port,
|
||||
const uip_ipaddr_t *receiver_addr,
|
||||
uint16_t receiver_port,
|
||||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if(uip_newdata()) {
|
||||
str = uip_appdata;
|
||||
str[uip_datalen()] = '\0';
|
||||
reply++;
|
||||
printf("DATA recv '%s' (s:%d, r:%d)\n", str, seq_id, reply);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
send_packet(void *ptr)
|
||||
{
|
||||
char buf[MAX_PAYLOAD_LEN];
|
||||
|
||||
#ifdef SERVER_REPLY
|
||||
uint8_t num_used = 0;
|
||||
uip_ds6_nbr_t *nbr;
|
||||
|
||||
nbr = nbr_table_head(ds6_neighbors);
|
||||
while(nbr != NULL) {
|
||||
nbr = nbr_table_next(ds6_neighbors, nbr);
|
||||
num_used++;
|
||||
}
|
||||
|
||||
if(seq_id > 0) {
|
||||
ANNOTATE("#A r=%d/%d,color=%s,n=%d %d\n", reply, seq_id,
|
||||
reply == seq_id ? "GREEN" : "RED", uip_ds6_route_num_routes(), num_used);
|
||||
}
|
||||
#endif /* SERVER_REPLY */
|
||||
|
||||
seq_id++;
|
||||
PRINTF("DATA send to %d 'Hello %d'\n",
|
||||
server_ipaddr.u8[sizeof(server_ipaddr.u8) - 1], seq_id);
|
||||
sprintf(buf, "Hello %d from the client", seq_id);
|
||||
uip_udp_packet_sendto(client_conn, buf, strlen(buf),
|
||||
&server_ipaddr, UIP_HTONS(UDP_SERVER_PORT));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
print_local_addresses(void)
|
||||
{
|
||||
int i;
|
||||
uint8_t state;
|
||||
|
||||
PRINTF("Client IPv6 addresses: ");
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
|
||||
PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
PRINTF("\n");
|
||||
/* hack to make address "final" */
|
||||
if (state == ADDR_TENTATIVE) {
|
||||
uip_ds6_if.addr_list[i].state = ADDR_PREFERRED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
set_global_address(void)
|
||||
{
|
||||
uip_ipaddr_t ipaddr;
|
||||
|
||||
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
|
||||
|
||||
/* The choice of server address determines its 6LoWPAN header compression.
|
||||
* (Our address will be compressed Mode 3 since it is derived from our
|
||||
* link-local address)
|
||||
* Obviously the choice made here must also be selected in udp-server.c.
|
||||
*
|
||||
* For correct Wireshark decoding using a sniffer, add the /64 prefix to the
|
||||
* 6LowPAN protocol preferences,
|
||||
* e.g. set Context 0 to fd00::. At present Wireshark copies Context/128 and
|
||||
* then overwrites it.
|
||||
* (Setting Context 0 to fd00::1111:2222:3333:4444 will report a 16 bit
|
||||
* compressed address of fd00::1111:22ff:fe33:xxxx)
|
||||
*
|
||||
* Note the IPCMV6 checksum verification depends on the correct uncompressed
|
||||
* addresses.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* Mode 1 - 64 bits inline */
|
||||
uip_ip6addr(&server_ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0, 0, 1);
|
||||
#elif 1
|
||||
/* Mode 2 - 16 bits inline */
|
||||
uip_ip6addr(&server_ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0x00ff, 0xfe00, 1);
|
||||
#else
|
||||
/* Mode 3 - derived from server link-local (MAC) address */
|
||||
uip_ip6addr(&server_ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0x0250, 0xc2ff, 0xfea8, 0xcd1a); //redbee-econotag
|
||||
#endif
|
||||
unsigned count = *(unsigned *)data;
|
||||
LOG_INFO("Received response %u from ", count);
|
||||
LOG_INFO_6ADDR(sender_addr);
|
||||
LOG_INFO_("\n");
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(udp_client_process, ev, data)
|
||||
{
|
||||
static struct etimer periodic;
|
||||
static struct ctimer backoff_timer;
|
||||
static struct etimer periodic_timer;
|
||||
static unsigned count;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
PROCESS_PAUSE();
|
||||
INIT_SERVER_IPADDR(server_ipaddr);
|
||||
/* Initialize UDP connection */
|
||||
simple_udp_register(&udp_conn, UDP_CLIENT_PORT, NULL,
|
||||
UDP_SERVER_PORT, udp_rx_callback);
|
||||
|
||||
set_global_address();
|
||||
|
||||
PRINTF("UDP client process started nbr:%d routes:%d\n",
|
||||
NBR_TABLE_CONF_MAX_NEIGHBORS, NETSTACK_MAX_ROUTE_ENTRIES);
|
||||
|
||||
print_local_addresses();
|
||||
|
||||
/* new connection with remote host */
|
||||
client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL);
|
||||
if(client_conn == NULL) {
|
||||
PRINTF("No UDP connection available, exiting the process!\n");
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT));
|
||||
|
||||
PRINTF("Created a connection with the server ");
|
||||
PRINT6ADDR(&client_conn->ripaddr);
|
||||
PRINTF(" local/remote port %u/%u\n",
|
||||
UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));
|
||||
|
||||
etimer_set(&periodic, SEND_INTERVAL);
|
||||
etimer_set(&periodic_timer, random_rand() % SEND_INTERVAL);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
|
||||
etimer_set(&periodic_timer, SEND_INTERVAL);
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
if(ev == tcpip_event) {
|
||||
tcpip_handler();
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&periodic_timer));
|
||||
|
||||
if(rpl_is_reachable()) {
|
||||
LOG_INFO("Sending request %u to ", count);
|
||||
LOG_INFO_6ADDR(&server_ipaddr);
|
||||
LOG_INFO_("\n");
|
||||
simple_udp_sendto(&udp_conn, &count, sizeof(count), &server_ipaddr);
|
||||
count++;
|
||||
} else {
|
||||
LOG_INFO("Not reachable yet %p\n", rpl_get_any_dag());
|
||||
}
|
||||
|
||||
if(ev == serial_line_event_message && data != NULL) {
|
||||
char *str;
|
||||
str = data;
|
||||
if(str[0] == 'r') {
|
||||
uip_ds6_route_t *r;
|
||||
uip_ipaddr_t *nexthop;
|
||||
uip_ds6_defrt_t *defrt;
|
||||
uip_ipaddr_t *ipaddr;
|
||||
defrt = NULL;
|
||||
if((ipaddr = uip_ds6_defrt_choose()) != NULL) {
|
||||
defrt = uip_ds6_defrt_lookup(ipaddr);
|
||||
}
|
||||
if(defrt != NULL) {
|
||||
PRINTF("DefRT: :: -> %02d", defrt->ipaddr.u8[15]);
|
||||
PRINTF(" lt:%lu inf:%d\n", stimer_remaining(&defrt->lifetime),
|
||||
defrt->isinfinite);
|
||||
} else {
|
||||
PRINTF("DefRT: :: -> NULL\n");
|
||||
}
|
||||
|
||||
for(r = uip_ds6_route_head();
|
||||
r != NULL;
|
||||
r = uip_ds6_route_next(r)) {
|
||||
nexthop = uip_ds6_route_nexthop(r);
|
||||
PRINTF("Route: %02d -> %02d", r->ipaddr.u8[15], nexthop->u8[15]);
|
||||
/* PRINT6ADDR(&r->ipaddr); */
|
||||
/* PRINTF(" -> "); */
|
||||
/* PRINT6ADDR(nexthop); */
|
||||
PRINTF(" lt:%lu\n", r->state.lifetime);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(etimer_expired(&periodic)) {
|
||||
etimer_reset(&periodic);
|
||||
ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
|
||||
}
|
||||
etimer_reset(&periodic_timer);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
|
|
|
@ -28,119 +28,78 @@
|
|||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "contiki-lib.h"
|
||||
#include "contiki-net.h"
|
||||
#include "net/ipv6/uip.h"
|
||||
#include "rpl.h"
|
||||
#include "rpl-dag-root.h"
|
||||
|
||||
#include "net/netstack.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "net/ipv6/simple-udp.h"
|
||||
|
||||
#define DEBUG DEBUG_PRINT
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
|
||||
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_INFO
|
||||
|
||||
#define WITH_SERVER_REPLY 1
|
||||
#define UDP_CLIENT_PORT 8765
|
||||
#define UDP_SERVER_PORT 5678
|
||||
|
||||
#define UDP_EXAMPLE_ID 190
|
||||
static struct simple_udp_connection udp_conn;
|
||||
|
||||
static struct uip_udp_conn *server_conn;
|
||||
|
||||
PROCESS(udp_server_process, "UDP server process");
|
||||
PROCESS(udp_server_process, "UDP server");
|
||||
AUTOSTART_PROCESSES(&udp_server_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
tcpip_handler(void)
|
||||
udp_rx_callback(struct simple_udp_connection *c,
|
||||
const uip_ipaddr_t *sender_addr,
|
||||
uint16_t sender_port,
|
||||
const uip_ipaddr_t *receiver_addr,
|
||||
uint16_t receiver_port,
|
||||
const uint8_t *data,
|
||||
uint16_t datalen)
|
||||
{
|
||||
char *appdata;
|
||||
|
||||
if(uip_newdata()) {
|
||||
appdata = (char *)uip_appdata;
|
||||
appdata[uip_datalen()] = 0;
|
||||
PRINTF("DATA recv '%s' from ", appdata);
|
||||
PRINTF("%d",
|
||||
UIP_IP_BUF->srcipaddr.u8[sizeof(UIP_IP_BUF->srcipaddr.u8) - 1]);
|
||||
PRINTF("\n");
|
||||
#if SERVER_REPLY
|
||||
PRINTF("DATA sending reply\n");
|
||||
uip_ipaddr_copy(&server_conn->ripaddr, &UIP_IP_BUF->srcipaddr);
|
||||
uip_udp_packet_send(server_conn, "Reply", sizeof("Reply"));
|
||||
uip_create_unspecified(&server_conn->ripaddr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
print_local_addresses(void)
|
||||
{
|
||||
int i;
|
||||
uint8_t state;
|
||||
|
||||
PRINTF("Server IPv6 addresses: ");
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(state == ADDR_TENTATIVE || state == ADDR_PREFERRED) {
|
||||
PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
PRINTF("\n");
|
||||
/* hack to make address "final" */
|
||||
if (state == ADDR_TENTATIVE) {
|
||||
uip_ds6_if.addr_list[i].state = ADDR_PREFERRED;
|
||||
}
|
||||
}
|
||||
}
|
||||
unsigned count = *(unsigned *)data;
|
||||
LOG_INFO("Received request %u from ", count);
|
||||
LOG_INFO_6ADDR(sender_addr);
|
||||
LOG_INFO_("\n");
|
||||
#if WITH_SERVER_REPLY
|
||||
LOG_INFO("Sending reply %u to ", count);
|
||||
LOG_INFO_6ADDR(sender_addr);
|
||||
LOG_INFO_("\n");
|
||||
simple_udp_sendto(&udp_conn, &count, sizeof(count), sender_addr);
|
||||
#endif /* WITH_SERVER_REPLY */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(udp_server_process, ev, data)
|
||||
{
|
||||
uip_ipaddr_t ipaddr;
|
||||
uip_ds6_addr_t *link_local_addr;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
PROCESS_PAUSE();
|
||||
/* Initialize Global address */
|
||||
INIT_SERVER_IPADDR(ipaddr);
|
||||
LOG_INFO("Global IPv6 address: ");
|
||||
LOG_INFO_6ADDR(&ipaddr);
|
||||
LOG_INFO_("\n");
|
||||
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
|
||||
PRINTF("UDP server started. nbr:%d routes:%d\n",
|
||||
NBR_TABLE_CONF_MAX_NEIGHBORS, NETSTACK_MAX_ROUTE_ENTRIES);
|
||||
|
||||
uip_ip6addr(&ipaddr, UIP_DS6_DEFAULT_PREFIX, 0, 0, 0, 0, 0x00ff, 0xfe00, 1);
|
||||
rpl_dag_root_init_dag_immediately();
|
||||
|
||||
print_local_addresses();
|
||||
|
||||
server_conn = udp_new(NULL, UIP_HTONS(UDP_CLIENT_PORT), NULL);
|
||||
if(server_conn == NULL) {
|
||||
PRINTF("No UDP connection available, exiting the process!\n");
|
||||
/* Get link-local address */
|
||||
link_local_addr = uip_ds6_get_link_local(-1);
|
||||
if(link_local_addr == NULL) {
|
||||
LOG_ERR("No link-local address\n");
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
udp_bind(server_conn, UIP_HTONS(UDP_SERVER_PORT));
|
||||
|
||||
PRINTF("Created a server connection with remote address ");
|
||||
PRINT6ADDR(&server_conn->ripaddr);
|
||||
PRINTF(" local/remote port %u/%u\n", UIP_HTONS(server_conn->lport),
|
||||
UIP_HTONS(server_conn->rport));
|
||||
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
if(ev == tcpip_event) {
|
||||
tcpip_handler();
|
||||
} else if (ev == sensors_event && data == &button_sensor) {
|
||||
PRINTF("Initiaing global repair\n");
|
||||
#if UIP_CONF_IPV6_RPL_LITE
|
||||
rpl_global_repair();
|
||||
#else
|
||||
rpl_repair_root(RPL_DEFAULT_INSTANCE);
|
||||
#endif
|
||||
}
|
||||
if(memcmp(((uint8_t*)&link_local_addr->ipaddr + 8),
|
||||
((uint8_t*)&ipaddr + 8), 8)) {
|
||||
LOG_ERR("Global IPv6 address does not match link-local IPv6 address\n");
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
/* Initialize DAG root */
|
||||
rpl_dag_root_init(&ipaddr, &ipaddr);
|
||||
rpl_dag_root_init_dag_immediately();
|
||||
|
||||
/* Initialize UDP connection */
|
||||
simple_udp_register(&udp_conn, UDP_SERVER_PORT, NULL,
|
||||
UDP_CLIENT_PORT, udp_rx_callback);
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Reference in New Issue