From: sdhsdh Date: Sat, 9 Jan 2010 00:31:51 +0000 (+0000) Subject: remove 6lowpancli X-Git-Tag: rc_6_tinyos_2_1_1~67 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=8d2528699736fe879b90bf6e045f012844432c3d remove 6lowpancli --- diff --git a/apps/6lowpancli/CliAppC.nc b/apps/6lowpancli/CliAppC.nc deleted file mode 100644 index 5c6fd648..00000000 --- a/apps/6lowpancli/CliAppC.nc +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2007 Matus Harvan - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT - * OWNER 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 "printf.h" - -#if defined(ENABLE_MICAZ_TEMP_SENSOR) || defined(ENABLE_TELOSB_TEMP_SENSOR) -#define ENABLE_TEMP_SENSOR -#endif /* ENABLE_MICAZ_TEMP_SENSOR || ENABLE_TELOSB_TEMP_SENSOR */ - -#if defined(ENABLE_MICAZ_LIGHT_SENSOR) || defined(ENABLE_TELOSB_LIGHT_SENSOR) -#define ENABLE_LIGHT_SENSOR -#endif /* ENABLE_MICAZ_LIGHT_SENSOR || ENABLE_TELOSB_LIGHT_SENSOR */ - -enum { - AM_IP_MSG = 0x41, -}; - -configuration CliAppC {} -implementation { - components CliC as App, LedsC, MainC; - components IPC; - - App.Boot -> MainC.Boot; - App.Leds -> LedsC; - App.IPControl -> IPC.IPControl; - App.IP -> IPC.IP; - App.UDPClient -> IPC.UDPClient[unique("UDPClient")]; - -#ifdef ENABLE_SOUNDER - components SounderC; - App.Sounder -> SounderC; -#endif /* ENABLE_SOUNDER */ - -#ifdef ENABLE_MICAZ_TEMP_SENSOR - components new TempC(); // telosb temp/humidity sensor - App.TempSensorC -> TempC; -#endif /* ENABLE_MICAZ_TEMP_SENSOR */ - -#ifdef ENABLE_TELOSB_TEMP_SENSOR - components new SensirionSht11C(); // telosb temp/humidity sensor - App.TempSensorC -> SensirionSht11C.Temperature; -#endif /* ENABLE_TELOSB_TEMP_SENSOR */ - -#ifdef ENABLE_MICAZ_LIGHT_SENSOR - components new PhotoC();// telosb visible light sensor - App.LightSensorC -> PhotoC; -#endif /* ENABLE_MICAZ_TEMP_SENSOR */ - -#ifdef ENABLE_TELOSB_LIGHT_SENSOR - // total solar radiation sensor - //new HamamatsuS10871TsrC() as Sensor, // telosb (IR) light sensor - // photosynthetically-active radiation sensor - components new HamamatsuS1087ParC();// telosb visible light sensor - App.LightSensorC -> HamamatsuS1087ParC; -#endif /* ENABLE_TELOSB_TEMP_SENSOR */ -} - - - diff --git a/apps/6lowpancli/CliC.nc b/apps/6lowpancli/CliC.nc deleted file mode 100644 index 89225cd9..00000000 --- a/apps/6lowpancli/CliC.nc +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2007 Matus Harvan - * All rights reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * 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. - * * The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT - * OWNER 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 "Timer.h" - -#define min(a,b) ( (a>b) ? b : a ) -#define max(a,b) ( (a>b) ? a : b ) - -module CliC { - uses { - interface Leds; - interface Boot; - interface IP; - interface UDPClient; - interface SplitControl as IPControl; -#ifdef ENABLE_SOUNDER - interface Mts300Sounder as Sounder; -#endif /* ENABLE_SOUNDER */ -#ifdef ENABLE_TEMP_SENSOR - interface Read as TempSensorC; -#endif /* ENABLE_TEMP_SENSOR */ -#ifdef ENABLE_LIGHT_SENSOR - interface Read as LightSensorC; -#endif /* ENABLE_LIGHT_SENSOR */ - } -} -implementation { -#ifndef MINIMIZE_MEMORY - char *help_buf = "6lowpan cli supported commands:\n" - "\tset led {0,1,2} {on,off} -- toggle leds\n" -#ifdef ENABLE_SOUNDER - "\tsounder time_in_ms\n" -#endif /* ENABLE_SOUNDER */ -#ifdef ENABLE_TEMP_SENSOR - "\tget temp\n" -#endif /* ENABLE_TEMP_SENSOR */ -#ifdef ENABLE_LIGHT_SENSOR - "\tget light\n" -#endif /* ENABLE_LIGHT_SENSOR */ - "\tsend small udp\n" - "\tsend large udp\n" - "\thelp\n"; - char *small_udp_buf = "\n"; - char *large_udp_buf = "\n"; - /* - char *small_udp_buf = "----- SMALL UDP DATA BUFFER -----\n"; - char *large_udp_buf = - "This is a large testing string. It should undergo " \ - "6lowpan fragmentation\n" \ - "0............................................................\n" \ - "1............................................................\n" \ - "2............................................................\n" \ - "3............................................................\n" \ - "4............................................................\n" \ - "5............................................................\n" \ - "6............................................................\n" \ - "7............................................................\n" \ - "8............................................................\n" \ - "9............................................................\n" \ - "A............................................................\n" \ - "B............................................................\n" \ - "C............................................................\n" \ - "D............................................................\n" \ - "E............................................................\n" \ - "10...........................................................\n" \ - "11...........................................................\n" \ - "12...........................................................\n" \ - "13(shorter)\n" \ - "---- END OF THE LARGE UDP DATA ----\n"; - */ -#if defined(ENABLE_TEMP_SENSOR) || defined(ENABLE_LIGHT_SENSOR) - char sensor_buf[15]; - bool sensor_buf_busy = FALSE; - ip6_addr_t sensor_addr; - uint16_t sensor_port; -#endif /* ENABLE_TEMP_SENSOR | ENABLE_LIGHT_SENSOR */ -#endif /* MINIMIZE_MEMORY */ - - event void Boot.booted() { - /* set an IP address */ - ip6_addr_t addr = {{0x20, 0x01, - 0x06, 0x38, - 0x07, 0x09, - 0x12, 0x34, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00 - }}; - //call IP.setAddress(&addr); - call IP.setAddressAutoconf(&addr); - - call IPControl.start(); - } - - event void IPControl.startDone(error_t err) { - - call UDPClient.listen(1234); - } - event void IPControl.stopDone(error_t err) {} - - event void UDPClient.receive(const ip6_addr_t *addr, const uint16_t port, - uint8_t *buf, uint16_t len ) - { -#ifndef MINIMIZE_MEMORY - if ( strncmp(buf, "set ", min(len, 4)) == 0 && len>0) { - buf += 4; - len -= 4; - if ( strncmp(buf, "led ", min(len, 4)) == 0 && len>0) { - buf += 4; - len -= 4; - - if ( strncmp(buf, "0 ", min(len, 2)) == 0 && len>0) { - buf += 2; - len -= 2; - if ( strncmp(buf, "on", min(len, 2)) == 0 && len>0) { - call Leds.led0On(); - } else if (strncmp(buf, "off", min(len, 3)) == 0 && len>0){ - call Leds.led0Off(); - } - } else if ( strncmp(buf, "1 ", min(len, 2)) == 0 && len>0) { - buf += 2; - len -= 2; - if ( strncmp(buf, "on", min(len, 2)) == 0 && len>0) { - call Leds.led1On(); - } else if (strncmp(buf, "off", min(len, 3)) == 0 && len>0){ - call Leds.led1Off(); - } - } else if ( strncmp(buf, "2 ", min(len, 2)) == 0 && len>0) { - buf += 2; - len -= 2; - if ( strncmp(buf, "on", min(len, 2)) == 0 && len>0) { - call Leds.led2On(); - } else if (strncmp(buf, "off", min(len, 3)) == 0 && len>0){ - call Leds.led2Off(); - } - } - } -#ifdef ENABLE_SOUNDER - } else if ( strncmp(buf, "sounder ", min(len, 8)) == 0 - && len>0) { - buf += 8; - len -= 8; - call Sounder.beep(atoi(buf)); -#endif /* ENABLE_SOUNDER */ - -#ifdef ENABLE_TEMP_SENSOR - } else if ( strncmp(buf, "get temp", min(len, 8)) == 0 - && len>0) { - memcpy(&sensor_addr, addr, sizeof(*addr)); - sensor_port = port; - //call UDPClient.sendTo(addr, port, "reading temp...\n", 16); - call TempSensorC.read(); -#endif /* ENABLE_TEMP_SENSOR */ - -#ifdef ENABLE_LIGHT_SENSOR - } else if ( strncmp(buf, "get light", min(len, 8)) == 0 - && len>0) { - memcpy(&sensor_addr, addr, sizeof(*addr)); - sensor_port = port; - //call UDPClient.sendTo(addr, port, "reading light...\n", 17); - call LightSensorC.read(); -#endif /* ENABLE_LIGHT_SENSOR */ - - } else if (strncmp(buf, "send large udp", min(len, 14)) == 0 - && len>0) { - call UDPClient.sendTo(addr, port, - large_udp_buf, strlen(large_udp_buf)); - } else if (strncmp(buf, "send small udp", min(len, 14)) == 0 - && len>0) { - call UDPClient.sendTo(addr, port, - small_udp_buf, strlen(small_udp_buf)); - } else if (strncmp(buf, "help", min(len, 14)) == 0 - && len>0) { - call UDPClient.sendTo(addr, port, - help_buf, strlen(help_buf)); - } else { - call UDPClient.sendTo(addr, port, - help_buf, strlen(help_buf)); - } -#endif /* MINIMIZE_MEMORY */ - } - - event void UDPClient.sendDone(error_t result, void* buf) - { -#if defined(ENABLE_TEMP_SENSOR) || defined(ENABLE_LIGHT_SENSOR) - if (buf == sensor_buf) { - sensor_buf_busy = FALSE; - } -#endif /* ENABLE_TEMP_SENSOR | ENABLE_LIGHT_SENSOR */ - } - -#ifdef ENABLE_TEMP_SENSOR - event void TempSensorC.readDone(error_t result, uint16_t data) { - if (sensor_buf_busy == FALSE) { - sensor_buf_busy = TRUE; - if (result == SUCCESS) { - snprintf(sensor_buf, sizeof(sensor_buf), "temp: %d\n", data); - } else { - snprintf(sensor_buf, sizeof(sensor_buf), "temp: -\n"); - } - call UDPClient.sendTo(&sensor_addr, sensor_port, - sensor_buf, strlen(sensor_buf)); - } else { - call UDPClient.sendTo(&sensor_addr, sensor_port, - "busy\n", 5); - } - } -#endif /* ENABLE_TEMP_SENSOR */ - -#ifdef ENABLE_LIGHT_SENSOR - event void LightSensorC.readDone(error_t result, uint16_t data) { - if (sensor_buf_busy == FALSE) { - sensor_buf_busy = TRUE; - if (result == SUCCESS) { - snprintf(sensor_buf, sizeof(sensor_buf), "light: %d\n", data); - } else { - snprintf(sensor_buf, sizeof(sensor_buf), "light: -\n"); - } - call UDPClient.sendTo(&sensor_addr, sensor_port, - sensor_buf, strlen(sensor_buf)); - } else { - call UDPClient.sendTo(&sensor_addr, sensor_port, - "busy\n", 5); - } - } -#endif /* ENABLE_LIGHT_SENSOR */ -} diff --git a/apps/6lowpancli/Makefile b/apps/6lowpancli/Makefile deleted file mode 100644 index a4c380e4..00000000 --- a/apps/6lowpancli/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -COMPONENT=CliAppC - -CFLAGS += -I$(TOSDIR)/lib/printf -I$(TOSDIR)/lib/net/6lowpan -D'TOSH_DATA_LENGTH=102' - -# TelosB -# CFLAGS + = "-D'ENABLE_TELOSB_LIGHT_SENSOR=1' -D'ENABLE_TELOSB_TEMP_SENSOR=1'" - -# MicaZ with the mts300 sensorboard -# CFLAGS += "-D'ENABLE_MICAZ_LIGHT_SENSOR=1' -D'ENABLE_MICAZ_TEMP_SENSOR=1' -D'ENABLE_SOUNDER=1'" - - -include $(MAKERULES) diff --git a/apps/6lowpancli/README b/apps/6lowpancli/README deleted file mode 100644 index 0ccacf1d..00000000 --- a/apps/6lowpancli/README +++ /dev/null @@ -1,42 +0,0 @@ -6lowpan cli is a sample application using the 6lowpan stack. It -implements a cli listening on UDP port 1234 for commands and replying -with answers. - -Besides that, the mote answers to pings. - -The IPv6 addresses - * a global address with prefix 2001:0638:0709:1234::/64 - * a link-local address -are assigned using an interface identifier computed from the Active -Message address of the mote. This is almost like the stateless -autoconfiguration, but Duplicate Address Detection or Router -Solicitations are not implemented. - - -Note that you also need a BaseStation application and the serial_tun -daemon running. See tos/lib/net/6lowpan/REAME for more details. - - BUILDING -Debugging output with printf over USB can be enabled with - CFLAGS="-D'ENABLE_PRINTF_DEBUG=1' - -To minimize memory usage, i.e. disable everything (at the moment only -the UDP cli) to determine minimum RAM/ROM requirements, use - CFLAGS="-D'MINIMIZE_MEMORY=1' - - - TESTING -Assuming active message address (mote id) 20 (0x14): - -Small unfragmented ping - sudo ping6 -s 50 2001:638:709:1234::fffe:14 - -Large fragmented ping - sudo ping6 -s 1230 -i 3 2001:638:709:1234::fffe:14 - -Link-local all-nodes ping - sudo ping6 -s 20 ff02::01 - -UDP cli - nc6 -u 2001:638:709:1234::fffe:14 1234 -