Remove everything that depended on the now gone twitter APP.

This commit is contained in:
Mariano Alvira 2013-05-17 18:32:40 -04:00
parent c450887555
commit e24a50c1b2
9 changed files with 5 additions and 306 deletions

View File

@ -9,7 +9,7 @@ shell_src = shell.c shell-reboot.c \
shell-tcpsend.c shell-udpsend.c shell-ping.c shell-netstat.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-sendcmd.c shell-download.c shell-rime-neighbors.c \
shell-rime-unicast.c \ shell-rime-unicast.c \
shell-tweet.c shell-base64.c \ shell-base64.c \
shell-netperf.c shell-memdebug.c \ shell-netperf.c shell-memdebug.c \
shell-powertrace.c shell-collect-view.c shell-crc.c shell-powertrace.c shell-collect-view.c shell-crc.c
shell_dsc = shell-dsc.c shell_dsc = shell-dsc.c
@ -38,9 +38,6 @@ ifndef PLATFORM_BUILD
override telnet_src = telnet.c override telnet_src = telnet.c
endif endif
APPS += twitter
include $(CONTIKI)/apps/twitter/Makefile.twitter
APPS += powertrace APPS += powertrace
include $(CONTIKI)/apps/powertrace/Makefile.powertrace include $(CONTIKI)/apps/powertrace/Makefile.powertrace
@ -49,9 +46,9 @@ APPS += collect-view
include $(CONTIKI)/apps/collect-view/Makefile.collect-view include $(CONTIKI)/apps/collect-view/Makefile.collect-view
ifeq ($(TARGET),sky) ifeq ($(TARGET),sky)
shell_src += shell-sky.c shell-exec.c shell-sensortweet.c shell_src += shell-sky.c shell-exec.c
endif endif
ifeq ($(TARGET),z1) ifeq ($(TARGET),z1)
shell_src += shell-sky.c shell-exec.c shell-sensortweet.c shell_src += shell-sky.c shell-exec.c
endif endif

View File

@ -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 <adam@sics.se>
*/
#include "contiki.h"
#include "contiki-net.h"
#include "cfs/cfs.h"
#include "dev/sht11.h"
#include "shell.h"
#include "twitter.h"
#include <stdio.h>
#include <string.h>
#define MAX_USERNAME_PASSWORD 32
/*---------------------------------------------------------------------------*/
PROCESS(sensortweet_process, "sensortweet");
SHELL_COMMAND(sensortweet_command,
"sensortweet",
"sensortweet <username:password>: 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);
}
/*---------------------------------------------------------------------------*/

View File

@ -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 <adam@sics.se>
*/
#ifndef __SHELL_SENSORTWEET_H__
#define __SHELL_SENSORTWEET_H__
#include "shell.h"
void shell_sensortweet_init(void);
#endif /* __SHELL_SENSORTWEET_H__ */

View File

@ -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 <adam@sics.se>
*/
#include "contiki.h"
#include "contiki-net.h"
#include "cfs/cfs.h"
#include "shell.h"
#include "twitter.h"
#include <stdio.h>
#include <string.h>
#define MAX_USERNAME_PASSWORD 32
/*---------------------------------------------------------------------------*/
PROCESS(tweet_process, "tweet");
SHELL_COMMAND(tweet_command,
"tweet",
"tweet <username:password> <message>: 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);
}
/*---------------------------------------------------------------------------*/

View File

@ -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 <adam@sics.se>
*/
#ifndef __SHELL_TWEET_H__
#define __SHELL_TWEET_H__
#include "shell.h"
void shell_tweet_init(void);
#endif /* __SHELL_TWEET_H__ */

View File

@ -403,12 +403,10 @@ struct shell_input {
#include "shell-rsh.h" #include "shell-rsh.h"
#include "shell-run.h" #include "shell-run.h"
#include "shell-sendtest.h" #include "shell-sendtest.h"
#include "shell-sensortweet.h"
#include "shell-sky.h" #include "shell-sky.h"
#include "shell-tcpsend.h" #include "shell-tcpsend.h"
#include "shell-text.h" #include "shell-text.h"
#include "shell-time.h" #include "shell-time.h"
#include "shell-tweet.h"
#include "shell-udpsend.h" #include "shell-udpsend.h"
#include "shell-vars.h" #include "shell-vars.h"
#include "shell-wget.h" #include "shell-wget.h"

View File

@ -89,7 +89,6 @@ PROCESS_THREAD(example_shell_process, ev, data)
shell_udpsend_init(); shell_udpsend_init();
shell_vars_init(); shell_vars_init();
shell_wget_init(); shell_wget_init();
shell_tweet_init();
PROCESS_END(); PROCESS_END();
} }

View File

@ -1,7 +1,7 @@
CONTIKI_PROJECT = sky-webserver 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 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. CFLAGS = -DWITH_UIP=1 -I.
SMALL=1 SMALL=1
DEFINES=NETSTACK_CONF_RDC=cxmac_driver,NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE=8 DEFINES=NETSTACK_CONF_RDC=cxmac_driver,NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE=8

View File

@ -63,9 +63,6 @@ PROCESS_THREAD(sky_telnetd_process, ev, data)
shell_sky_init(); shell_sky_init();
shell_text_init(); shell_text_init();
shell_time_init(); shell_time_init();
shell_tweet_init();
shell_sensortweet_init();
while(1) { while(1) {
PROCESS_WAIT_EVENT(); PROCESS_WAIT_EVENT();