Index: rtos_arduino/trunk/examples/IotText/sample1/Makefile
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/Makefile	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/Makefile	(revision 254)
@@ -0,0 +1,71 @@
+#
+#  ã¿ã¼ã²ããã®æå®ï¼Makefile.targetã§ä¸æ¸ããããã®ãé²ãããï¼
+#
+all:
+
+#
+#  ã¢ããªã±ã¼ã·ã§ã³ãã¡ã¤ã«
+#
+APPL_CXXOBJS += rca_app.o
+APPL_COBJS   += 
+APPL_CFG      = rca_app.cfg
+
+#
+#  Serialã®æ±ã
+#   ARDUINO_SERIAL
+#    NOUSE_SERIAL
+#    USE_SERIAL
+#
+#ARDUINO_SERIAL = NOUSE_SERIAL
+ARDUINO_SERIAL = USE_SERIAL
+
+#
+#  ã©ã¤ãã©ãªã®ä½¿ç¨
+#  
+#USE_ARDUINO_SPI = true
+#USE_ARDUINO_NCESCAN = true
+#USE_ARDUINO_SD  = true
+#USE_ARDUINO_TFT = true
+#USE_ETHERNET2 = true
+#USE_NAXESMOTION = true
+USE_WIRE = true
+
+#
+#  RCAã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+RCA_DIR = ../../..
+
+#
+#  ASPã®ã½ã¼ã¹ãã¡ã¤ã«ã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+SRCDIR = $(RCA_DIR)/asp_1.9.2
+
+#
+#  ãã®ä»ã®ãªãã·ã§ã³
+#
+APPL_CFLAGS +=
+APPL_LIBS +=
+APPL_DIR     += 
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/ESP8266_Arudino_AT
+APPL_CXXOBJS += ESP8266.o
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/Adafruit
+APPL_CXXOBJS += aJSON.o Milkcocoa.o Adafruit_MQTT.o Adafruit_MQTT_Client.o
+APPL_COBJS   += stringbuffer.o 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/OLED_Display12864
+APPL_CXXOBJS += SeeedOLED.o
+APPL_COBJS   += 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/Grove_Digital_Light_Sensor
+APPL_CXXOBJS += Digital_Light_TSL2561.o
+APPL_COBJS   += 
+
+APPL_DIR     += ..
+
+include $(RCA_DIR)/lib/Makefile.rca
Index: rtos_arduino/trunk/examples/IotText/sample1/do_clean.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/do_clean.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/do_clean.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make clean
+pause
Index: rtos_arduino/trunk/examples/IotText/sample1/do_debug.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/do_debug.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/do_debug.bat	(revision 254)
@@ -0,0 +1,4 @@
+call ../../do_path.bat
+make ocd
+make db
+taskkill /F /IM openocd.exe
Index: rtos_arduino/trunk/examples/IotText/sample1/do_make.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/do_make.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/do_make.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make all
+pause
Index: rtos_arduino/trunk/examples/IotText/sample1/do_run.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/do_run.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/do_run.bat	(revision 254)
@@ -0,0 +1,2 @@
+call ../../do_path.bat
+make run
Index: rtos_arduino/trunk/examples/IotText/sample1/push_text.html
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/push_text.html	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/push_text.html	(revision 254)
@@ -0,0 +1,25 @@
+<html>
+	<head>
+		<title>Milkcocoa publish</title>
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+	</head>
+
+	<body>
+		<script src="http://cdn.mlkcca.com/v0.6.0/milkcocoa.js"></script>
+
+		<script type="text/javascript">
+			var milkcocoa = new MilkCocoa('leadirgzw0b7.mlkcca.com');
+			var ds = milkcocoa.dataStore('test');
+
+			function OnButtonClick() {
+				var str=document.frm.txt.value;
+				ds.push({'TEXT':str});
+			}
+		</script>
+
+		<form name="frm">
+			<input type="text" name="txt" value=""><br>
+			<input type="button" value="push" onclick="OnButtonClick();"><br>
+		</form>
+	</body>
+</html>
Index: rtos_arduino/trunk/examples/IotText/sample1/rca_app.cfg
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/rca_app.cfg	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/rca_app.cfg	(revision 254)
@@ -0,0 +1,6 @@
+/*
+ *  $Id: sample1.cfg 2416 2012-09-07 08:06:20Z ertl-hiro $
+ */
+
+INCLUDE("rca_lib.cfg");
+
Index: rtos_arduino/trunk/examples/IotText/sample1/rca_app.cpp
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/rca_app.cpp	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/rca_app.cpp	(revision 254)
@@ -0,0 +1,138 @@
+#include "rca.h"
+
+#include "ESP8266.h"
+#include "Milkcocoa.h"
+#include "Client_ESP8266.h"
+#include "../../examples_gdef.h"
+
+#include <Wire.h>
+#include <SeeedOLED.h>
+
+#define MILKCOCOA_SERVERPORT  1883
+
+ESP8266Client wifi_client;
+
+const char MQTT_SERVER[] PROGMEM	= MILKCOCOA_APP_ID ".mlkcca.com";
+const char MQTT_CLIENTID[] PROGMEM	= __TIME__ MILKCOCOA_APP_ID;
+
+Milkcocoa milkcocoa = Milkcocoa(&wifi_client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
+
+extern void onpush(DataElement *elem);
+
+void setup()
+{
+	int ret;
+
+	Serial.begin(115200);
+	Serial.print("Milkcocoa SDK demo");
+
+	// Connect to WiFi access point.
+	Serial.println(); Serial.println();
+	Serial.print("Connecting to ");
+	Serial.println(STA_SSID);
+
+	ret = WiFi.begin(Serial5, 115200);
+
+	if(ret == 1) {
+		Serial.print("Cannot communicate with ESP8266.");
+		while(1);
+	} else if(ret == 2) {
+		Serial.println("FW Version mismatch.");
+		Serial.print("FW Version:");
+		Serial.println(WiFi.getVersion().c_str());
+		Serial.print("Supported FW Version:");
+		Serial.println(ESP8266_SUPPORT_VERSION);
+		while(1);
+	} else {
+		Serial.print("begin ok\r\n");
+	}
+
+	Serial.print("FW Version:");
+	Serial.println(WiFi.getVersion().c_str());
+
+	if (WiFi.setOprToStation()) {
+		Serial.print("to station ok\r\n");
+	} else {
+		Serial.print("to station err\r\n");
+	}
+
+	if (WiFi.joinAP(STA_SSID, STA_PASSWORD)) {
+		Serial.print("Join AP success\r\n");
+		Serial.print("IP: ");
+		Serial.println(WiFi.getLocalIP().c_str());
+	} else {
+		Serial.print("Join AP failure\r\n");
+	}
+
+	if (WiFi.stopServer()) {
+		Serial.print("Stop server ok\r\n");
+	} else {
+		Serial.print("Stop server err\r\n");
+	}
+
+	if (WiFi.disableMUX()) {
+		Serial.print("single ok\r\n");
+	} else {
+		Serial.print("single err\r\n");
+	}
+
+	if (milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush)){
+//	if (milkcocoa.on(MILKCOCOA_DATASTORE, "send", onpush)){
+		Serial.println("milkcocoa on sucesss");
+	}
+	else {
+		Serial.println("milkcocoa on failure");
+	}
+
+	Wire.begin();
+	SeeedOled.init();
+
+	SeeedOled.clearDisplay();
+	SeeedOled.setNormalDisplay();
+	SeeedOled.setPageMode();
+	SeeedOled.setTextXY(0,0);
+	SeeedOled.putString("Hello World!");
+
+	Serial.println("setup end\r\n");
+}
+
+void loop()
+{
+	int8_t ret;
+	int8_t push_ret;
+
+	while((ret = milkcocoa.loop(1)) != 0) {
+		Serial.println("Milkcocoa.loop() connection error.");
+		Serial.println(milkcocoa.connectErrorString(ret));
+		Serial.println(ret);
+		Serial.println("Retrying MQTT connection in 5 seconds...");
+		delay(5000);
+	}
+	Serial.print(".");
+
+	if (Serial.available() > 0) {
+		Serial.read();
+		Serial.print("Pause  : Input any char to continue.\n\r");
+		while(!(Serial.available() > 0));
+		Serial.print("Resume.\n\r");
+		Serial.read();
+	}
+}
+
+void onpush(DataElement *pelem)
+{
+	char *data;
+	static int ln = 1;
+
+	if(!pelem->getString("TEXT", &data)) {
+		Serial.print("onpush : key TEXT is not found.");
+		return;
+	};
+
+	Serial.print("onpush : {TEXT, ");
+	Serial.write(data);
+	Serial.println("}.");
+
+	SeeedOled.setTextXY(ln++%7,0);
+	SeeedOled.putString(data);
+}
Index: rtos_arduino/trunk/examples/IotText/sample1/rca_app.h
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample1/rca_app.h	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample1/rca_app.h	(revision 254)
@@ -0,0 +1,14 @@
+#ifndef _RCA_APP_H_
+#define _RCA_APP_H_
+
+#define RCA_NUM_TASK 0
+
+/*
+ *  Use Serial3
+ */
+#define RCA_USE_SERIAL3
+
+#define RCA_ENABLE_PROFILING
+#define RCA_PROFILING_CYC_MS  1
+
+#endif /* _RCA_APP_H_ */
Index: rtos_arduino/trunk/examples/IotText/sample2/Makefile
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/Makefile	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/Makefile	(revision 254)
@@ -0,0 +1,71 @@
+#
+#  ã¿ã¼ã²ããã®æå®ï¼Makefile.targetã§ä¸æ¸ããããã®ãé²ãããï¼
+#
+all:
+
+#
+#  ã¢ããªã±ã¼ã·ã§ã³ãã¡ã¤ã«
+#
+APPL_CXXOBJS += rca_app.o
+APPL_COBJS   += 
+APPL_CFG      = rca_app.cfg
+
+#
+#  Serialã®æ±ã
+#   ARDUINO_SERIAL
+#    NOUSE_SERIAL
+#    USE_SERIAL
+#
+#ARDUINO_SERIAL = NOUSE_SERIAL
+ARDUINO_SERIAL = USE_SERIAL
+
+#
+#  ã©ã¤ãã©ãªã®ä½¿ç¨
+#  
+#USE_ARDUINO_SPI = true
+#USE_ARDUINO_NCESCAN = true
+#USE_ARDUINO_SD  = true
+#USE_ARDUINO_TFT = true
+#USE_ETHERNET2 = true
+#USE_NAXESMOTION = true
+USE_WIRE = true
+
+#
+#  RCAã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+RCA_DIR = ../../..
+
+#
+#  ASPã®ã½ã¼ã¹ãã¡ã¤ã«ã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+SRCDIR = $(RCA_DIR)/asp_1.9.2
+
+#
+#  ãã®ä»ã®ãªãã·ã§ã³
+#
+APPL_CFLAGS +=
+APPL_LIBS +=
+APPL_DIR     += 
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/ESP8266_Arudino_AT
+APPL_CXXOBJS += ESP8266.o
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/Adafruit
+APPL_CXXOBJS += aJSON.o Milkcocoa.o Adafruit_MQTT.o Adafruit_MQTT_Client.o
+APPL_COBJS   += stringbuffer.o 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/OLED_Display12864
+APPL_CXXOBJS += SeeedOLED.o
+APPL_COBJS   += 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/Grove_Digital_Light_Sensor
+APPL_CXXOBJS += Digital_Light_TSL2561.o
+APPL_COBJS   += 
+
+APPL_DIR     += ..
+
+include $(RCA_DIR)/lib/Makefile.rca
Index: rtos_arduino/trunk/examples/IotText/sample2/do_clean.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/do_clean.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/do_clean.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make clean
+pause
Index: rtos_arduino/trunk/examples/IotText/sample2/do_debug.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/do_debug.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/do_debug.bat	(revision 254)
@@ -0,0 +1,4 @@
+call ../../do_path.bat
+make ocd
+make db
+taskkill /F /IM openocd.exe
Index: rtos_arduino/trunk/examples/IotText/sample2/do_make.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/do_make.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/do_make.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make all
+pause
Index: rtos_arduino/trunk/examples/IotText/sample2/do_run.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/do_run.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/do_run.bat	(revision 254)
@@ -0,0 +1,2 @@
+call ../../do_path.bat
+make run
Index: rtos_arduino/trunk/examples/IotText/sample2/rca_app.cfg
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/rca_app.cfg	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/rca_app.cfg	(revision 254)
@@ -0,0 +1,6 @@
+/*
+ *  $Id: sample1.cfg 2416 2012-09-07 08:06:20Z ertl-hiro $
+ */
+
+INCLUDE("rca_lib.cfg");
+
Index: rtos_arduino/trunk/examples/IotText/sample2/rca_app.cpp
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/rca_app.cpp	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/rca_app.cpp	(revision 254)
@@ -0,0 +1,198 @@
+#include "rca.h"
+
+#include "ESP8266.h"
+#include "Milkcocoa.h"
+#include "Client_ESP8266.h"
+#include "../../examples_gdef.h"
+
+#define LED_RED 2
+#define TOUCH_SW 3
+
+#define MILKCOCOA_PUSH
+//#define MILKCOCOA_ON
+
+#define MILKCOCOA_SERVERPORT  1883
+
+ESP8266Client wifi_client;
+
+const char MQTT_SERVER[] PROGMEM	= MILKCOCOA_APP_ID ".mlkcca.com";
+const char MQTT_CLIENTID[] PROGMEM	= __TIME__ MILKCOCOA_APP_ID;
+
+Milkcocoa milkcocoa = Milkcocoa(&wifi_client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
+
+extern void onpush(DataElement *elem);
+
+void setup()
+{
+	int ret;
+
+	Serial.begin(115200);
+	Serial.print("Milkcocoa SDK demo");
+
+	// Connect to WiFi access point.
+	Serial.println(); Serial.println();
+	Serial.print("Connecting to ");
+	Serial.println(STA_SSID);
+
+	ret = WiFi.begin(Serial5, 115200);
+
+	if(ret == 1) {
+		Serial.print("Cannot communicate with ESP8266.");
+		while(1);
+	} else if(ret == 2) {
+		Serial.println("FW Version mismatch.");
+		Serial.print("FW Version:");
+		Serial.println(WiFi.getVersion().c_str());
+		Serial.print("Supported FW Version:");
+		Serial.println(ESP8266_SUPPORT_VERSION);
+		while(1);
+	} else {
+		Serial.print("begin ok\r\n");
+	}
+
+	Serial.print("FW Version:");
+	Serial.println(WiFi.getVersion().c_str());
+
+	if (WiFi.setOprToStation()) {
+		Serial.print("to station ok\r\n");
+	} else {
+		Serial.print("to station err\r\n");
+	}
+
+	if (WiFi.joinAP(STA_SSID, STA_PASSWORD)) {
+		Serial.print("Join AP success\r\n");
+		Serial.print("IP: ");
+		Serial.println(WiFi.getLocalIP().c_str());
+	} else {
+		Serial.print("Join AP failure\r\n");
+	}
+
+	if (WiFi.stopServer()) {
+		Serial.print("Stop server ok\r\n");
+	} else {
+		Serial.print("Stop server err\r\n");
+	}
+
+	if (WiFi.disableMUX()) {
+		Serial.print("single ok\r\n");
+	} else {
+		Serial.print("single err\r\n");
+	}
+
+#ifdef MILKCOCOA_ON
+	if (milkcocoa.on(MILKCOCOA_DATASTORE, "push", onpush)){
+//	if (milkcocoa.on(MILKCOCOA_DATASTORE, "send", onpush)){
+		Serial.println("milkcocoa on sucesss");
+	}
+	else {
+		Serial.println("milkcocoa on failure");
+	}
+
+	pinMode(LED_RED, OUTPUT);
+	digitalWrite(LED_RED, LOW);
+#endif /* MILKCOCOA_ON  */
+
+	pinMode(TOUCH_SW, INPUT);
+
+	Serial.println("setup end\r\n");
+}
+
+void loop()
+{
+#ifdef MILKCOCOA_ON
+	int8_t ret;
+
+	while((ret = milkcocoa.loop(1)) != 0) {
+		Serial.println("Milkcocoa.loop() connection error.");
+		Serial.println(milkcocoa.connectErrorString(ret));
+		Serial.println(ret);
+		Serial.println("Retrying MQTT connection in 5 seconds...");
+		delay(5000);
+	}
+	Serial.print(".");
+#endif /* MILKCOCOA_ON  */
+
+#ifdef MILKCOCOA_PUSH
+	int8_t push_ret;
+	int sw_push = 0;
+	static int sw_st = 1;
+
+	switch(sw_st)
+	{
+	case 0:
+		if(digitalRead(TOUCH_SW))
+		{
+			sw_push = 1;
+			sw_st = 1;
+		}
+		break;
+	default:
+		if(!digitalRead(TOUCH_SW))
+		{
+			sw_push = 1;
+			sw_st = 0;
+		}
+		break;
+	}
+
+	if(sw_push)
+	{
+		DataElement elem = DataElement();
+
+		if(sw_st) {
+			Serial.println("Push data to Milkcocoa : Key:LED, Value:ON");
+			elem.setValue("LED", "ON");
+		}else {
+			Serial.println("Push data to Milkcocoa : Key:LED, Value:OFF");
+			elem.setValue("LED", "OFF");
+		}
+
+		do {
+			push_ret = milkcocoa.push(MILKCOCOA_DATASTORE, &elem);
+			if (push_ret != 0) {
+				Serial.println("Milkcocoa.push() error.");
+				Serial.println(milkcocoa.pushErrorString(push_ret));
+				Serial.println(push_ret);
+				Serial.println("Retrying MQTT push in 5 seconds...");
+				delay(5000);
+			}
+		}while(push_ret != 0);
+
+		Serial.println("Push success.");
+	}
+#endif /* MILKCOCOA_PUSH */
+
+	if (Serial.available() > 0) {
+		Serial.read();
+		Serial.print("Pause  : Input any char to continue.\n\r");
+		while(!(Serial.available() > 0));
+		Serial.print("Resume.\n\r");
+		Serial.read();
+	}
+}
+
+#ifdef MILKCOCOA_ON
+void onpush(DataElement *pelem)
+{
+	char *data;
+	static int ln = 0;
+
+	if(!pelem->getString("LED", &data)) {
+		Serial.print("onpush : key LED is not found.");
+		return;
+	};
+
+	Serial.print("onpush : {LED, ");
+	Serial.write(data);
+	Serial.println("}.");
+
+	if (strcmp(data, "ON") == 0) {
+		Serial.println("LED : ON!");
+		digitalWrite(LED_RED, HIGH);
+	}
+	else if(strcmp(data, "OFF") == 0) {
+		Serial.println("LED : OFF!");
+		digitalWrite(LED_RED, LOW);
+	}
+}
+#endif /* MILKCOCOA_ON */
Index: rtos_arduino/trunk/examples/IotText/sample2/rca_app.h
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample2/rca_app.h	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample2/rca_app.h	(revision 254)
@@ -0,0 +1,14 @@
+#ifndef _RCA_APP_H_
+#define _RCA_APP_H_
+
+#define RCA_NUM_TASK 0
+
+/*
+ *  Use Serial3
+ */
+#define RCA_USE_SERIAL3
+
+#define RCA_ENABLE_PROFILING
+#define RCA_PROFILING_CYC_MS  1
+
+#endif /* _RCA_APP_H_ */
Index: rtos_arduino/trunk/examples/IotText/sample3/Makefile
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/Makefile	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/Makefile	(revision 254)
@@ -0,0 +1,71 @@
+#
+#  ã¿ã¼ã²ããã®æå®ï¼Makefile.targetã§ä¸æ¸ããããã®ãé²ãããï¼
+#
+all:
+
+#
+#  ã¢ããªã±ã¼ã·ã§ã³ãã¡ã¤ã«
+#
+APPL_CXXOBJS += rca_app.o
+APPL_COBJS   += 
+APPL_CFG      = rca_app.cfg
+
+#
+#  Serialã®æ±ã
+#   ARDUINO_SERIAL
+#    NOUSE_SERIAL
+#    USE_SERIAL
+#
+#ARDUINO_SERIAL = NOUSE_SERIAL
+ARDUINO_SERIAL = USE_SERIAL
+
+#
+#  ã©ã¤ãã©ãªã®ä½¿ç¨
+#  
+#USE_ARDUINO_SPI = true
+#USE_ARDUINO_NCESCAN = true
+#USE_ARDUINO_SD  = true
+#USE_ARDUINO_TFT = true
+#USE_ETHERNET2 = true
+#USE_NAXESMOTION = true
+USE_WIRE = true
+
+#
+#  RCAã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+RCA_DIR = ../../..
+
+#
+#  ASPã®ã½ã¼ã¹ãã¡ã¤ã«ã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+SRCDIR = $(RCA_DIR)/asp_1.9.2
+
+#
+#  ãã®ä»ã®ãªãã·ã§ã³
+#
+APPL_CFLAGS +=
+APPL_LIBS +=
+APPL_DIR     += 
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/ESP8266_Arudino_AT
+APPL_CXXOBJS += ESP8266.o
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/Adafruit
+APPL_CXXOBJS += aJSON.o Milkcocoa.o Adafruit_MQTT.o Adafruit_MQTT_Client.o
+APPL_COBJS   += stringbuffer.o 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/OLED_Display12864
+APPL_CXXOBJS += SeeedOLED.o
+APPL_COBJS   += 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/Grove_Digital_Light_Sensor
+APPL_CXXOBJS += Digital_Light_TSL2561.o
+APPL_COBJS   += 
+
+APPL_DIR     += ..
+
+include $(RCA_DIR)/lib/Makefile.rca
Index: rtos_arduino/trunk/examples/IotText/sample3/chart.js
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/chart.js	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/chart.js	(revision 254)
@@ -0,0 +1,152 @@
+(function(global){
+
+  global.createChart = createChart;
+
+  function createChart() {
+     this.datas = [];
+   }
+
+  // datastoreã®ãã¼ã¿ããæç»ç¨ã®ãã¼ã¿ã«å¤æãã
+  function get_graph_data(data){
+    return data.map(function(d) {
+      return {
+        date : new Date(d.timestamp),
+        value : d.value
+      };
+    });
+  }
+
+  // ã°ã©ããæç»ããdivã®idãæå®ãã
+  createChart.prototype.setSvg = function(wrapper_id) {
+    this.wrapper_id =  wrapper_id || 'svg-chart';
+  }
+
+  // æç»ãããã¼ã¿ãã»ããï¼æ´æ°
+  createChart.prototype.setDatas = function(datas) {
+    this.datas = datas;
+  }
+
+  // åæå
+  createChart.prototype.init = function() {
+
+    // æç»ç¯å²ã«é¢ããå¤æ°
+    var margin = {top: 20, right: 20, bottom: 30, left: 50},
+        width = 1040 - margin.left - margin.right,
+        height = 420 - margin.top - margin.bottom;
+
+    // xè»¸ã®ã¹ã±ã¼ã«ï¼æéï¼ãã¬ã³ã¸(åºåç¯å²)ã®æå®
+    var xScale = d3.time.scale()
+                  .range([0, width]);
+
+    // yè»¸ã®ã¹ã±ã¼ã«ï¼ã»ã³ãµã¼ãã¼ã¿ã®å¤ï¼ãã¬ã³ã¸(åºåç¯å²)ã®æå®
+    var yScale = d3.scale.linear()
+                  .range([height, 0]);
+
+    // ã¹ã±ã¼ã«ãå
+ã«xè»¸ã®è¨­å®ï¼å
+¥åå¤ã®ç¯å²ã¯ã¾ã æå®ãã¦ããªãããã¼ã¿ãåãåã£ã¦ããæå®ããï¼
+    var xAxis = d3.svg.axis()
+                .scale(xScale)
+                .orient("bottom");
+
+    // ã¹ã±ã¼ã«ãå
+ã«yè»¸ã®è¨­å®
+    var yAxis = d3.svg.axis()
+                .scale(yScale)
+                .orient("left");
+
+    // SVGè¦ç´ ã®ä½æï¼attrã¨ãã¯ãã³ãã¬ï¼
+    var svg = d3.select("#" + this.wrapper_id).append("svg")
+              .attr("class", "chart")
+              .attr("width", width + margin.left + margin.right)
+              .attr("height", height + margin.top + margin.bottom)
+            .append("g")
+              .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+    // æãç·ã°ã©ãã®è¨­å®ãxã«æéãyã«ã»ã³ãµã¼ãã¼ã¿ã®å¤ãè¨­å®ã
+    var line = d3.svg.line()
+                .x(function(d) {
+                  // xã¹ã±ã¼ã«ã§ããããããæéãè¿ã
+                  return xScale(d.date);
+                })
+                .y(function(d) {
+                  // yã¹ã±ã¼ã«ã§ããããããã»ã³ãµã¼ãã¼ã¿ã®å¤ãè¿ã
+                  return yScale(d.value);
+                });
+
+
+    // ãããããã¡ã³ãå¤æ°ã«
+    this.height = height;
+    this.margin = margin;
+    this.width = width;
+    this.xScale = xScale;
+    this.yScale = yScale;
+    this.xAxis = xAxis;
+    this.yAxis = yAxis;
+    this.svg = svg;
+    this.line = line;
+  }
+
+
+  // æåã®æç»
+  createChart.prototype.initialDraw = function() {
+
+    var dataset = get_graph_data(this.datas);
+
+    // ãã¡ã¤ã³ï¼å
+¥åå¤ã®ç¯å²ï¼ã®è¨­å®ãextentã¡ã½ããã§datasetã®æå°ã¨æå¤§ãè¿ã
+    this.xScale.domain(d3.extent(dataset, function(d) { return d.date; }));
+    this.yScale.domain(d3.extent(dataset, function(d) { return d.value; }));
+
+    // xè»¸ã®æç»
+    this.svg.append("g")
+            .attr("class", "x axis")
+            .attr("transform", "translate(0," + this.height + ")")
+            .call(this.xAxis);
+
+    // yè»¸ã®æç»
+    this.svg.append("g")
+            .attr("class", "y axis")
+            .call(this.yAxis)
+          .append("text")
+            .attr("transform", "rotate(-90)")
+            .attr("y", 6)
+            .attr("dy", ".71em")
+            .style("text-anchor", "end")
+            .text("Value");
+
+    // æãç·ã®æç»
+    this.svg.append("path")
+            .datum(dataset)
+            .attr("class", "line")
+            .attr("d", this.line);
+  }
+
+
+  // æ´æ°ããéã®æç»
+  createChart.prototype.updateDraw = function() {
+
+    var dataset = get_graph_data(this.datas);
+
+    // ãã¡ã¤ã³ï¼å
+¥åå¤ã®ç¯å²ï¼ã®æ´æ°
+    this.xScale.domain(d3.extent(dataset, function(d) { return d.date; }));
+    this.yScale.domain(d3.extent(dataset, function(d) { return d.value; }));
+
+    // ã¢ãã¡ã¼ã·ã§ã³ãã¾ãããã¨ããå®£è¨
+    this.svg = d3.select("#" + this.wrapper_id).transition();
+
+    this.svg.select(".line")   // æãç·ã
+        .duration(750) // 750msã§
+        .attr("d", this.line(dataset)); // ï¼æ°ããï¼datasetã«å¤åãããæç»ãã¢ãã¡ã¼ã·ã§ã³
+
+    this.svg.select(".x.axis") // xè»¸ã
+        .duration(750) // 750msã§
+        .call(this.xAxis); // ï¼domainã®å¤æ´ã«ãã£ã¦å¤åããï¼xAxisã«å¤åãããæç»ãã¢ãã¡ã¼ã·ã§ã³
+
+    this.svg.select(".y.axis") // yè»¸ã
+        .duration(750) // 750msã§
+        .call(this.yAxis); // ï¼domainã®å¤æ´ã«ãã£ã¦å¤åããï¼yAxisã«å¤åãããæç»ãã¢ãã¡ã¼ã·ã§ã³
+  }
+
+}(window))
Index: rtos_arduino/trunk/examples/IotText/sample3/do_clean.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/do_clean.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/do_clean.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make clean
+pause
Index: rtos_arduino/trunk/examples/IotText/sample3/do_debug.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/do_debug.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/do_debug.bat	(revision 254)
@@ -0,0 +1,4 @@
+call ../../do_path.bat
+make ocd
+make db
+taskkill /F /IM openocd.exe
Index: rtos_arduino/trunk/examples/IotText/sample3/do_make.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/do_make.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/do_make.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make all
+pause
Index: rtos_arduino/trunk/examples/IotText/sample3/do_run.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/do_run.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/do_run.bat	(revision 254)
@@ -0,0 +1,2 @@
+call ../../do_path.bat
+make run
Index: rtos_arduino/trunk/examples/IotText/sample3/index.html
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/index.html	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/index.html	(revision 254)
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html lang="ja">
+<head>
+<meta charset="UTF-8">
+<title>GROVE Light Sensor</title>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.js"></script>
+<script src="http://cdn.mlkcca.com/v0.6.0/milkcocoa.js"></script>
+<script src="chart.js"></script>
+<script>
+window.addEventListener('load', function () {
+
+  var milkcocoa = new MilkCocoa("leadirgzw0b7.mlkcca.com");
+  var datastore = [];
+
+  var chart = new createChart();
+      chart.setSvg("svgchart");
+      chart.init();
+
+  milkcocoa.dataStore('test').stream().size(100).next(function(err, datas) {
+    datastore = datas.map(function(d) {
+      return {
+        timestamp : d.timestamp,
+        value : d.value.LUX
+      }
+    });
+
+    chart.setDatas(datastore);
+    chart.initialDraw();
+  });
+
+  milkcocoa.dataStore('test').on('push', function(pushed) {
+    datastore.push({
+      timestamp : pushed.timestamp,
+      value : pushed.value.LUX
+    });
+    datastore.shift();
+
+    chart.setDatas(datastore);
+    chart.updateDraw();
+  });
+
+});
+</script>
+
+<style>
+html, body{
+  background-color: #222;
+}
+.chart {
+  width: 1040px;
+  height: 420px;
+}
+.domain{
+  stroke-width: 1px;
+  stroke: #f2f2ff;
+}
+text{
+  font-size: 11px;
+  fill: #efefef;
+}
+path{
+  fill: none;
+  stroke: #FFF5C9;
+}
+
+	</style>
+</head>
+<body>
+	<p style="text-align: center; color: #fff; font-size: 13px;"><A href="http://blog.mlkcca.com/iot/realtime-data-visualization-with-raspberry-pi-3/" target="_blank">ã°ã©ãè¡¨ç¤ºã®ãµã³ãã«</A></p>
+	<div id="svgchart" style="margin: 0 auto; width: 1040px;"></div>
+</body>
+</html>
Index: rtos_arduino/trunk/examples/IotText/sample3/rca_app.cfg
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/rca_app.cfg	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/rca_app.cfg	(revision 254)
@@ -0,0 +1,6 @@
+/*
+ *  $Id: sample1.cfg 2416 2012-09-07 08:06:20Z ertl-hiro $
+ */
+
+INCLUDE("rca_lib.cfg");
+
Index: rtos_arduino/trunk/examples/IotText/sample3/rca_app.cpp
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/rca_app.cpp	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/rca_app.cpp	(revision 254)
@@ -0,0 +1,118 @@
+#include "rca.h"
+
+#include "ESP8266.h"
+#include "Milkcocoa.h"
+#include "Client_ESP8266.h"
+#include "../../examples_gdef.h"
+
+#include <Wire.h>
+#include <Digital_Light_TSL2561.h>
+
+#define MILKCOCOA_SERVERPORT  1883
+
+ESP8266Client wifi_client;
+
+const char MQTT_SERVER[] PROGMEM	= MILKCOCOA_APP_ID ".mlkcca.com";
+const char MQTT_CLIENTID[] PROGMEM	= __TIME__ MILKCOCOA_APP_ID;
+
+Milkcocoa milkcocoa = Milkcocoa(&wifi_client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MILKCOCOA_APP_ID, MQTT_CLIENTID);
+
+extern void onpush(DataElement *elem);
+
+void setup()
+{
+	int ret;
+
+	Serial.begin(115200);
+	Serial.print("Milkcocoa SDK demo");
+
+	// Connect to WiFi access point.
+	Serial.println(); Serial.println();
+	Serial.print("Connecting to ");
+	Serial.println(STA_SSID);
+
+	ret = WiFi.begin(Serial5, 115200);
+
+	if(ret == 1) {
+		Serial.print("Cannot communicate with ESP8266.");
+		while(1);
+	} else if(ret == 2) {
+		Serial.println("FW Version mismatch.");
+		Serial.print("FW Version:");
+		Serial.println(WiFi.getVersion().c_str());
+		Serial.print("Supported FW Version:");
+		Serial.println(ESP8266_SUPPORT_VERSION);
+		while(1);
+	} else {
+		Serial.print("begin ok\r\n");
+	}
+
+	Serial.print("FW Version:");
+	Serial.println(WiFi.getVersion().c_str());
+
+	if (WiFi.setOprToStation()) {
+		Serial.print("to station ok\r\n");
+	} else {
+		Serial.print("to station err\r\n");
+	}
+
+	if (WiFi.joinAP(STA_SSID, STA_PASSWORD)) {
+		Serial.print("Join AP success\r\n");
+		Serial.print("IP: ");
+		Serial.println(WiFi.getLocalIP().c_str());
+	} else {
+		Serial.print("Join AP failure\r\n");
+	}
+
+	if (WiFi.stopServer()) {
+		Serial.print("Stop server ok\r\n");
+	} else {
+		Serial.print("Stop server err\r\n");
+	}
+
+	if (WiFi.disableMUX()) {
+		Serial.print("single ok\r\n");
+	} else {
+		Serial.print("single err\r\n");
+	}
+
+	Wire.begin();
+	TSL2561.init();
+
+	Serial.println("setup end\r\n");
+}
+
+void loop()
+{
+	int8_t ret;
+	int8_t push_ret;
+
+	DataElement elem = DataElement();
+
+	Serial.print("Push data to Milkcocoa : Key:LUX, Value:");
+	int lux = (int)TSL2561.readVisibleLux();
+	Serial.println(lux);
+	elem.setValue("LUX", lux);
+
+	do {
+		push_ret = milkcocoa.push(MILKCOCOA_DATASTORE, &elem);
+		if (push_ret != 0) {
+			Serial.println("Milkcocoa.push() error.");
+			Serial.println(milkcocoa.pushErrorString(push_ret));
+			Serial.println(push_ret);
+			Serial.println("Retrying MQTT push in 5 seconds...");
+			delay(5000);
+		}
+	}while(push_ret != 0);
+
+	Serial.println("Push success.");
+	delay(2000);
+
+	if (Serial.available() > 0) {
+		Serial.read();
+		Serial.print("Pause  : Input any char to continue.\n\r");
+		while(!(Serial.available() > 0));
+		Serial.print("Resume.\n\r");
+		Serial.read();
+	}
+}
Index: rtos_arduino/trunk/examples/IotText/sample3/rca_app.h
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample3/rca_app.h	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample3/rca_app.h	(revision 254)
@@ -0,0 +1,14 @@
+#ifndef _RCA_APP_H_
+#define _RCA_APP_H_
+
+#define RCA_NUM_TASK 0
+
+/*
+ *  Use Serial3
+ */
+#define RCA_USE_SERIAL3
+
+#define RCA_ENABLE_PROFILING
+#define RCA_PROFILING_CYC_MS  1
+
+#endif /* _RCA_APP_H_ */
Index: rtos_arduino/trunk/examples/IotText/sample4/Makefile
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/Makefile	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/Makefile	(revision 254)
@@ -0,0 +1,71 @@
+#
+#  ã¿ã¼ã²ããã®æå®ï¼Makefile.targetã§ä¸æ¸ããããã®ãé²ãããï¼
+#
+all:
+
+#
+#  ã¢ããªã±ã¼ã·ã§ã³ãã¡ã¤ã«
+#
+APPL_CXXOBJS += rca_app.o
+APPL_COBJS   += 
+APPL_CFG      = rca_app.cfg
+
+#
+#  Serialã®æ±ã
+#   ARDUINO_SERIAL
+#    NOUSE_SERIAL
+#    USE_SERIAL
+#
+#ARDUINO_SERIAL = NOUSE_SERIAL
+ARDUINO_SERIAL = USE_SERIAL
+
+#
+#  ã©ã¤ãã©ãªã®ä½¿ç¨
+#  
+#USE_ARDUINO_SPI = true
+#USE_ARDUINO_NCESCAN = true
+#USE_ARDUINO_SD  = true
+#USE_ARDUINO_TFT = true
+#USE_ETHERNET2 = true
+#USE_NAXESMOTION = true
+USE_WIRE = true
+
+#
+#  RCAã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+RCA_DIR = ../../..
+
+#
+#  ASPã®ã½ã¼ã¹ãã¡ã¤ã«ã®ãã£ã¬ã¯ããªã®å®ç¾©
+#
+SRCDIR = $(RCA_DIR)/asp_1.9.2
+
+#
+#  ãã®ä»ã®ãªãã·ã§ã³
+#
+APPL_CFLAGS +=
+APPL_LIBS +=
+APPL_DIR     += 
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/ESP8266_Arudino_AT
+APPL_CXXOBJS += ESP8266.o
+
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/aJson
+APPL_DIR     += $(RCA_DIR)/arduino_lib/libraries/Milkcocoa_Arduino_SDK/include/Adafruit
+APPL_CXXOBJS += aJSON.o Milkcocoa.o Adafruit_MQTT.o Adafruit_MQTT_Client.o
+APPL_COBJS   += stringbuffer.o 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/OLED_Display12864
+APPL_CXXOBJS += SeeedOLED.o
+APPL_COBJS   += 
+
+APPL_DIR     += $(RCA_DIR)/examples/MultiTaskText/libraries/Grove_Digital_Light_Sensor
+APPL_CXXOBJS += Digital_Light_TSL2561.o
+APPL_COBJS   += 
+
+APPL_DIR     += ..
+
+include $(RCA_DIR)/lib/Makefile.rca
Index: rtos_arduino/trunk/examples/IotText/sample4/do_clean.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/do_clean.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/do_clean.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make clean
+pause
Index: rtos_arduino/trunk/examples/IotText/sample4/do_debug.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/do_debug.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/do_debug.bat	(revision 254)
@@ -0,0 +1,4 @@
+call ../../do_path.bat
+make ocd
+make db
+taskkill /F /IM openocd.exe
Index: rtos_arduino/trunk/examples/IotText/sample4/do_make.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/do_make.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/do_make.bat	(revision 254)
@@ -0,0 +1,3 @@
+call ../../do_path.bat
+make all
+pause
Index: rtos_arduino/trunk/examples/IotText/sample4/do_run.bat
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/do_run.bat	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/do_run.bat	(revision 254)
@@ -0,0 +1,2 @@
+call ../../do_path.bat
+make run
Index: rtos_arduino/trunk/examples/IotText/sample4/rca_app.cfg
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/rca_app.cfg	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/rca_app.cfg	(revision 254)
@@ -0,0 +1,6 @@
+/*
+ *  $Id: sample1.cfg 2416 2012-09-07 08:06:20Z ertl-hiro $
+ */
+
+INCLUDE("rca_lib.cfg");
+
Index: rtos_arduino/trunk/examples/IotText/sample4/rca_app.cpp
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/rca_app.cpp	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/rca_app.cpp	(revision 254)
@@ -0,0 +1,141 @@
+#include "rca.h"
+
+#include "ESP8266.h"
+#include "../../examples_gdef.h"
+
+#define IFTTT_KEY	"h3VxLLschaMLhQrbKJ3fvN-3sdBFFxITDumQObU-iSr"
+#define EVENT_NAME	"maker2email"
+
+#define HOST_NAME	"maker.ifttt.com"
+#define HOST_PORT	(80)
+
+#define WiFi wifi
+#define LED_RED 2
+#define TOUCH_SW 3
+
+ESP8266 WiFi;
+
+void setup()
+{
+	int ret;
+
+	Serial.begin(115200);
+	Serial.print("IFTTT demo");
+
+	// Connect to WiFi access point.
+	Serial.println(); Serial.println();
+	Serial.print("Connecting to ");
+	Serial.println(STA_SSID);
+
+	ret = WiFi.begin(Serial5, 115200);
+
+	if(ret == 1) {
+		Serial.print("Cannot communicate with ESP8266.");
+		while(1);
+	} else if(ret == 2) {
+		Serial.println("FW Version mismatch.");
+		Serial.print("FW Version:");
+		Serial.println(WiFi.getVersion().c_str());
+		Serial.print("Supported FW Version:");
+		Serial.println(ESP8266_SUPPORT_VERSION);
+		while(1);
+	} else {
+		Serial.print("begin ok\r\n");
+	}
+
+	Serial.print("FW Version:");
+	Serial.println(WiFi.getVersion().c_str());
+
+	if (WiFi.setOprToStation()) {
+		Serial.print("to station ok\r\n");
+	} else {
+		Serial.print("to station err\r\n");
+	}
+
+	if (WiFi.joinAP(STA_SSID, STA_PASSWORD)) {
+		Serial.print("Join AP success\r\n");
+		Serial.print("IP: ");
+		Serial.println(WiFi.getLocalIP().c_str());
+	} else {
+		Serial.print("Join AP failure\r\n");
+	}
+
+	if (WiFi.stopServer()) {
+		Serial.print("Stop server ok\r\n");
+	} else {
+		Serial.print("Stop server err\r\n");
+	}
+
+	if (WiFi.disableMUX()) {
+		Serial.print("single ok\r\n");
+	} else {
+		Serial.print("single err\r\n");
+	}
+
+	Serial.println("setup end\r\n");
+}
+
+void loop()
+{
+	static int value1 = 0, value2 = 1, value3 = 2;
+	int sw_push = 0;
+	static int sw_st = 1;
+
+	switch(sw_st)
+	{
+	case 0:
+		if(digitalRead(TOUCH_SW))
+		{
+			sw_push = 1;
+			sw_st = 1;
+		}
+		break;
+	default:
+		if(!digitalRead(TOUCH_SW))
+		{
+			sw_st = 0;
+		}
+		break;
+	}
+
+	if(sw_push)
+	{
+		value1++;
+		value2++;
+		value3++;
+
+		if (WiFi.createTCP(HOST_NAME, HOST_PORT)) {
+			Serial.println("create tcp ok");
+		} else {
+			Serial.println("create tcp err");
+		}
+
+		char buffer[1024];
+		const char request1[] = "GET /trigger/" EVENT_NAME "/with/key/" IFTTT_KEY "/";
+		const char request2[] = " HTTP/1.1\r\nHost: " HOST_NAME "\r\nConnection: close\r\n\r\n";
+
+		sprintf(buffer, "%s?value1=%d&value2=%d&value3=%d%s", request1, value1, value2, value3, request2);
+
+#if 0
+		Serial.print(buffer);
+#endif
+		WiFi.send((const uint8_t*)buffer, strlen(buffer));
+
+		uint32_t len = WiFi.recv((uint8_t*)buffer, sizeof(buffer), 10000);
+		if (len > 0) {
+#if 0
+			Serial.print("Received:[");
+			for(uint32_t i = 0; i < len; i++) {
+				Serial.print((char)buffer[i]);
+			}
+			Serial.println("]");
+#endif
+		}
+
+		if (WiFi.releaseTCP()) {
+			Serial.println("release tcp ok");
+		} else {
+			Serial.println("release tcp err");
+		}
+	}
+}
Index: rtos_arduino/trunk/examples/IotText/sample4/rca_app.h
===================================================================
--- rtos_arduino/trunk/examples/IotText/sample4/rca_app.h	(revision 254)
+++ rtos_arduino/trunk/examples/IotText/sample4/rca_app.h	(revision 254)
@@ -0,0 +1,14 @@
+#ifndef _RCA_APP_H_
+#define _RCA_APP_H_
+
+#define RCA_NUM_TASK 0
+
+/*
+ *  Use Serial3
+ */
+#define RCA_USE_SERIAL3
+
+#define RCA_ENABLE_PROFILING
+#define RCA_PROFILING_CYC_MS  1
+
+#endif /* _RCA_APP_H_ */
