diff --git a/apps/shell/Makefile.shell b/apps/shell/Makefile.shell index 5b552a180..10ceec53a 100644 --- a/apps/shell/Makefile.shell +++ b/apps/shell/Makefile.shell @@ -9,7 +9,7 @@ shell_src = shell.c shell-reboot.c \ shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.c \ shell-rime-sendcmd.c shell-download.c shell-rime-neighbors.c \ shell-rime-unicast.c \ - shell-tweet.c shell-base64.c \ + shell-base64.c \ shell-netperf.c shell-memdebug.c \ shell-powertrace.c shell-collect-view.c shell-crc.c shell_dsc = shell-dsc.c @@ -38,9 +38,6 @@ ifndef PLATFORM_BUILD override telnet_src = telnet.c endif -APPS += twitter -include $(CONTIKI)/apps/twitter/Makefile.twitter - APPS += powertrace include $(CONTIKI)/apps/powertrace/Makefile.powertrace @@ -49,9 +46,9 @@ APPS += collect-view include $(CONTIKI)/apps/collect-view/Makefile.collect-view ifeq ($(TARGET),sky) - shell_src += shell-sky.c shell-exec.c shell-sensortweet.c + shell_src += shell-sky.c shell-exec.c endif ifeq ($(TARGET),z1) - shell_src += shell-sky.c shell-exec.c shell-sensortweet.c + shell_src += shell-sky.c shell-exec.c endif diff --git a/apps/shell/shell-sensortweet.c b/apps/shell/shell-sensortweet.c deleted file mode 100644 index 4cc539398..000000000 --- a/apps/shell/shell-sensortweet.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * All rights reserved. - * - * 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. - * - */ - -/** - * \file - * Shell command that posts sensor data to Twitter - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "cfs/cfs.h" -#include "dev/sht11.h" -#include "shell.h" -#include "twitter.h" - -#include -#include - -#define MAX_USERNAME_PASSWORD 32 - -/*---------------------------------------------------------------------------*/ -PROCESS(sensortweet_process, "sensortweet"); -SHELL_COMMAND(sensortweet_command, - "sensortweet", - "sensortweet : post sensor data to Twitter", - &sensortweet_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sensortweet_process, ev, data) -{ - char message[140]; - char username_password[MAX_USERNAME_PASSWORD]; - int temp; - uint16_t humidity; - uint16_t battery_indicator; - int humidity_converted; - PROCESS_BEGIN(); - - /* Open the username/password file. */ - if(data == NULL) { - PROCESS_EXIT(); - } - strncpy(username_password, data, MAX_USERNAME_PASSWORD); - /* username_password[len] = 0;*/ - - temp = sht11_temp(); - humidity = sht11_humidity(); - battery_indicator = sht11_sreg() & 0x40? 1: 0; - - humidity_converted = (int)(-4L + 405L * humidity / 10000L); - if(humidity_converted > 100) { - humidity_converted = 100; - } - if(humidity_converted < 0) { - humidity_converted = 0; - } - - if(!battery_indicator) { - snprintf(message, sizeof(message), "Contiki #sensortweet %d.%d: Temperature %d.%d C, humidity %d%%", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - (temp / 10 - 396) / 10, - (temp / 10 - 396) % 10, - humidity_converted); - } else { - snprintf(message, sizeof(message), "Contiki #sensortweet %d.%d: Battery low", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]); - } - - twitter_post((uint8_t *)username_password, message); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -shell_sensortweet_init(void) -{ - shell_register_command(&sensortweet_command); -} -/*---------------------------------------------------------------------------*/ diff --git a/apps/shell/shell-sensortweet.h b/apps/shell/shell-sensortweet.h deleted file mode 100644 index a907c3465..000000000 --- a/apps/shell/shell-sensortweet.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * All rights reserved. - * - * 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. - * - */ - -/** - * \file - * Header file for Contik shell command sensortweet - * \author - * Adam Dunkels - */ - -#ifndef __SHELL_SENSORTWEET_H__ -#define __SHELL_SENSORTWEET_H__ - -#include "shell.h" - -void shell_sensortweet_init(void); - -#endif /* __SHELL_SENSORTWEET_H__ */ diff --git a/apps/shell/shell-tweet.c b/apps/shell/shell-tweet.c deleted file mode 100644 index ca6f96a73..000000000 --- a/apps/shell/shell-tweet.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2009, Swedish Institute of Computer Science. - * All rights reserved. - * - * 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. - * - */ - -/** - * \file - * Post Twitter message through the Contiki shell - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "cfs/cfs.h" -#include "shell.h" -#include "twitter.h" - -#include -#include - -#define MAX_USERNAME_PASSWORD 32 - -/*---------------------------------------------------------------------------*/ -PROCESS(tweet_process, "tweet"); -SHELL_COMMAND(tweet_command, - "tweet", - "tweet : post message to Twitter", - &tweet_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tweet_process, ev, data) -{ - const char *message; - char username_password[MAX_USERNAME_PASSWORD]; - const char *next; - - PROCESS_BEGIN(); - - if(data == NULL) { - PROCESS_EXIT(); - } - next = strchr(data, ' '); - /* Make sure there is a message to post. */ - if(next == data) { - PROCESS_EXIT(); - } - message = next + 1; - - strncpy(username_password, data, next - (char *)data); - username_password[next - (char *)data] = 0; - - twitter_post((uint8_t *)username_password, message); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -shell_tweet_init(void) -{ - shell_register_command(&tweet_command); -} -/*---------------------------------------------------------------------------*/ diff --git a/apps/shell/shell-tweet.h b/apps/shell/shell-tweet.h deleted file mode 100644 index 4b73418dd..000000000 --- a/apps/shell/shell-tweet.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2008, Swedish Institute of Computer Science. - * All rights reserved. - * - * 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. - * - */ - -/** - * \file - * Header file for Contik shell command tweet - * \author - * Adam Dunkels - */ - -#ifndef __SHELL_TWEET_H__ -#define __SHELL_TWEET_H__ - -#include "shell.h" - -void shell_tweet_init(void); - -#endif /* __SHELL_TWEET_H__ */ diff --git a/apps/shell/shell.h b/apps/shell/shell.h index 684036020..7d955b303 100644 --- a/apps/shell/shell.h +++ b/apps/shell/shell.h @@ -403,12 +403,10 @@ struct shell_input { #include "shell-rsh.h" #include "shell-run.h" #include "shell-sendtest.h" -#include "shell-sensortweet.h" #include "shell-sky.h" #include "shell-tcpsend.h" #include "shell-text.h" #include "shell-time.h" -#include "shell-tweet.h" #include "shell-udpsend.h" #include "shell-vars.h" #include "shell-wget.h" diff --git a/examples/example-shell/example-shell.c b/examples/example-shell/example-shell.c index 55118e6a4..471d63282 100644 --- a/examples/example-shell/example-shell.c +++ b/examples/example-shell/example-shell.c @@ -89,7 +89,6 @@ PROCESS_THREAD(example_shell_process, ev, data) shell_udpsend_init(); shell_vars_init(); shell_wget_init(); - shell_tweet_init(); PROCESS_END(); } diff --git a/examples/sky-ip/Makefile b/examples/sky-ip/Makefile index cf6a8b004..1602cd120 100644 --- a/examples/sky-ip/Makefile +++ b/examples/sky-ip/Makefile @@ -1,7 +1,7 @@ CONTIKI_PROJECT = sky-webserver -all: sky-webserver sky-telnet-server telnet-tweet +all: sky-webserver sky-telnet-server telnet PLATFORM_BUILD=1 # This is needed to avoid the shell to include the httpd-cfs version of the webserver -APPS = webserver twitter telnetd +APPS = webserver telnetd CFLAGS = -DWITH_UIP=1 -I. SMALL=1 DEFINES=NETSTACK_CONF_RDC=cxmac_driver,NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE=8 diff --git a/examples/sky-ip/telnet-tweet.c b/examples/sky-ip/telnet.c similarity index 98% rename from examples/sky-ip/telnet-tweet.c rename to examples/sky-ip/telnet.c index b025e50c6..2154704b7 100644 --- a/examples/sky-ip/telnet-tweet.c +++ b/examples/sky-ip/telnet.c @@ -63,9 +63,6 @@ PROCESS_THREAD(sky_telnetd_process, ev, data) shell_sky_init(); shell_text_init(); shell_time_init(); - - shell_tweet_init(); - shell_sensortweet_init(); while(1) { PROCESS_WAIT_EVENT();