Guest User

Untitled

a guest
Sep 26th, 2012
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <DHCPLite.h>
  2. #include <RedFly.h>
  3. #include <EEPROM.h>
  4. #include <OneWire.h>
  5. #include <DallasTemperature.h>
  6.  
  7. byte serverIP[] = { 192, 168, 1, 150 };
  8. byte netmask[] = { 255,255,255, 0 };
  9. byte gateway[] = { 192, 168, 1, 1 }; // ip from gateway/router (not needed)
  10. byte broadcast[] = { 255,255,255, 255 };
  11. byte *currentIP = serverIP;
  12. char domainName[] = "mshome.net";
  13. char serverName[] = "arduino\x06mshome\x03net";
  14.  
  15. uint8_t hDHCP, hDNSTCP, hDNSUDP, hHTTPUDP, hHTTPTCP = 0xFF; // socket handles; 0xFF means closed/not used; only needed here for HTTP
  16.  
  17. #define LEDPIN 12
  18. #define HEATPIN 13 // LED simulating heating element
  19. #define DRUMPIN 14 // LED simulating motor turning drum
  20. #define REVERSEPIN 15 // LED simulating indicating drum turning reverse (used to distribute clothes)
  21.  
  22. #define ONE_WIRE_BUS 16 // Data wire from dallas chips
  23. #define humidpin 17 // humidity sensor
  24. #define waterpin 18 // watertank full
  25. #define currentpin 19 // analog voltage input from current clamp
  26. #define airflowpin 20 // analog voltage from airflow sensor
  27.  
  28. #define HTTP_SERVER_PORT 80 //What port should the webpage be served on? default is 80 but could be anything up to 65535. You might want to check this link for ports allready in use, but in most cases you can pick any number as long the service is not in use on you network: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt
  29. #define SERVER_PORT 4444
  30.  
  31. #define CONFIG_VERSION "ar1"
  32. #define CONFIG_START 0
  33.  
  34. // NetworkConnectTo
  35. struct WiFiStorageStruct {
  36. char version[4];
  37. char ssid[24];
  38. char pwd[16];
  39. byte addr[4];
  40. unsigned int id;
  41. } WiFiConfig = {
  42. CONFIG_VERSION,
  43. "sandkaeret1",
  44. "6161616161",
  45. {192, 168, 1, 150},
  46. 0
  47. };
  48.  
  49. void loadConfig() {
  50. if (EEPROM.read(CONFIG_START + 0) == CONFIG_VERSION[0] &&
  51. EEPROM.read(CONFIG_START + 1) == CONFIG_VERSION[1] &&
  52. EEPROM.read(CONFIG_START + 2) == CONFIG_VERSION[2])
  53. for (unsigned int t=0; t<sizeof(WiFiConfig); t++)
  54. *((char*)&WiFiConfig + t) = EEPROM.read(CONFIG_START + t);
  55. }
  56.  
  57. void saveConfig() {
  58. for (unsigned int t=0; t<sizeof(WiFiConfig); t++)
  59. EEPROM.write(CONFIG_START + t, *((char*)&WiFiConfig + t));
  60. }
  61.  
  62. void blink(int pin, int n) {
  63. for (int i = 0; i < n; i++) {
  64. digitalWrite(pin, HIGH); delay(200);
  65. digitalWrite(pin, LOW); delay(200);
  66. }
  67. }
  68.  
  69. byte adhoc = 0; // 1 - adhoc connection or 0 - connected to AP
  70.  
  71.  
  72. OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
  73.  
  74. DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
  75.  
  76. DeviceAddress RoomThermometer = { 0x28, 0xA0, 0x34, 0xC3, 0x03, 0x00, 0x00, 0x8C }; // Array to hold address for Room thermometer
  77. DeviceAddress DrumThermometer = { 0x28, 0xF3, 0x19, 0x33, 0x03, 0x00, 0x00, 0x9E }; // Array to hold address for Drum thermometer
  78. float tempC=0;
  79. int temperature1;
  80. int temperature2;
  81. int cycle1;
  82.  
  83. void setup() {
  84. uint8_t ret;
  85.  
  86. loadConfig();
  87.  
  88. blink(LEDPIN, 1);
  89.  
  90. //init the WiFi module on the shield
  91. ret = RedFly.init(115200, HIGH_POWER); //LOW_POWER MED_POWER HIGH_POWER
  92. if (!ret) {
  93. RedFly.scan();
  94. adhoc = ret = RedFly.join(WiFiConfig.ssid, WiFiConfig.pwd, INFRASTRUCTURE);
  95. if (ret) {
  96. char network[16];
  97. sprintf(network, "TestNetwork%d", WiFiConfig.id);
  98. ret = RedFly.join(network, IBSS_CREATOR, 10);
  99. }
  100. if (!ret) {
  101. currentIP = adhoc ? serverIP : WiFiConfig.addr;
  102. ret = RedFly.begin(currentIP, gateway, netmask);
  103. }
  104. }
  105.  
  106. if (adhoc) { // only open DHCP/DNS ports in adhoc config
  107. // listen for DHCP messages on DHCP_SERVER_PORT (UDP)
  108. hDHCP = RedFly.socketListen(PROTO_UDP, DHCP_SERVER_PORT);
  109. // listen for DNS messages on DNS_SERVER_PORT (both UDP and TCP on the same port)
  110. hDNSTCP = RedFly.socketListen(PROTO_TCP, DNS_SERVER_PORT);
  111. hDNSUDP = RedFly.socketListen(PROTO_UDP, DNS_SERVER_PORT);
  112. }
  113.  
  114. // listen for UDP messages on port 80 (to test echo)
  115. hHTTPUDP = RedFly.socketListen(PROTO_UDP, HTTP_SERVER_PORT);
  116.  
  117. // 10 blinks on error, 5 blinks on AP connection and 3 blinks on adhoc connection
  118. blink(LEDPIN, ret ? 10 : (adhoc ? 3 : 5));
  119.  
  120. pinMode(12, OUTPUT);
  121. pinMode(13, OUTPUT); // heating element
  122. pinMode(14, OUTPUT); // drum motor
  123. pinMode(15, OUTPUT); // drum reverse
  124.  
  125. pinMode(16, INPUT); // DS18B20 one wire bus
  126. pinMode(17, INPUT); // humidity sensor
  127. pinMode(18, INPUT); // watertank full
  128. pinMode(19, INPUT); // current clamp
  129. pinMode(20, INPUT); // airflow
  130.  
  131.  
  132. sensors.setResolution(RoomThermometer, 12); // set the resolution to 12 bit
  133. sensors.setResolution(DrumThermometer, 12);
  134. }
  135.  
  136.  
  137. void loop()
  138. {
  139. uint8_t sock, *ptr, buf[DHCP_MESSAGE_SIZE];
  140. uint16_t buf_len, rd, len;
  141. uint16_t port; //incoming UDP port
  142. uint8_t ip[4]; //incoming UDP ip
  143.  
  144. //check if socket is closed and start listening
  145. if (hHTTPTCP == 0xFF || RedFly.socketClosed(hHTTPTCP)) hHTTPTCP = RedFly.socketListen(PROTO_TCP, HTTP_SERVER_PORT); // start listening on port 80
  146.  
  147. // get data
  148. sock = 0xFF; // 0xFF = return data from all open sockets
  149. ptr = buf;
  150. buf_len = 0;
  151. do {
  152. rd = RedFly.socketRead(&sock, &len, ip, &port, ptr, sizeof(buf)-buf_len);
  153. if((rd != 0) && (rd != 0xFFFF)) { // 0xFFFF = connection closed
  154. ptr += rd;
  155. buf_len += rd;
  156. }
  157. } while(len != 0);
  158.  
  159. // process and send back data
  160. if (buf_len && (sock != 0xFF)) {
  161. if (sock == hDHCP) {
  162. buf_len = DHCPreply((RIP_MSG*)buf, buf_len, currentIP, domainName); // zero returned means the message was not recognized
  163. if (buf_len) RedFly.socketSend(sock, buf, buf_len, broadcast, port);
  164. }
  165. else if (sock == hDNSTCP || sock == hDNSUDP) {
  166. buf_len = DNSreply((DNS_MSG*)buf, buf_len, currentIP, serverName); // zero returned means the message was not recognized
  167. if (sock == hDNSTCP) {
  168. if (buf_len) RedFly.socketSend(sock, buf, buf_len);
  169. }
  170. else {
  171. if (buf_len) RedFly.socketSend(sock, buf, buf_len, ip, port); // send back to the same ip/port the message came from
  172. }
  173. }
  174. else if (sock == hHTTPUDP) {
  175. sprintf((char*)buf+buf_len, " %d", millis());
  176. RedFly.socketSend(hHTTPUDP, buf, strlen((char*)buf), ip, port);
  177. }
  178. else if (sock == hHTTPTCP) {
  179. const char *OK = PSTR("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n");
  180. const char *ContentLengthHeader = PSTR("Content-Length: %d\r\n\r\n");
  181. const char *STYLE = PSTR("\r\n<html style='font-family:Verdana,Geneva,Georgia,Chicago,Arial,Sans-serif;color:#002d80'>");
  182. int pin, value;
  183. char mode, ignore;
  184. char *out = (char *)buf;
  185.  
  186.  
  187. if (strncmp_P(out, PSTR("GET / HTTP"), 10) == 0) {
  188. RedFly.socketSendPGM(sock, OK);
  189. RedFly.socketSendPGM(sock, STYLE);
  190. RedFly.socketSendPGM(sock, PSTR("Hello, World!<br/><br/>You can <a href='/wifi'>update wifi configuration</a>, <a href='/D13=1'>turn LED on (digital pin 13)</a>, or <a href='/A1'>display analog (A1) sensor values</a>"));
  191. RedFly.socketClose(sock);
  192. }
  193. else if (strncmp_P(out, PSTR("GET /cycle1 HTTP"), 10) == 0) {
  194. index1();
  195. }
  196.  
  197.  
  198.  
  199. else if (strncmp_P(out, PSTR("GET /wifi HTTP"), 14) == 0) {
  200. RedFly.socketSendPGM(sock, OK);
  201. RedFly.socketSendPGM(sock, STYLE);
  202. RedFly.socketSendPGM(sock, PSTR("<form method='post'>Wifi configuration<p>SSID: <input style='margin-left:48px' value='"));
  203. RedFly.socketSend(sock, (uint8_t*)WiFiConfig.ssid, strlen(WiFiConfig.ssid));
  204. RedFly.socketSendPGM(sock, PSTR("' name='s'/><br/>Password: <input type='password' name='p' style='margin-left:10px'/><br/>IP address: <input name='a' value='"));
  205. sprintf(out, "%d.%d.%d.%d", WiFiConfig.addr[0], WiFiConfig.addr[1], WiFiConfig.addr[2], WiFiConfig.addr[3]);
  206. RedFly.socketSend(sock, (uint8_t*)out, strlen(out));
  207. RedFly.socketSendPGM(sock, PSTR("'/> (xxx.xxx.xxx.xxx)<br/><br/>Clicking <input type='submit' value='Update'/> will update the configuration and restart the board.</p></form></html>"));
  208. RedFly.socketSendPGM(sock, PSTR("</br><a href='/'>Back</a>"));
  209. RedFly.socketClose(sock);
  210. }
  211. else if (strncmp_P(out, PSTR("POST /wifi HTTP"), 15) == 0) {
  212. char *st, *fi;
  213. char *a = NULL, *p = NULL, *s = NULL;
  214. out[buf_len] = '\0';
  215. if (st = strstr(out, "a="))
  216. if (sscanf(st+2, "%d.%d.%d.%d", WiFiConfig.addr, WiFiConfig.addr+1, WiFiConfig.addr+2, WiFiConfig.addr+3) == 4) a = st+2;
  217. if (st = strstr(out, "p="))
  218. if (fi = strstr(st, "&")) { fi[0] = '\0'; p = st+2; }
  219. if (st = strstr(out, "s="))
  220. if (fi = strstr(st, "&")) { fi[0] = '\0'; s = st+2; }
  221.  
  222. RedFly.socketSendPGM(sock, OK);
  223. RedFly.socketSendPGM(sock, STYLE);
  224. if (a && p && s) {
  225. strcpy(WiFiConfig.pwd, p);
  226. strcpy(WiFiConfig.ssid, s);
  227. saveConfig();
  228. RedFly.socketSendPGM(sock, PSTR("Updated. The board has been restarted with the new configuration.</html>"));
  229. RedFly.socketClose(sock);
  230.  
  231. // restart Arduino by calling a (pseudo)function at address 0
  232. void(* reset) (void) = 0; // declare reset function @ address 0
  233. reset();
  234. }
  235. else {
  236. RedFly.socketSendPGM(sock, PSTR("Error. Please return back and update the configuration.</html>"));
  237. RedFly.socketClose(sock);
  238. }
  239. }
  240. else if (sscanf_P(out, PSTR("GET /D%2d=%1d HTTP"), &pin, &value) == 2) {
  241. pinMode(pin, OUTPUT);
  242. digitalWrite(pin, value ? HIGH : LOW);
  243.  
  244. const char * SetPinMessage = PSTR("Set digital pin %d to %d; <a href='/D%d=%d'>toggle</a>");
  245. sprintf_P(out, SetPinMessage, pin, !!value, pin, !value);
  246.  
  247. RedFly.socketSendPGM(sock, OK);
  248. RedFly.socketSendPGM(sock, STYLE);
  249. RedFly.socketSend(sock, out);
  250. RedFly.socketSendPGM(sock, PSTR("</br><a href='/'>Back</a>"));
  251. RedFly.socketClose(sock);
  252. }
  253. else if (sscanf_P(out, PSTR("GET /%1[AD]%2d= %1[H]"), &mode, &pin, &ignore) == 3) {
  254.  
  255. // get the value
  256. pinMode(pin, INPUT);
  257. int value = (mode == 'A' ? analogRead(pin) : digitalRead(pin));
  258.  
  259. // calculate content length
  260. itoa(value, out, 10);
  261. int contentLength = strlen(out);
  262.  
  263. sprintf_P(out, OK);
  264. sprintf_P(out+strlen(out), ContentLengthHeader, contentLength);
  265. itoa(value, out + strlen(out), 10);
  266.  
  267. RedFly.socketSend(sock, out); // push the actual content out
  268.  
  269. }
  270. else {
  271. RedFly.socketSendPGM(sock, OK);
  272. RedFly.socketSendPGM(sock, PSTR("\r\n<html><head><title>Arduino</title><script type='text/javascript'>var SIDE=200;var DELAY=100;var request=new XMLHttpRequest();function getUrl(a,b){request.onreadystatechange=function(){if(request.readyState==4){b(request.responseText);request.onreadystatechange=function(){}}};request.open('GET',a,true);request.send(null)}function doit(){var d=document.getElementById('info');var b=document.getElementById('out');b.width=b.height=SIDE;var a=b.getContext('2d');function c(e){a.clearRect(0,0,SIDE,SIDE);a.beginPath();a.arc(SIDE/2,SIDE/2,e/10,0,Math.PI*2,true);a.fillStyle='#002D80';a.fill();d.innerHTML=e;getMore=function(){getUrl(window.location.pathname+'=',c)};setTimeout('getMore()',DELAY)}c(0)};</script>"));
  273. RedFly.socketSendPGM(sock, PSTR("</br></br><a href='/'>Back</a>"));
  274. RedFly.socketSendPGM(sock, PSTR("<style type='text/css'>html,body{width:100%;height:100%}html{overflow:hidden}body{margin:0;font-family:Verdana,Geneva,Georgia,Chicago,Arial,Sans-serif,'MS Sans Serif'}#info{position:absolute;padding:4px;left:10px;top:10px;background-color:#fff;border:1px solid #002d80;color:#002d80;opacity:.8;-moz-border-radius:5px;-webkit-border-radius:5px}</style></head><body onload='doit()'><canvas id='out'></canvas><div id='info'/></body></html>"));
  275. RedFly.socketClose(sock);
  276. }
  277. }
  278. }
  279.  
  280.  
  281. }
  282.  
  283. void index1()
  284.  
  285. {
  286. uint8_t sock, *ptr, buf[DHCP_MESSAGE_SIZE];
  287. uint16_t buf_len, rd, len;
  288. uint16_t port; //incoming UDP port
  289. uint8_t ip[4]; //incoming UDP ip
  290.  
  291. //check if socket is closed and start listening
  292. if (hHTTPTCP == 0xFF || RedFly.socketClosed(hHTTPTCP)) hHTTPTCP = RedFly.socketListen(PROTO_TCP, HTTP_SERVER_PORT); // start listening on port 80
  293.  
  294. // get data
  295. sock = 0xFF; // 0xFF = return data from all open sockets
  296. ptr = buf;
  297. buf_len = 0;
  298. do {
  299. rd = RedFly.socketRead(&sock, &len, ip, &port, ptr, sizeof(buf)-buf_len);
  300. if((rd != 0) && (rd != 0xFFFF)) { // 0xFFFF = connection closed
  301. ptr += rd;
  302. buf_len += rd;
  303. }
  304. } while(len != 0);
  305.  
  306. // process and send back data
  307. if (buf_len && (sock != 0xFF)) {
  308. if (sock == hDHCP) {
  309. buf_len = DHCPreply((RIP_MSG*)buf, buf_len, currentIP, domainName); // zero returned means the message was not recognized
  310. if (buf_len) RedFly.socketSend(sock, buf, buf_len, broadcast, port);
  311. }
  312. else if (sock == hDNSTCP || sock == hDNSUDP) {
  313. buf_len = DNSreply((DNS_MSG*)buf, buf_len, currentIP, serverName); // zero returned means the message was not recognized
  314. if (sock == hDNSTCP) {
  315. if (buf_len) RedFly.socketSend(sock, buf, buf_len);
  316. }
  317. else {
  318. if (buf_len) RedFly.socketSend(sock, buf, buf_len, ip, port); // send back to the same ip/port the message came from
  319. }
  320. }
  321. else if (sock == hHTTPUDP) {
  322. sprintf((char*)buf+buf_len, " %d", millis());
  323. RedFly.socketSend(hHTTPUDP, buf, strlen((char*)buf), ip, port);
  324. }
  325. else if (sock == hHTTPTCP) {
  326. const char *OK = PSTR("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n");
  327. const char *ContentLengthHeader = PSTR("Content-Length: %d\r\n\r\n");
  328. const char *STYLE = PSTR("\r\n<html style='font-family:Verdana,Geneva,Georgia,Chicago,Arial,Sans-serif;color:#002d80'>");
  329. int pin, value;
  330. char mode, ignore;
  331. char *out = (char *)buf;
  332.  
  333.  
  334. if (strncmp_P(out, PSTR("GET / HTTP"), 10) == 0) {
  335. RedFly.socketSendPGM(sock, OK);
  336. RedFly.socketSendPGM(sock, STYLE);
  337. RedFly.socketSendPGM(sock, PSTR("Cycle1 loop"));
  338. RedFly.socketClose(sock);
  339. }
  340.  
  341. else if (strncmp_P(out, PSTR("GET /wifi HTTP"), 14) == 0) {
  342. RedFly.socketSendPGM(sock, OK);
  343. RedFly.socketSendPGM(sock, STYLE);
  344. RedFly.socketSendPGM(sock, PSTR("<form method='post'>Wifi configuration<p>SSID: <input style='margin-left:48px' value='"));
  345. RedFly.socketSend(sock, (uint8_t*)WiFiConfig.ssid, strlen(WiFiConfig.ssid));
  346. RedFly.socketSendPGM(sock, PSTR("' name='s'/><br/>Password: <input type='password' name='p' style='margin-left:10px'/><br/>IP address: <input name='a' value='"));
  347. sprintf(out, "%d.%d.%d.%d", WiFiConfig.addr[0], WiFiConfig.addr[1], WiFiConfig.addr[2], WiFiConfig.addr[3]);
  348. RedFly.socketSend(sock, (uint8_t*)out, strlen(out));
  349. RedFly.socketSendPGM(sock, PSTR("'/> (xxx.xxx.xxx.xxx)<br/><br/>Clicking <input type='submit' value='Update'/> will update the configuration and restart the board.</p></form></html>"));
  350. RedFly.socketSendPGM(sock, PSTR("</br><a href='/'>Back</a>"));
  351. RedFly.socketClose(sock);
  352. }
  353. else if (strncmp_P(out, PSTR("POST /wifi HTTP"), 15) == 0) {
  354. char *st, *fi;
  355. char *a = NULL, *p = NULL, *s = NULL;
  356. out[buf_len] = '\0';
  357. if (st = strstr(out, "a="))
  358. if (sscanf(st+2, "%d.%d.%d.%d", WiFiConfig.addr, WiFiConfig.addr+1, WiFiConfig.addr+2, WiFiConfig.addr+3) == 4) a = st+2;
  359. if (st = strstr(out, "p="))
  360. if (fi = strstr(st, "&")) { fi[0] = '\0'; p = st+2; }
  361. if (st = strstr(out, "s="))
  362. if (fi = strstr(st, "&")) { fi[0] = '\0'; s = st+2; }
  363.  
  364. RedFly.socketSendPGM(sock, OK);
  365. RedFly.socketSendPGM(sock, STYLE);
  366. if (a && p && s) {
  367. strcpy(WiFiConfig.pwd, p);
  368. strcpy(WiFiConfig.ssid, s);
  369. saveConfig();
  370. RedFly.socketSendPGM(sock, PSTR("Updated. The board has been restarted with the new configuration.</html>"));
  371. RedFly.socketClose(sock);
  372.  
  373. // restart Arduino by calling a (pseudo)function at address 0
  374. void(* reset) (void) = 0; // declare reset function @ address 0
  375. reset();
  376. }
  377. else {
  378. RedFly.socketSendPGM(sock, PSTR("Error. Please return back and update the configuration.</html>"));
  379. RedFly.socketClose(sock);
  380. }
  381. }
  382. else if (sscanf_P(out, PSTR("GET /D%2d=%1d HTTP"), &pin, &value) == 2) {
  383. pinMode(pin, OUTPUT);
  384. digitalWrite(pin, value ? HIGH : LOW);
  385.  
  386. const char * SetPinMessage = PSTR("Set digital pin %d to %d; <a href='/D%d=%d'>toggle</a>");
  387. sprintf_P(out, SetPinMessage, pin, !!value, pin, !value);
  388.  
  389. RedFly.socketSendPGM(sock, OK);
  390. RedFly.socketSendPGM(sock, STYLE);
  391. RedFly.socketSend(sock, out);
  392. RedFly.socketSendPGM(sock, PSTR("</br><a href='/'>Back</a>"));
  393. RedFly.socketClose(sock);
  394. }
  395. else if (sscanf_P(out, PSTR("GET /%1[AD]%2d= %1[H]"), &mode, &pin, &ignore) == 3) {
  396.  
  397. // get the value
  398. pinMode(pin, INPUT);
  399. int value = (mode == 'A' ? analogRead(pin) : digitalRead(pin));
  400.  
  401. // calculate content length
  402. itoa(value, out, 10);
  403. int contentLength = strlen(out);
  404.  
  405. sprintf_P(out, OK);
  406. sprintf_P(out+strlen(out), ContentLengthHeader, contentLength);
  407. itoa(value, out + strlen(out), 10);
  408.  
  409. RedFly.socketSend(sock, out); // push the actual content out
  410.  
  411. }
  412. else {
  413. RedFly.socketSendPGM(sock, OK);
  414. RedFly.socketSendPGM(sock, PSTR("\r\n<html><head><title>Arduino</title><script type='text/javascript'>var SIDE=200;var DELAY=100;var request=new XMLHttpRequest();function getUrl(a,b){request.onreadystatechange=function(){if(request.readyState==4){b(request.responseText);request.onreadystatechange=function(){}}};request.open('GET',a,true);request.send(null)}function doit(){var d=document.getElementById('info');var b=document.getElementById('out');b.width=b.height=SIDE;var a=b.getContext('2d');function c(e){a.clearRect(0,0,SIDE,SIDE);a.beginPath();a.arc(SIDE/2,SIDE/2,e/10,0,Math.PI*2,true);a.fillStyle='#002D80';a.fill();d.innerHTML=e;getMore=function(){getUrl(window.location.pathname+'=',c)};setTimeout('getMore()',DELAY)}c(0)};</script>"));
  415. RedFly.socketSendPGM(sock, PSTR("</br></br><a href='/'>Back</a>"));
  416. RedFly.socketSendPGM(sock, PSTR("<style type='text/css'>html,body{width:100%;height:100%}html{overflow:hidden}body{margin:0;font-family:Verdana,Geneva,Georgia,Chicago,Arial,Sans-serif,'MS Sans Serif'}#info{position:absolute;padding:4px;left:10px;top:10px;background-color:#fff;border:1px solid #002d80;color:#002d80;opacity:.8;-moz-border-radius:5px;-webkit-border-radius:5px}</style></head><body onload='doit()'><canvas id='out'></canvas><div id='info'/></body></html>"));
  417. RedFly.socketClose(sock);
  418. }
  419. }
  420. }
  421.  
  422.  
  423. }
RAW Paste Data