Wifly Driver  V1.0
WiFly.c
Go to the documentation of this file.
1 /*
2  * WiFly.c
3  *
4  * Created on: 23/10/2015
5  * Author: Victor
6  */
7 
8 #include "LPC17xx.h"
9 
10 #include <stdio.h>
11 #include <string.h>
12 #include <stdarg.h>
13 #include <stdlib.h>
14 
15 #include "Type.h"
16 #include "PrintF.h"
17 #include "WiFly.h"
18 #include "PrintF.h"
19 
20 #include "Config.h"
21 #include "FreeRTOS.h"
22 #include "semphr.h"
23 
24 
25 /* SET COMMAND String */
26 #define SET_IP_ADDRESS "set ip address %s\r\n"
27 #define SET_IP_BACKUP "set ip backup %s\r\n"
28 #define SET_IP_DHCP "set ip dhcp %d\r\n"
29 #define SET_IP_FLAGS "set ip flags %x\r\n"
30 #define SET_IP_GATEWAY "set ip gateway %s\r\n"
31 #define SET_IP_HOST "set ip host %s\r\n"
32 #define SET_IP_LOCAL_PORT "set ip localport %d\r\n"
33 #define SET_IP_NET "set ip net %s\r\n"
34 #define SET_IP_NETMASK "set ip netmask %s\r\n"
35 #define SET_IP_PROTO "set ip proto %d\r\n"
36 #define SET_IP_REMOTE "set ip remote %d\r\n"
37 #define SET_IP_TCP_MODE "set ip tcp-mode %x\r\n"
38 
39 #define SET_COM_REM "set com remote %s\r\n"
40 #define SET_OP_FORMAT "set option format %d\r\n"
41 #define SET_UART_MD "set uart mode %x \r\n"
42 #define SET_UART_BAUD "set uart baud %d \r\n"
43 #define SET_UART_INST "set uart instant %d \r\n"
44 
45 #define SET_WLAN_TX "set wlan tx %d \r\n"
46 
47 #define SET_WLAN_AUTH "set wlan auth %d\r\n"
48 #define SET_WLAN_KEY "set wlan key %d\r\n"
49 #define SET_WLAN_PHRASE "set wlan phrase %s\r\n"
50 #define SET_WLAN_SSID "set wlan ssid %s\r\n"
51 #define SET_WLAN_JOIN "set wlan join %d\r\n"
52 #define SET_WLAN_CHAN "set wlan chan %d\r\n"
53 #define SET_DNS_NAME "set dns name %s\r\n"
54 
55 /* GET COMMAND String */
56 
57 #define GET_ADHOC "get adhoc\r\n"
58 #define GET_MAC "get mac\r\n"
59 #define GET_IP "get ip a\r\n"
60 #define GET_WLAN "get wlan\r\n"
61 #define GET_VER "ver\r\n"
62 
63 /* STATUS COMMANDS */
64 #define SHOW_RSSI "show rssi\r\n"
65 #define SHOW_TIME "show time\r\n"
66 #define SHOW_CONNECTION "show connection\r\n"
67 
68 
69 /* ACTION COMMANDS */
70 #define AP_MODE "apmode %s %d"
71 #define CHG_CMD "$$$"
72 #define CHG_DT "exit\r\n"
73 #define FACTORYRESET "factory RESTORE\r\n"
74 #define CLOSE "close\r\n"
75 #define JOIN "join %s\r\n"
76 #define LEAVE "leave\r\n"
77 #define PING "ping %s\r\n"
78 #define OPEN_CONN "open %s %d\r\n"
79 #define REBOOT "reboot\r\n"
80 #define FACTORY_RESET "factory RESET\r\n"
81 #define SLEEP "sleep\r\n"
82 
83 /*FILE I/O COMMANDS */
84 #define SAVE "save\r\n"
85 
86 /* Variables declaration */
87 xSemaphoreHandle xMutexWifly;
88 static char wBuffer[WIFLYBUFSIZE];
89 static char TcpRxBuff[WIFLYBUFSIZE];
90 static char UdpRxBuff[WIFLYBUFSIZE];
91 static char HTTPRxBuff[WIFLYBUFSIZE];
92 static uint32_t wiflyPortNum;
93 static uint32_t wiflyBaudRate;
94 static uint32_t wiflyLogSev= 0;
95 
96 static char * WiflyIpPing = WLAN_PING_CHECK;
97 static uint8_t WiFlyMode = DATA_M;
98 static uint8_t WiflyWlanConn = WLAN_DISCON;
99 static uint8_t WiflyProtConfig = MODE_DISCON;
100 static uint8_t WiflyWLANConnected = FALSE;
101 static uint8_t WiflyTCPAutoConnect = FALSE;
102 //static uint8_t WiflyUDPAutoConnect = FALSE; ///< UDP auto connection status.
103 
107 static void clearwBuffer()
108 {
109  memset((uint8_t *)wBuffer, 0x00, WIFLYBUFSIZE);
110  PrintF_ClBuffUart(wiflyPortNum);
111 }
112 
121 static uint8_t Wifly_SendSet(uint32_t delay, char *exResp, const char * restrict format,...)
122 {
123  uint8_t rtn = FALSE;
124  va_list arg;
125 
126  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
127  {
128  va_start( arg, format);
129  clearwBuffer();
130  vsprintf(wBuffer, format, arg);
131 
132  Log_log( wiflyLogSev, LV_TRACE, "Send command: %s",wBuffer);//Log de la trama enviada
133  PrintF_print(wiflyPortNum, wBuffer);
134  clearwBuffer();
135  rtn = PrintF_ChkScan(wiflyPortNum, wBuffer, exResp, delay);
136  //PrintF_delayMs(50);
137  Log_log( wiflyLogSev, LV_TRACE, "Response: %s",wBuffer);//Log de la trama enviada
138  if (rtn==FALSE)
139  Log_log( wiflyLogSev, LV_ERR, "Error expected response: %s",wBuffer);//Log de la trama enviada
140  va_end(arg);
141  }
142  xSemaphoreGiveRecursive( xMutexWifly );
143 
144  return rtn;
145 }
146 
154 static char * Wifly_SendGet(uint32_t delay, const char * restrict format,...)
155 {
156  va_list arg;
157 
158  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
159  {
160  va_start( arg, format);
161  clearwBuffer();
162  vsprintf(wBuffer, format, arg);
163  Log_log( wiflyLogSev, LV_TRACE, "Send command: %s",wBuffer);//Log de la trama enviada
164  PrintF_print(wiflyPortNum, wBuffer);
165  //string=wBuffer;
166  clearwBuffer();
167  PrintF_scan(wiflyPortNum,wBuffer,delay);
168  Log_log( wiflyLogSev, LV_TRACE, "Response: %s",wBuffer);//Log de la trama enviada
169  //string=wBuffer;
170  va_end(arg);
171  }
172  xSemaphoreGiveRecursive( xMutexWifly );
173 
174  return wBuffer;
175 }
176 
181 static uint8_t Wifly_CMD()
182 {
183  uint8_t attempts=0;
184 
185  while ((WiFlyMode==DATA_M) && (attempts<3))
186  {
187  if(Wifly_SendSet(CMD_DELAY, CMD, CHG_CMD)==TRUE)//Send $$$ COMMAND
188  {
189  WiFlyMode=CMD_M;
190  return TRUE;
191  }
192  attempts++;
193  }
194 
195  if(attempts==3)
196  {
197  Log_log( wiflyLogSev, LV_ERR, "Error max attempts sending CMD command");
199  return FALSE;
200  }
201  else
202  return TRUE;
203 }
204 
209 static uint8_t Wifly_exitCMD()
210 {
211  if(WiFlyMode==CMD_M)
212  {
213 
214  if(Wifly_SendSet(CMD_DELAY, EXIT, CHG_DT)==TRUE) //Send exit COMMAND
215  WiFlyMode=DATA_M;
216 
217  }
218  if(WiFlyMode==DATA_M)
219  return TRUE;
220  else
221  return FALSE;
222 }
223 
224 uint8_t Wifly_start( uint32_t PortNum, uint32_t baudrate)
225 {
226  uint8_t rtn = FALSE;
227  /* Es crea el semàfor si no està creat */
228  if( xMutexWifly == NULL )
229  {
230  xMutexWifly = xSemaphoreCreateMutex();
231  }
232 
233  /*S'utilitza el semàfor per inicialitzar el Port */
234  wiflyPortNum=PortNum;
235  wiflyBaudRate=baudrate;
236 
237  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
238  {
239  rtn=PrintF_start(wiflyPortNum, wiflyBaudRate); /* baud rate setting */
241  }
242  xSemaphoreGiveRecursive( xMutexWifly );
243 
244  if(rtn==FALSE)
245  Log_log( wiflyLogSev, LV_ERR, "Error during Wifly UART initialize");
246  return rtn;
247 }
248 
249 uint8_t Wifly_logStart( uint32_t PortNum, uint32_t baudrate, uint32_t logSeverity )
250 {
251  uint8_t rtn = FALSE;
252  /* Es crea el semàfor si no està creat */
253  if( xMutexWifly == NULL )
254  {
255  xMutexWifly = xSemaphoreCreateMutex();
256  }
257  wiflyLogSev= logSeverity;
258 
259  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
260  {
261  if(wiflyLogSev>0)
262  {
263  rtn=Log_start(PortNum,baudrate);
264  }
265  }
266  xSemaphoreGiveRecursive( xMutexWifly );
267 
268  if(rtn==FALSE)
269  Log_log( wiflyLogSev, LV_ERR, "Error during Log UART initialize");
270 
271  return rtn;
272 }
273 
274 uint8_t Wifly_ChangeBaudRate(uint32_t baudrate)
275 {
276  uint8_t rtn=FALSE;
277  if(Wifly_setUartBaud(baudrate)==TRUE)
278  {
279  wiflyBaudRate=baudrate;
280  Wifly_save();
282  //PrintF_stop(wiflyPortNum);
283 
284  }
285  if(PrintF_start(wiflyPortNum,wiflyBaudRate)==TRUE)
286  {
287  rtn=TRUE;
288  PrintF_delayMs(1000);
289  clearwBuffer();
290  }
291  if(rtn==TRUE)
292  Log_log( wiflyLogSev, LV_INFO, "Set baud rate: %d", baudrate);
293  else
294  Log_log( wiflyLogSev, LV_ERR, "Error: Cannot change baud rate");
295 
296  return rtn;
297 }
298 
299 void Wifly_reset(uint8_t typeReset)
300 {
301  if (typeReset==0)
302  {
303  // reset wifly device to ensure to start from know state. Connect pin from LPC to reset pin in wifly
304  // At this point we will use the same pin to control board led, it's recommend to you another one.
305  // Initialise pin
306  LPC_PINCON->PINSEL1 &= ( ~( 3 << 12 ) );
307  LPC_GPIO0->FIODIR |= ( 1 << RST_WIFLY_PIN );
308  // it made reset at Wifly
309  LPC_GPIO0->FIOCLR = 1 << RST_WIFLY_PIN;
310  PrintF_delayMs(1); // min 160us
311  LPC_GPIO0->FIOSET = 1 << RST_WIFLY_PIN;
312  Log_log( wiflyLogSev, LV_INFO, "Hardware reset Wifly module");
313 
314  }
315  else
316  {
317  if (Wifly_CMD()==TRUE)
318  {
319  if(Wifly_SendSet(RST_DELAY, READY, REBOOT)==TRUE) //Send Reboot COMMAND
320  Log_log( wiflyLogSev, LV_INFO, "Software reset Wifly module");
321  }
322  }
323 
324  //Initialised configured parameters
325 
326  WiFlyMode = DATA_M;
327  WiflyProtConfig = MODE_DISCON;
328  WiflyWlanConn = WLAN_DISCON;
329 
330  WiflyWLANConnected=FALSE;
331 
332  if( PrintF_ChkScan(wiflyPortNum, wBuffer, READY, RST_DELAY)==TRUE)
333  {
334  Wifly_CMD();
335  Wifly_SendSet(ECHO_DELAY, AOK, SET_UART_MD, UART_MD);//Config ECHO OFF
336  }
337 
338 }
339 
340 uint8_t Wifly_save()
341 {
342  if(Wifly_SendSet(CMD_DELAY, SAVE_OK, SAVE)==TRUE) //Send exit COMMAND
343  {
344  return TRUE;
345  }
346  return FALSE;
347 }
348 
350 {
351  if(Wifly_SendSet(CMD_DELAY, AOK, FACTORY_RESET)==TRUE) //Send exit COMMAND
352  {
353  return TRUE;
354  }
355  return FALSE;
356 }
357 
358 uint8_t Wifly_sleep()
359 {
360  if(Wifly_SendSet(SET_DELAY, AOK, SLEEP)==TRUE) //Send exit COMMAND
361  {
362  return TRUE;
363  }
364  return FALSE;
365 }
366 
367 uint8_t Wifly_WLANConnect(uint32_t AuthMode, char *ssid, char* passw)
368 {
369  uint32_t attempts=0;
370 
371  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
372 
373  if(Wifly_WLANConfigConnect(AuthMode, ssid, passw)==TRUE)
374  {
375  if(WiflyWLANConnected==FALSE)
376  {
377  if(Wifly_SendSet(JOIN_DELAY,JOIN_OK, JOIN, ssid)==TRUE)//Send join to Associate
378  {
379  WiflyWLANConnected=TRUE;
380  }
381  }
382 
383  while((Wifly_ping(WiflyIpPing)==FALSE)&&(attempts<3)) //Check wifly connection
384  {
385  if(Wifly_SendSet(JOIN_DELAY,JOIN_OK, JOIN, ssid)==FALSE)//Send join to Associate
386  {
387  WiflyWLANConnected=FALSE;
388  attempts++;
389  }
390  }
391  if(attempts>=3)//After 3 attempts, will reset module
392  {
394  xSemaphoreGiveRecursive( xMutexWifly );
395  return FALSE;
396  }
397  }
398  else
399  {
400  xSemaphoreGiveRecursive( xMutexWifly );
401  Log_log( wiflyLogSev, LV_ERR, "Error WLAN configuration connection");
402  return FALSE;
403  }
404  xSemaphoreGiveRecursive( xMutexWifly );
405  return TRUE;
406 }
407 
408 uint8_t Wifly_WLANConnectPing(uint32_t AuthMode, char *ssid, char* passw, char* pingIP)
409 {
410  WiflyIpPing=pingIP; /* Change IP address ping to connection address*/
411  return Wifly_WLANConnect(AuthMode, ssid, passw);
412 }
413 
414 uint8_t Wifly_leave()
415 {
416  if (Wifly_CMD()==TRUE)
417  {
418  if(Wifly_SendSet(SET_DELAY, AOK, LEAVE)==TRUE)//Send ping COMMAND
419  {
420  Log_log( wiflyLogSev, LV_INFO, "Leave WLAN connection");
421  return TRUE;
422  }
423  }
424  Log_log( wiflyLogSev, LV_ERR, "Error leave connection");
425  return FALSE;
426 }
427 
428 uint8_t Wifly_WLANConfigConnect(uint32_t AuthMode, char *ssid, char* passw)
429 {
430  if(Wifly_CMD()==TRUE)
431  {
432  if(WiflyWlanConn!=WLAN_CON)
433  {
434  if(Wifly_setWlanJoin(0)==FALSE) //Send WLAN join mode
435  return FALSE;
436  Wifly_save();
438 
439  if (Wifly_setWlanAuth(AuthMode)==FALSE) //Send WLAN auth mode
440  return FALSE;
441  if(Wifly_setWlanSSID(ssid)==FALSE) //Send ssid name
442  return FALSE;
443  if(Wifly_setIpDHCP(1)==FALSE)//set DHCP
444  return FALSE;
445 
446  if((AuthMode==WPA1)||(AuthMode==WPA2)||(AuthMode==MIXED))
447  {
448  if(Wifly_setWlanPhrase(passw)==FALSE)//Send WPA password
449  return FALSE;
450  }
451  else if (AuthMode==WEP)
452  {
453  if(Wifly_setWlanKey(passw)==FALSE)//Send WEP password
454  return FALSE;
455  }
456  WiflyWlanConn=WLAN_CON;
457  Log_log( wiflyLogSev, LV_INFO, "WLAN Connection configured");
458  }
459  return TRUE;
460  }
461  return FALSE;
462 }
463 
464 
465 uint8_t Wifly_ping(char* ip)
466 {
467  if (Wifly_CMD()==TRUE)
468  {
469  if(Wifly_SendSet(PING_DELAY, PING_OK, PING,ip)==TRUE)//Send ping COMMAND
470  {
471  Log_log( wiflyLogSev, LV_INFO, "Ping OK: %s",ip);
472  return TRUE;
473  }
474  }
475  return FALSE;
476 }
477 
478 uint8_t Wifly_open(char* dnsAddress, uint32_t port)
479 {
480 
481  if (Wifly_CMD()==TRUE)
482  {
483  if(Wifly_SendSet(OPEN_DELAY, OPEN_CON, OPEN_CONN, dnsAddress, port)==TRUE)//Send open COMMAND
484  {
485  Log_log( wiflyLogSev, LV_INFO, "Open connection:IP= %s, PORT= %d",dnsAddress,port);
486  return TRUE;
487  }
488  }
489 
490  return FALSE;
491 }
492 
493 uint8_t Wifly_close()
494 {
495 
496  if (Wifly_CMD()==TRUE)
497  {
498  if(Wifly_SendSet(CMD_DELAY, CLOSE_CON, CLOSE)==TRUE)//Send close COMMAND
499  {
500  Log_log( wiflyLogSev, LV_INFO, "Close connection");
501  return TRUE;
502  }
503  }
504  return FALSE;
505 }
506 
507 //SET COMMAND LIST//
508 uint8_t Wifly_setIpAddress(char * address)
509 {
510  if(Wifly_CMD()==TRUE) //Check the module is in command mode
511  {
512  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_ADDRESS,address)==TRUE)//Send COMMAND
513  return TRUE;
514  }
515  return FALSE;
516 }
517 
518 uint8_t Wifly_setIpDHCP(uint8_t mode)
519 {
520  if(Wifly_CMD()==TRUE) //Check the module is in command mode
521  {
522  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_DHCP,mode)==TRUE)//Send COMMAND
523  return TRUE;
524  }
525  return FALSE;
526 }
527 
528 uint8_t Wifly_setIpNET(char * address)
529 {
530  if(Wifly_CMD()==TRUE) //Check the module is in command mode
531  {
532  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_NET,address)==TRUE)//Send COMMAND
533  return TRUE;
534  }
535  return FALSE;
536 }
537 
538 uint8_t Wifly_setIpFlags(uint32_t mask)
539 {
540  if(Wifly_CMD()==TRUE) //Check the module is in command mode
541  {
542  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_FLAGS,mask)==TRUE)//Send COMMAND
543  return TRUE;
544  }
545  return FALSE;
546 }
547 
548 uint8_t Wifly_setIpGateway(char* address)
549 {
550  if(Wifly_CMD()==TRUE) //Check the module is in command mode
551  {
552  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_GATEWAY,address)==TRUE)//Send COMMAND
553  return TRUE;
554  }
555  return FALSE;
556 }
557 
558 uint8_t Wifly_setIpHost(char* address)
559 {
560  if(Wifly_CMD()==TRUE) //Check the module is in command mode
561  {
562  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_HOST,address)==TRUE)//Send COMMAND
563  return TRUE;
564  }
565  return FALSE;
566 }
567 
568 uint8_t Wifly_setIpLocalPort(uint32_t value)
569 {
570  if(Wifly_CMD()==TRUE) //Check the module is in command mode
571  {
572  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_LOCAL_PORT,value)==TRUE)//Send COMMAND
573  return TRUE;
574  }
575  return FALSE;
576 }
577 
578 uint8_t Wifly_setIpnetmask(char* address)
579 {
580  if(Wifly_CMD()==TRUE) //Check the module is in command mode
581  {
582  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_NETMASK,address)==TRUE)//Send COMMAND
583  return TRUE;
584  }
585  return FALSE;
586 }
587 
588 uint8_t Wifly_setIpProtocol(uint32_t value)
589 {
590  if(Wifly_CMD()==TRUE) //Check the module is in command mode
591  {
592  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_PROTO, value)==TRUE)//Send COMMAND
593  return TRUE;
594  }
595  return FALSE;
596 }
597 
598 uint8_t Wifly_setIpRemote(uint32_t value)
599 {
600  if(Wifly_CMD()==TRUE) //Check the module is in command mode
601  {
602  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_REMOTE, value)==TRUE)//Send COMMAND
603  return TRUE;
604  }
605  return FALSE;
606 }
607 
608 uint8_t Wifly_setIpTcpMode(uint32_t value)
609 {
610  if(Wifly_CMD()==TRUE) //Check the module is in command mode
611  {
612  if(Wifly_SendSet(SET_DELAY, AOK, SET_IP_TCP_MODE,value)==TRUE)//Send COMMAND
613  return TRUE;
614  }
615  return FALSE;
616 }
617 
618 uint8_t Wifly_setComRemote(char* value)
619 {
620  if(Wifly_CMD()==TRUE) //Check the module is in command mode
621  {
622  if(Wifly_SendSet(SET_DELAY, AOK, SET_COM_REM,value)==TRUE)//Send COMMAND
623  return TRUE;
624  }
625  return FALSE;
626 }
627 
628 uint8_t Wifly_setOptionFormat(uint32_t value)
629 {
630  if(Wifly_CMD()==TRUE) //Check the module is in command mode
631  {
632  if(Wifly_SendSet(SET_DELAY, AOK, SET_OP_FORMAT,value)==TRUE)//Send COMMAND
633  return TRUE;
634  }
635  return FALSE;
636 }
637 
638 uint8_t Wifly_setUartMode(uint32_t value)
639 {
640  if(Wifly_CMD()==TRUE) //Check the module is in command mode
641  {
642  if(Wifly_SendSet(SET_DELAY, AOK, SET_UART_MD,value)==TRUE)//Send COMMAND
643  return TRUE;
644  }
645  return FALSE;
646 }
647 
648 uint8_t Wifly_setUartInstant(uint32_t value)
649 {
650  if(Wifly_CMD()==TRUE) //Check the module is in command mode
651  {
652  Wifly_SendSet(SET_DELAY, "", SET_UART_INST,value);//Send COMMAND
653  WiFlyMode = DATA_M;
654  return TRUE;
655  }
656  WiFlyMode = DATA_M;
657  return FALSE;
658 }
659 
660 uint8_t Wifly_setUartBaud(uint32_t value)
661 {
662  if(Wifly_CMD()==TRUE) //Check the module is in command mode
663  {
664  Wifly_SendSet(SET_DELAY, AOK, SET_UART_BAUD,value);//Send COMMAND
665  //WiFlyMode = DATA_M;
666  return TRUE;
667  }
668  WiFlyMode = DATA_M;
669  return FALSE;
670 }
671 
672 uint8_t Wifly_setWlanTX(uint32_t tx)
673 {
674  if(Wifly_CMD()==TRUE) //Check the module is in command mode
675  {
676  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_TX ,tx)==TRUE)//Send COMMAND
677  return TRUE;
678  }
679  return FALSE;
680 }
681 
682 uint8_t Wifly_setWlanAuth(uint32_t value)
683 {
684  if(Wifly_CMD()==TRUE) //Check the module is in command mode
685  {
686  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_AUTH ,value)==TRUE)//Send COMMAND
687  return TRUE;
688  }
689  return FALSE;
690 }
691 
692 uint8_t Wifly_setWlanChannel(uint8_t value)
693 {
694  if(Wifly_CMD()==TRUE) //Check the module is in command mode
695  {
696  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_CHAN ,value)==TRUE)//Send COMMAND
697  return TRUE;
698  }
699  return FALSE;
700 }
701 
702 uint8_t Wifly_setWlanJoin(uint32_t value)
703 {
704  if(Wifly_CMD()==TRUE) //Check the module is in command mode
705  {
706  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_JOIN ,value)==TRUE)//Send COMMAND
707  return TRUE;
708  }
709  return FALSE;
710 }
711 
712 uint8_t Wifly_setWlanKey(char* value)
713 {
714  if(Wifly_CMD()==TRUE) //Check the module is in command mode
715  {
716  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_KEY ,value)==TRUE)//Send COMMAND
717  return TRUE;
718  }
719  return FALSE;
720 }
721 
722 uint8_t Wifly_setWlanPhrase(char* password)
723 {
724  if(Wifly_CMD()==TRUE) //Check the module is in command mode
725  {
726  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_PHRASE ,password)==TRUE)//Send COMMAND
727  return TRUE;
728  }
729  return FALSE;
730 }
731 
732 uint8_t Wifly_setWlanSSID(char* value)
733 {
734  if(Wifly_CMD()==TRUE) //Check the module is in command mode
735  {
736  if(Wifly_SendSet(SET_DELAY, AOK, SET_WLAN_SSID ,value)==TRUE)//Send COMMAND
737  return TRUE;
738  }
739  return FALSE;
740 }
741 
742 uint8_t Wifly_setDNSName(char* name)
743 {
744  if(Wifly_CMD()==TRUE) //Check the module is in command mode
745  {
746  if(Wifly_SendSet(SET_DELAY, AOK, SET_DNS_NAME ,name)==TRUE)//Send COMMAND
747  return TRUE;
748  }
749  return FALSE;
750 }
751 
752 char * Wifly_getIp()
753 {
754  char * string;
755 
756  if(Wifly_CMD()==TRUE)
757  {
758  string=Wifly_SendGet(GET_DELAY, GET_IP);;
759  string = strtok(string,"\r\n"); //Parse IP address
760  Log_log( wiflyLogSev, LV_INFO, "IP= %s",string);
761  }
762 
763  return string;
764 }
765 
767 {
768  uint8_t rtn = FALSE;
769  char *string;
770 
771  if(Wifly_CMD()==TRUE)
772  {
773  Wifly_SendGet(GET_DELAY, GET_WLAN);
774 
775  string = strstr(wBuffer, "Chan=") + strlen("Chan="); //Parse channel
776  rtn = strtol(string , &string, 10);
777  Log_log( wiflyLogSev, LV_INFO, "Channel= %d",rtn);
778  }
779 
780  return rtn;
781 }
782 
783 uint8_t Wifly_getTx()
784 {
785  uint8_t tx = 0;
786  char *string;
787 
788  if(Wifly_CMD()==TRUE)
789  {
790  Wifly_SendGet(GET_DELAY, GET_WLAN);
791 
792  string = strstr(wBuffer, "TxPower=") + strlen("TxPower="); //Parse Tx power
793  tx = strtol(string , &string, 10);
794  Log_log( wiflyLogSev, LV_INFO, "TxPower= %d",tx);
795  }
796  return tx;
797 }
798 
799 int32_t Wifly_getRSSI()
800 {
801  int32_t rssi=0;
802  char *string;
803 
804  if(Wifly_CMD()==TRUE)
805  {
806  Wifly_SendGet(GET_DELAY, SHOW_RSSI);
807  string = strstr(wBuffer, "RSSI=(") + strlen("RSSI=("); //Parse RSSI signal
808  rssi = strtol(string , &string, 10);
809  Log_log( wiflyLogSev, LV_INFO, "RSSI= %d",rssi);
810  }
811  return rssi;
812 }
813 
814 uint32_t Wifly_getTime()
815 {
816  uint32_t time=0;
817  char *string;
818 
819  if(Wifly_CMD()==TRUE)
820  {
821  Wifly_SendGet(GET_DELAY, SHOW_TIME);
822  string = strstr(wBuffer, "Time=") + strlen("Time="); //Parse Time
823  time = strtol(string , &string, 10);
824  Log_log( wiflyLogSev, LV_INFO, "Time power up= %d",time);
825  }
826  return time;
827 }
828 
830 {
831  char * string;
832 
833  if(Wifly_CMD()==TRUE)
834  {
835  string=Wifly_SendGet(GET_DELAY, GET_MAC);
836  string = strstr(wBuffer, "Mac Addr=") + strlen("Mac Addr=");
837  string = strtok(string,"\r\n");
838 
839  Log_log( wiflyLogSev, LV_INFO, "Mac Addr= %s",string);
840  }
841 
842  return string;
843 }
844 
846 {
847  char * string;
848 
849  if(Wifly_CMD()==TRUE)
850  {
851  string=Wifly_SendGet(GET_DELAY, GET_WLAN);
852  string = strstr(wBuffer, "SSID=") + strlen("SSID=");
853  string = strtok(string,"\r\n");
854  Log_log( wiflyLogSev, LV_INFO, "SSID= %s",string);
855  }
856 
857  return string;
858 }
859 
860 double Wifly_getVer()
861 {
862  double ver;
863  char * string;
864 
865  if(Wifly_CMD()==TRUE)
866  {
867  string=Wifly_SendGet(GET_DELAY, GET_VER);
868  string = strstr(wBuffer, "Ver: ") + strlen("Ver: ");
869  ver = strtod(string , &string);
870  Log_log( wiflyLogSev, LV_INFO, "Version= %f",ver);
871  }
872 
873  return ver;
874 }
875 
877 {
878  uint32_t rtn=0;
879  char *string;
880 
881  if(Wifly_CMD()==FALSE)
882  {
883  Wifly_SendGet(GET_DELAY, SHOW_CONNECTION);
884  string = strstr(wBuffer, "8") + strlen("8");
885  rtn = strtol(string , &string, 16);
886  }
887 
888  return rtn;
889 }
890 
891 char * Wifly_HTTPReceive(char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
892 {
893  char *buff;
894 
895  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
896  {
897  if (Wifly_HTTPConfig(dnsAddress, getCommand, port, proto)==TRUE)
898  {
899  if(Wifly_open( dnsAddress, port)==TRUE)
900  {
901  WiFlyMode=DATA_M;
902  buff=strcpy(HTTPRxBuff,wBuffer);
903  buff = strstr(buff, HTTP_HEAD) + strlen(HTTP_HEAD);//Remove HEADER
904  buff = strtok(buff,"*"); //Remove *CLOS*
905  }
906  }
907  }
908  xSemaphoreGiveRecursive( xMutexWifly );
909  return buff;
910 }
911 
912 uint8_t Wifly_HTTPSend(char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
913 {
914  uint8_t rtn=FALSE;
915 
916  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
917  {
918  if (Wifly_HTTPConfig(dnsAddress, getCommand, port, proto)==TRUE)
919  {
920 
921  if (Wifly_open( dnsAddress, port)==TRUE)
922  {
923  WiFlyMode=DATA_M;
924  rtn=TRUE;
925  }
926  }
927  }
928  xSemaphoreGiveRecursive( xMutexWifly );
929  return rtn;
930 }
931 
932 uint8_t Wifly_HTTPConfig(char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
933 {
934 
935  if(WiflyProtConfig!=MODE_HTTP)
936  {
937 
938  if(Wifly_setIpProtocol( proto)==FALSE) //set ip proto
939  return FALSE;
940  if(Wifly_setOptionFormat(1)==FALSE)//set option format
941  return FALSE;
942  WiflyProtConfig=MODE_HTTP;
943 
944  }
945  if (Wifly_setDNSName(dnsAddress)==FALSE)// set dns name "dns address"
946  return FALSE;
947  if(Wifly_setIpRemote(port)==FALSE)//set ip remote
948  return FALSE;
949  if(Wifly_setComRemote(getCommand)==TRUE)//set com remote
950  return TRUE;
951 
952  return FALSE;
953 }
954 
955 char * Wifly_UDPReceive(char *address, uint32_t localPort, uint32_t remotePort, const char * restrict command,...)
956 {
957  char *buff;
958  va_list arg;
959 
960  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
961  {
962  if (Wifly_UDPConfig(address, localPort, remotePort)==TRUE)
963  {
964  if(Wifly_exitCMD()==TRUE)
965  {
966  PrintF_delayMs(100);
967  va_start( arg, command);
968  memset((uint8_t *)UdpRxBuff, 0x00, WIFLYBUFSIZE);
969  buff=strcpy(UdpRxBuff,Wifly_SendGet(UDP_DELAY, command, arg));
970  va_end(arg);
971  }
972  }
973  }
974  xSemaphoreGiveRecursive( xMutexWifly );
975  return buff;
976 }
977 
978 uint8_t Wifly_UDPSend(char *address, uint32_t localPort, uint32_t remotePort, char *exResp , const char * restrict command,...)
979 {
980  uint8_t rtn=FALSE;
981  va_list arg;
982 
983  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
984  {
985  if (Wifly_UDPConfig(address, localPort, remotePort)==TRUE)
986  {
987  if(Wifly_exitCMD()==TRUE)
988  {
989  PrintF_delayMs(100);
990  va_start( arg, command);
991  if(Wifly_SendSet(UDP_DELAY, exResp, command, arg)==TRUE)
992  rtn=TRUE;
993  va_end(arg);
994  }
995  }
996  }
997  xSemaphoreGiveRecursive( xMutexWifly );
998 
999  return rtn;
1000 }
1001 
1002 uint8_t Wifly_UDPConfig(char *address, uint32_t localPort, uint32_t remotePort)
1003 {
1004 
1005  if (Wifly_CMD()==TRUE)
1006  {
1007  if(WiflyProtConfig!=MODE_UDP)
1008  {
1009  if(Wifly_setIpProtocol(1)==FALSE) //set ip proto 1, UDP protocol
1010  return FALSE;
1011  if(Wifly_setOptionFormat(0)==FALSE)//set option format
1012  return FALSE;
1013  WiflyProtConfig=MODE_UDP;
1014  }
1015  if (Wifly_setIpHost(address)==FALSE)// set ip host
1016  return FALSE;
1017  if(Wifly_setIpRemote(remotePort)==FALSE)//set remote port
1018  return FALSE;
1019  if(Wifly_setIpLocalPort(localPort)==FALSE)//set local port
1020  return FALSE;
1021  return TRUE;
1022  }
1023  return FALSE;
1024 }
1025 
1026 char * Wifly_TCPReceive(char *address, uint32_t remotePort, const char * restrict command,...)
1027 {
1028  char * buff;
1029 
1030  va_list arg;
1031  va_start( arg, command);
1032 
1033 
1034  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
1035 
1036  if (Wifly_TCPConfig(address,remotePort)==TRUE)
1037  {
1038  if(Wifly_open(address,remotePort)==TRUE);
1039  {
1040 
1041  buff=strcpy(TcpRxBuff,Wifly_SendGet(TCP_DELAY,command, arg));
1042 
1043  va_end(arg);
1044 
1045  WiFlyMode=DATA_M;
1046  Wifly_close();
1047  }
1048  }
1049  xSemaphoreGiveRecursive( xMutexWifly );
1050  return buff;
1051 }
1052 
1053 uint8_t Wifly_TCPSend(char *address, uint32_t remotePort, char *exResp , const char * restrict command,...)
1054 {
1055 
1056  va_list arg;
1057  va_start( arg, command);
1058 
1059  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
1060 
1061  if (Wifly_TCPConfig(address, remotePort)==TRUE)
1062  {
1063  if(Wifly_open(address,remotePort)==TRUE);
1064  {
1065 
1066 
1067  Wifly_SendSet(TCP_DELAY, exResp, command, arg);
1068  va_end(arg);
1069 
1070  WiFlyMode=DATA_M;
1071  Wifly_close();
1072 
1073  }
1074  xSemaphoreGiveRecursive( xMutexWifly );
1075  return TRUE;
1076  }
1077  xSemaphoreGiveRecursive( xMutexWifly );
1078  return FALSE;
1079 }
1080 //TODO
1081 void Wifly_TCPTimeOpen(uint32_t time, char *address, uint32_t remotePort, char *exResp , const char * restrict command,...)
1082 {
1083  char string[128];
1084  uint8_t attempts=0;
1085  uint32_t timeSec=time*1000;
1086  va_list arg;
1087 
1088 
1089  while(WiflyTCPAutoConnect==TRUE)
1090  {
1091  va_start( arg, command);
1092  vsprintf(string, command, arg);
1093  while((Wifly_TCPSend(address, remotePort, exResp , string)==FALSE)&& attempts<3)
1094  {
1095  attempts++;
1096  }
1097  attempts=0;
1098  va_end(arg);
1099  PrintF_delayMs(timeSec);
1100  }
1101  return;
1102 }
1103 //TODO
1105 {
1106  WiflyTCPAutoConnect=FALSE;
1107 }
1108 
1109 uint8_t Wifly_TCPConfig(char *address, uint32_t port)
1110 {
1111 
1112  if (Wifly_CMD()==TRUE)
1113  {
1114  if(WiflyProtConfig!=MODE_TCP)
1115  {
1116  if(Wifly_setIpProtocol(2)==FALSE) //set ip proto 2, TCP protocol
1117  return FALSE;
1118  if(Wifly_setOptionFormat(0)==FALSE)//set option format
1119  return FALSE;
1120  if(Wifly_setComRemote(HELLO_CON)==FALSE)//set com remote
1121  return FALSE;
1122  WiflyProtConfig=MODE_TCP;
1123  }
1124  if (Wifly_setIpHost(address)==FALSE)// set ip host
1125  return FALSE;
1126  if(Wifly_setIpRemote(port)==FALSE)//set remote port
1127  return FALSE;
1128  return TRUE;
1129  }
1130  return FALSE;
1131 }
1132 
1133 uint8_t Wifly_APMode(char *ssid, uint8_t channel)
1134 {
1135 
1136  if(Wifly_CMD()==TRUE) //Check the module is in command mode
1137  {
1138  if(Wifly_SendSet(SET_DELAY, AOK, AP_MODE ,ssid, channel)==TRUE)//Send COMMAND
1139  return TRUE;
1140  }
1141  return FALSE;
1142 }
1143 
1144 uint8_t Wifly_ConfigAPMode(char *ssid, uint8_t channel,char *ipAddress, char *subnetMask, char *gateway)
1145 {
1146  double ver;
1147 
1148  ver=Wifly_getVer();
1149  if(ver>=2.45)
1150  {
1151  if (Wifly_CMD()==TRUE)
1152  {
1153  xSemaphoreTakeRecursive( xMutexWifly, portMAX_DELAY );
1154  {
1155  if(WiflyWlanConn!=WLAN_APCON)
1156  {
1157  if(Wifly_setWlanJoin(7)==FALSE) //set wlan join
1158  return FALSE;
1159  if (Wifly_setWlanChannel(channel)==FALSE)// set wlan channel
1160  return FALSE;
1161  if(Wifly_setWlanSSID(ssid)==FALSE)//set wlan ssid
1162  return FALSE;
1163  if(Wifly_setIpDHCP(4)==FALSE)//set DHCP
1164  return FALSE;
1165  if(Wifly_setIpAddress(ipAddress)==FALSE)//set IP address
1166  return FALSE;
1167  if(Wifly_setIpNET(subnetMask)==FALSE)//set IP subnet mask
1168  return FALSE;
1169  if(Wifly_setIpGateway(gateway)==FALSE)//set IP gateway
1170  return FALSE;
1171  if(Wifly_save()==FALSE)//save settings
1172  return FALSE;
1173  Wifly_reset(RESET_SOFTWARE);//reset module
1174  WiflyWlanConn=WLAN_APCON;
1175  }
1176  }
1177  xSemaphoreGiveRecursive( xMutexWifly );
1178  return TRUE;
1179  }
1180  }
1181  else
1182  Log_log( wiflyLogSev, LV_ERR, "Soft AP not compatible with this version:ver= %f",ver);
1183  return FALSE;
1184 }
#define UDP_DELAY
Definition: WiFly.h:59
#define SET_WLAN_JOIN
Definition: WiFly.c:51
uint8_t Wifly_setWlanJoin(uint32_t value)
Definition: WiFly.c:702
uint32_t Log_start(uint32_t PortNum, uint32_t baudrate)
Definition: Log.c:28
#define SET_DELAY
Definition: WiFly.h:54
#define MODE_TCP
TCP Protocol configured.
Definition: WiFly.h:28
#define SET_WLAN_TX
Definition: WiFly.c:45
#define CMD
Definition: WiFly.h:65
uint8_t Wifly_logStart(uint32_t PortNum, uint32_t baudrate, uint32_t logSeverity)
Definition: WiFly.c:249
uint8_t Wifly_setIpnetmask(char *address)
Definition: WiFly.c:578
#define SET_WLAN_AUTH
Definition: WiFly.c:47
#define SET_UART_INST
Definition: WiFly.c:43
uint8_t Wifly_ChangeBaudRate(uint32_t baudrate)
Definition: WiFly.c:274
#define READY
Definition: WiFly.h:64
uint8_t Wifly_HTTPConfig(char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
Definition: WiFly.c:932
#define CMD_DELAY
Definition: WiFly.h:51
uint8_t Wifly_APMode(char *ssid, uint8_t channel)
Definition: WiFly.c:1133
#define SHOW_TIME
Definition: WiFly.c:65
#define SET_UART_BAUD
Definition: WiFly.c:42
void PrintF_ClBuffUart(uint8_t portNum)
Definition: PrintF.c:258
char * Wifly_HTTPReceive(char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
Definition: WiFly.c:891
uint8_t Wifly_start(uint32_t PortNum, uint32_t baudrate)
Definition: WiFly.c:224
#define JOIN_DELAY
Definition: WiFly.h:53
#define OPEN_CONN
Definition: WiFly.c:78
#define SET_IP_GATEWAY
Definition: WiFly.c:30
#define REBOOT
Definition: WiFly.c:79
double Wifly_getVer()
Definition: WiFly.c:860
uint8_t Wifly_setWlanPhrase(char *password)
Definition: WiFly.c:722
#define OPEN_DELAY
Definition: WiFly.h:58
uint8_t Wifly_setIpNET(char *address)
Definition: WiFly.c:528
uint8_t Wifly_WLANConnectPing(uint32_t AuthMode, char *ssid, char *passw, char *pingIP)
Definition: WiFly.c:408
#define AP_MODE
Definition: WiFly.c:70
#define LEAVE
Definition: WiFly.c:76
#define FACTORY_RESET
Definition: WiFly.c:80
char string[LOGBUFSIZE]
Definition: Log.c:25
#define LV_INFO
Definition: Log.h:20
#define PING
Definition: WiFly.c:77
#define AOK
Definition: WiFly.h:67
uint8_t Wifly_ping(char *ip)
Definition: WiFly.c:465
void Log_log(uint8_t severity, uint8_t logLevel, const char *restrict format,...)
Definition: Log.c:61
char * Wifly_getWlan()
Definition: WiFly.c:845
#define SET_WLAN_CHAN
Definition: WiFly.c:52
uint8_t Wifly_open(char *dnsAddress, uint32_t port)
Definition: WiFly.c:478
uint8_t Wifly_setWlanSSID(char *value)
Definition: WiFly.c:732
#define WEP
WEP-128.
Definition: WiFly.h:40
#define SET_IP_HOST
Definition: WiFly.c:31
void PrintF_scan(uint8_t port, char *string, uint32_t timeout)
Definition: PrintF.c:206
uint8_t Wifly_setIpProtocol(uint32_t value)
Definition: WiFly.c:588
#define SET_WLAN_SSID
Definition: WiFly.c:50
#define PING_DELAY
Definition: WiFly.h:56
#define HELLO_CON
Definition: WiFly.h:71
#define SET_IP_LOCAL_PORT
Definition: WiFly.c:32
#define DATA_M
Wifly data mode */.
Definition: WiFly.h:13
#define LV_TRACE
Definition: Log.h:19
#define SHOW_CONNECTION
Definition: WiFly.c:66
uint8_t Wifly_leave()
Definition: WiFly.c:414
char * Wifly_TCPReceive(char *address, uint32_t remotePort, const char *restrict command,...)
Definition: WiFly.c:1026
#define FALSE
Definition: type.h:22
#define PING_OK
Definition: WiFly.h:69
#define GET_VER
Definition: WiFly.c:61
uint8_t Wifly_setWlanTX(uint32_t tx)
Definition: WiFly.c:672
#define MODE_HTTP
HTTP Protocol configured.
Definition: WiFly.h:29
#define SET_IP_REMOTE
Definition: WiFly.c:36
uint8_t Wifly_save()
Definition: WiFly.c:340
uint8_t Wifly_setWlanAuth(uint32_t value)
Definition: WiFly.c:682
void Wifly_TCPTimeOpen(uint32_t time, char *address, uint32_t remotePort, char *exResp, const char *restrict command,...)
Definition: WiFly.c:1081
#define SET_IP_ADDRESS
Definition: WiFly.c:26
#define SLEEP
Definition: WiFly.c:81
#define WLAN_DISCON
Wlan disconnected.
Definition: WiFly.h:21
#define WIFLYBUFSIZE
Definition: WiFly.h:33
#define WPA2
WPA2-PSK.
Definition: WiFly.h:43
#define TRUE
Definition: type.h:26
uint8_t Wifly_TCPSend(char *address, uint32_t remotePort, char *exResp, const char *restrict command,...)
Definition: WiFly.c:1053
uint8_t PrintF_ChkScan(uint8_t portNum, char *strScan, char *strExp, uint32_t timeout)
Definition: PrintF.c:244
void Wifly_reset(uint8_t typeReset)
Definition: WiFly.c:299
#define SET_IP_DHCP
Definition: WiFly.c:28
uint8_t Wifly_TCPConfig(char *address, uint32_t port)
Definition: WiFly.c:1109
#define CHG_DT
Definition: WiFly.c:72
#define SET_COM_REM
Definition: WiFly.c:39
#define GET_IP
Definition: WiFly.c:59
#define NULL
Definition: type.h:18
uint8_t Wifly_close()
Definition: WiFly.c:493
#define TCP_DELAY
Definition: WiFly.h:60
uint8_t Wifly_setUartInstant(uint32_t value)
Definition: WiFly.c:648
#define SET_IP_TCP_MODE
Definition: WiFly.c:37
uint8_t Wifly_sleep()
Definition: WiFly.c:358
#define RESET_SOFTWARE
Software reset mode */.
Definition: WiFly.h:18
#define SET_UART_MD
Definition: WiFly.c:41
uint32_t Wifly_showConnection()
Definition: WiFly.c:876
#define SET_WLAN_KEY
Definition: WiFly.c:48
#define OPEN_CON
Definition: WiFly.h:70
#define SET_IP_NET
Definition: WiFly.c:33
uint8_t Wifly_setIpFlags(uint32_t mask)
Definition: WiFly.c:538
uint8_t Wifly_setIpGateway(char *address)
Definition: WiFly.c:548
uint8_t Wifly_getChannel()
Definition: WiFly.c:766
uint8_t Wifly_factoryReset()
Definition: WiFly.c:349
#define GET_WLAN
Definition: WiFly.c:60
char * Wifly_getIp()
Definition: WiFly.c:752
uint8_t Wifly_setOptionFormat(uint32_t value)
Definition: WiFly.c:628
char * Wifly_UDPReceive(char *address, uint32_t localPort, uint32_t remotePort, const char *restrict command,...)
Definition: WiFly.c:955
#define HTTP_HEAD
Definition: WiFly.h:74
xSemaphoreHandle xMutexWifly
Definition: WiFly.c:87
uint8_t Wifly_setWlanKey(char *value)
Definition: WiFly.c:712
uint8_t Wifly_setIpRemote(uint32_t value)
Definition: WiFly.c:598
#define CHG_CMD
Definition: WiFly.c:71
uint8_t Wifly_getTx()
Definition: WiFly.c:783
#define MODE_UDP
UDP Protocol configured.
Definition: WiFly.h:27
#define JOIN
Definition: WiFly.c:75
uint32_t Wifly_getTime()
Definition: WiFly.c:814
uint8_t Wifly_ConfigAPMode(char *ssid, uint8_t channel, char *ipAddress, char *subnetMask, char *gateway)
Definition: WiFly.c:1144
#define CMD_M
Wifly command mode */.
Definition: WiFly.h:14
void PrintF_delayMs(uint32_t ms)
Definition: PrintF.c:278
#define SAVE_OK
Definition: WiFly.h:75
#define RESET_HARDWARE
Hardware reset mode */.
Definition: WiFly.h:17
uint8_t Wifly_setDNSName(char *name)
Definition: WiFly.c:742
uint8_t Wifly_setUartMode(uint32_t value)
Definition: WiFly.c:638
uint8_t Wifly_UDPSend(char *address, uint32_t localPort, uint32_t remotePort, char *exResp, const char *restrict command,...)
Definition: WiFly.c:978
#define SAVE
Definition: WiFly.c:84
void Wifly_TCPTimeOpenDisc()
Definition: WiFly.c:1104
void PrintF_print(uint32_t portNum, const char *restrict format,...)
Definition: PrintF.c:137
#define SET_IP_NETMASK
Definition: WiFly.c:34
#define SET_DNS_NAME
Definition: WiFly.c:53
#define WLAN_CON
Wlan connected.
Definition: WiFly.h:22
uint8_t Wifly_setComRemote(char *value)
Definition: WiFly.c:618
#define WLAN_PING_CHECK
Definition: Config.h:62
uint8_t Wifly_setIpTcpMode(uint32_t value)
Definition: WiFly.c:608
#define WLAN_APCON
AP connected.
Definition: WiFly.h:23
uint8_t Wifly_setIpAddress(char *address)
Definition: WiFly.c:508
#define LV_ERR
Definition: Log.h:21
uint8_t Wifly_setUartBaud(uint32_t value)
Definition: WiFly.c:660
#define SET_WLAN_PHRASE
Definition: WiFly.c:49
#define SET_IP_PROTO
Definition: WiFly.c:35
uint8_t Wifly_WLANConfigConnect(uint32_t AuthMode, char *ssid, char *passw)
Definition: WiFly.c:428
uint8_t Wifly_WLANConnect(uint32_t AuthMode, char *ssid, char *passw)
Definition: WiFly.c:367
#define MODE_DISCON
Protocol not configured.
Definition: WiFly.h:26
#define SHOW_RSSI
Definition: WiFly.c:64
#define RST_DELAY
Definition: WiFly.h:52
#define ECHO_DELAY
Definition: WiFly.h:55
#define WPA1
WPA1.
Definition: WiFly.h:41
uint32_t PrintF_start(uint32_t portNum, uint32_t baudRate)
Definition: PrintF.c:27
uint8_t Wifly_HTTPSend(char *dnsAddress, char *getCommand, uint32_t port, uint8_t proto)
Definition: WiFly.c:912
uint8_t Wifly_setIpLocalPort(uint32_t value)
Definition: WiFly.c:568
#define UART_MD
Definition: WiFly.h:47
#define RST_WIFLY_PIN
Definition: WiFly.h:36
uint8_t Wifly_setIpDHCP(uint8_t mode)
Definition: WiFly.c:518
char * Wifly_getMac()
Definition: WiFly.c:829
#define SET_OP_FORMAT
Definition: WiFly.c:40
uint8_t Wifly_setIpHost(char *address)
Definition: WiFly.c:558
uint8_t Wifly_UDPConfig(char *address, uint32_t localPort, uint32_t remotePort)
Definition: WiFly.c:1002
int32_t Wifly_getRSSI()
Definition: WiFly.c:799
#define CLOSE_CON
Definition: WiFly.h:72
#define GET_DELAY
Definition: WiFly.h:57
#define GET_MAC
Definition: WiFly.c:58
#define CLOSE
Definition: WiFly.c:74
#define SET_IP_FLAGS
Definition: WiFly.c:29
uint8_t Wifly_setWlanChannel(uint8_t value)
Definition: WiFly.c:692
#define MIXED
Mixed WPA1 and WPA2-SK.
Definition: WiFly.h:42
#define EXIT
Definition: WiFly.h:66
#define JOIN_OK
Definition: WiFly.h:68