• R/O
  • SSH

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Tunnel(Serial To IEEE1888)


Commit MetaInfo

Revisionbdeb249a4f0b06614cd271f0309f2685a06fbda6 (tree)
Time2015-07-15 19:36:48
AuthorMirrgieRiana Kurilab
CommiterMirrgieRiana Kurilab

Log Message

libraries: FIAPUploadAgentを更新

Change Summary

Incremental Difference

diff -r 7185f830130d -r bdeb249a4f0b libraries/FIAPUploadAgent/FIAPUploadAgent.cpp
--- a/libraries/FIAPUploadAgent/FIAPUploadAgent.cpp Tue Jul 14 15:34:05 2015 +0900
+++ b/libraries/FIAPUploadAgent/FIAPUploadAgent.cpp Wed Jul 15 19:36:48 2015 +0900
@@ -12,6 +12,10 @@
1212 #include <avr/pgmspace.h> // Retrieve Strings from the Program Memory
1313 #include "FIAPUploadAgent.h"
1414
15+//#define print(x) print(x);Serial.print(x);
16+//#define println(x) println(x);Serial.println(x);
17+
18+#define prog_char const char
1519 // void void FIAPUploadAgent::begin( ... );
1620 // Initialize the FIAPUploadAgent instance
1721 // with specifying server information and PointSetID (=PointID prefix)
@@ -19,12 +23,12 @@
1923 const char* server_host,
2024 const char* server_path,
2125 unsigned short server_port,
22- const char* fiap_id_prefix){
26+ const char* fiap_id_prefix){
2327
2428 this->server_host=server_host;
2529 this->server_path=server_path;
2630 this->server_port=server_port;
27- this->fiap_id_prefix=fiap_id_prefix;
31+ this->fiap_id_prefix=fiap_id_prefix;
2832 }
2933
3034 // Messages (Stored in the program memory) -- HTTP Header Part
@@ -88,7 +92,8 @@
8892 // コンテンツサイズ計算
8993 v0 = v;
9094 clen = 351; // sum of literal strings
91- clen += strlen(fiap_id_prefix);
95+ clen -= 31;
96+// clen += strlen(fiap_id_prefix);
9297 for (count = 0; count < esize; count++) {
9398 clen += strlen(fiap_id_prefix);
9499 clen += strlen(v0->cid);
@@ -97,6 +102,14 @@
97102 v0++;
98103 } // Serial.print("len="); Serial.println(clen);
99104
105+ // コンテンツサイズ修正
106+ clen -=2;
107+ clen += esize;
108+
109+ // NECサーバー用
110+ // fiap_id_prefixには最後にスラッシュを指定しない
111+ clen += esize;
112+
100113 // sending message buffer
101114 char sbuf[55];
102115
@@ -137,16 +150,16 @@
137150 client.println(sbuf); // "<body>"
138151
139152
140- strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY08);
141- client.print(sbuf); // "<pointSet id=\""
142- client.print(fiap_id_prefix);
143- strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY09);
144- client.println(sbuf); // "\">"
153+// strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY08);
154+// client.print(sbuf); // "<pointSet id=\""
155+// client.print(fiap_id_prefix);
156+// strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY09);
157+// client.println(sbuf); // "\">"
145158 v0=v;
146159 for (count = 0; count < esize; count++) {
147160 strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY10);
148161 client.print(sbuf); // "<point id=\""
149- client.print(fiap_id_prefix); client.print(v0->cid);
162+ client.print(fiap_id_prefix); client.print("/"); client.print(v0->cid);
150163 strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY11);
151164 client.println(sbuf); // "\">"
152165
@@ -164,8 +177,8 @@
164177 client.println(sbuf); // "</point>"
165178 v0++;
166179 }
167- strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY16);
168- client.println(sbuf); // "</pointSet>"
180+// strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY16);
181+// client.println(sbuf); // "</pointSet>"
169182 strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY17);
170183 client.println(sbuf); // "</body>"
171184 strcpy_P(sbuf,FIAPUploadAgent_Post_HTTPBODY18);
@@ -180,12 +193,11 @@
180193
181194 // parse HTTP response
182195 count = 0;
183- // *ADD*: エレメントが1個の場合は遅れない問題対策 15b05
184- int waitCount = 0; // *ADD*
185196 while (client.connected()) {
186197 // Serial.print("C");
187198 if (client.available()) {
188- c = client.read(); // Serial.print(c);
199+ c = client.read();
200+ //Serial.print((char)c);
189201 if (count == 1 && (c >= '0' && c <= '9')) { // parse HTTP response code
190202 rescode = rescode * 10 + (c - '0');
191203 continue;
@@ -196,13 +208,6 @@
196208 if (count == 2 || c == '\n') { // end of HTTP response code
197209 break; // 応答ヘッダの2行目以降は見ない
198210 }
199- } else{ // *ADD*
200- delay(10); // *ADD*
201- waitCount++; // *ADD*
202- if (waitCount > 1000) { // *ADD*
203- client.stop(); // *ADD*
204- return 5; // 10 seconds timeout *ADD*
205- } // *ADD*
206211 }
207212 }
208213 if (!client.connected()) { // unexpected disconnect
@@ -213,6 +218,7 @@
213218 // disconnect HTTP
214219 while (client.connected() && client.available()) {
215220 c = client.read(); // Serial.print(c); // 応答を最後まで受信
221+ //Serial.print((char)c);
216222 }
217223 client.stop();
218224 if (rescode == 200) {