소스 검색

format codes

Meco Man 4 년 전
부모
커밋
3742312281
38개의 변경된 파일338개의 추가작업 그리고 338개의 파일을 삭제
  1. 23 23
      class/a9g/at_device_a9g.c
  2. 12 12
      class/a9g/at_device_a9g.h
  3. 18 18
      class/a9g/at_socket_a9g.c
  4. 2 2
      class/air720/at_device_air720.h
  5. 2 2
      class/air720/at_socket_air720.c
  6. 1 1
      class/bc26/at_device_bc26.h
  7. 11 11
      class/bc26/at_socket_bc26.c
  8. 26 26
      class/bc28/at_device_bc28.c
  9. 15 15
      class/bc28/at_socket_bc28.c
  10. 44 44
      class/ec200x/at_device_ec200x.c
  11. 1 1
      class/ec200x/at_device_ec200x.h
  12. 11 11
      class/ec200x/at_socket_ec200x.c
  13. 1 1
      class/esp32/at_device_esp32.c
  14. 1 1
      class/esp8266/at_device_esp8266.c
  15. 2 2
      class/l610/at_device_l610.c
  16. 1 1
      class/l610/at_device_l610.h
  17. 2 2
      class/l610/at_socket_l610.c
  18. 1 1
      class/m26/at_socket_m26.c
  19. 4 4
      class/m5311/at_device_m5311.c
  20. 2 2
      class/m5311/at_device_m5311.h
  21. 1 1
      class/m5311/at_socket_m5311.c
  22. 16 16
      class/m6315/at_device_m6315.c
  23. 5 5
      class/m6315/at_socket_m6315.c
  24. 49 49
      class/me3616/at_device_me3616.c
  25. 1 1
      class/me3616/at_device_me3616.h
  26. 18 18
      class/me3616/at_socket_me3616.c
  27. 1 1
      class/n21/at_device_n21.h
  28. 1 1
      class/n58/at_device_n58.h
  29. 46 46
      class/n720/at_device_n720.c
  30. 1 1
      class/n720/at_device_n720.h
  31. 7 7
      class/n720/at_socket_n720.c
  32. 2 2
      class/sim76xx/at_socket_sim76xx.c
  33. 3 3
      class/sim800c/at_socket_sim800c.c
  34. 2 2
      class/w60x/at_device_w60x.c
  35. 1 1
      samples/at_sample_air720.c
  36. 2 2
      samples/at_sample_m5311.c
  37. 1 1
      samples/at_sample_n21.c
  38. 1 1
      samples/at_sample_n58.c

+ 23 - 23
class/a9g/at_device_a9g.c

@@ -30,7 +30,7 @@
 
 #define LOG_TAG                    "at.dev.a9g"
 #include <at_log.h>
- 
+
 #ifdef AT_DEVICE_USING_A9G
 
 #define A9G_WAIT_CONNECT_TIME      5000
@@ -107,7 +107,7 @@ static int a9g_netdev_set_info(struct netdev *netdev)
     ip_addr_t addr;
     at_response_t resp = RT_NULL;
     struct at_device *device = RT_NULL;
-	
+
     RT_ASSERT(netdev);
 
     device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, netdev->name);
@@ -175,7 +175,7 @@ static int a9g_netdev_set_info(struct netdev *netdev)
         char ipaddr[IP_ADDR_SIZE_MAX] = {0};
 
         at_resp_set_info(resp, A9G_IPADDR_RESP_SIZE, 2, A9G_INFO_RESP_TIMO);
-		
+
         /* send "AT+CIFSR" commond to get IP address */
         if (at_obj_exec_cmd(device->client, resp, "AT+CIFSR") < 0)
         {
@@ -234,7 +234,7 @@ __exit:
     {
         at_delete_resp(resp);
     }
-    
+
     return result;
 }
 
@@ -301,7 +301,7 @@ static int a9g_netdev_check_link_status(struct netdev *netdev)
 
     rt_snprintf(tname, RT_NAME_MAX, "%s_link", netdev->name);
 
-    tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev, 
+    tid = rt_thread_create(tname, check_link_status_entry, (void *) netdev,
             a9g_LINK_THREAD_STACK_SIZE, a9g_LINK_THREAD_PRIORITY, a9g_LINK_THREAD_TICK);
     if (tid)
     {
@@ -328,7 +328,7 @@ static int a9g_netdev_set_up(struct netdev *netdev)
     {
         a9g_net_init(device);
         device->is_init = RT_TRUE;
-        
+
         netdev_low_level_set_status(netdev, RT_TRUE);
         LOG_D("the network interface device(%s) set up status.", netdev->name);
     }
@@ -429,7 +429,7 @@ static int a9g_ping_domain_resolve(struct at_device *device, const char *name, c
         result = -RT_ERROR;
         goto __exit;
     }
-	
+
     if (at_resp_parse_line_args_by_kw(resp, "+CDNSGIP:", "%*[^,],%*[^,],\"%[^\"]", recv_ip) < 0)
     {
         rt_thread_mdelay(100);
@@ -458,7 +458,7 @@ __exit:
 
 #ifdef NETDEV_USING_PING
 #ifdef AT_DEVICE_USING_A9G
-static int a9g_netdev_ping(struct netdev *netdev, const char *host, 
+static int a9g_netdev_ping(struct netdev *netdev, const char *host,
         size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp)
 {
     rt_kprintf("I don't have PING function!\r\n");
@@ -469,7 +469,7 @@ static int a9g_netdev_ping(struct netdev *netdev, const char *host,
 
 #ifdef NETDEV_USING_NETSTAT
 void a9g_netdev_netstat(struct netdev *netdev)
-{ 
+{
     // TODO netstat support
 }
 #endif /* NETDEV_USING_NETSTAT */
@@ -602,15 +602,15 @@ static void a9g_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-		
-		/* make the device restart */
+
+        /* make the device restart */
         AT_SEND_CMD(client, resp, 0, 300, "AT+RST=1");
         for(i = 0; i<=30; i++)
         {
             i++;
             rt_thread_mdelay(1000);
         }
-		
+
         /* waiting for dirty data to be digested */
         rt_thread_mdelay(1000);
 
@@ -644,7 +644,7 @@ static void a9g_init_thread_entry(void *parameter)
             }
             rt_thread_mdelay(1000);
         }
-        
+
         /* check the GPRS network is registered */
         for (i = 0; i < CGREG_RETRY; i++)
         {
@@ -658,14 +658,14 @@ static void a9g_init_thread_entry(void *parameter)
                 }
                 rt_thread_mdelay(1000);
             }
-			
+
             AT_SEND_CMD(client, resp, 0, 1000, "AT+CGDCONT=1,\"IP\",\"CMNET\"");
             rt_thread_mdelay(10);
             AT_SEND_CMD(client, resp, 0, 5 * 1000, "AT+CGACT=1,1");
             rt_thread_mdelay(10);
             at_resp_parse_line_args_by_kw(resp, "OK", "%s", &parsed_data);
-            
-			if (!strncmp(parsed_data, "OK", sizeof(parsed_data)))
+
+            if (!strncmp(parsed_data, "OK", sizeof(parsed_data)))
             {
                 LOG_D("a9g device(%s) GPRS network is registered(%s).", device->name, parsed_data);
                 break;
@@ -736,7 +736,7 @@ static void a9g_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-#ifdef	AT_USING_A9G_GPS
+#ifdef  AT_USING_A9G_GPS
         AT_SEND_CMD(client, resp, 0, 300, "AT+GPS?");
         at_resp_parse_line_args_by_kw(resp, "+GPS:", "+GPS: %d", &qimux);
         if (qimux == 0)
@@ -769,7 +769,7 @@ __exit:
     if (result == RT_EOK)
     {
         device->is_init = RT_TRUE;
-        
+
         /* set network interface device status and address information */
         a9g_netdev_set_info(device->netdev);
         /*  */
@@ -781,7 +781,7 @@ __exit:
     else
     {
         device->is_init = RT_FALSE;
-        
+
         netdev_low_level_set_status(device->netdev, RT_FALSE);
         LOG_E("a9g device(%s) network initialize failed(%d)!", device->name, result);
     }
@@ -818,7 +818,7 @@ static void urc_func(struct at_client *client, const char *data, rt_size_t size)
 }
 
 /* a9g device URC table for the device control */
-static const struct at_urc urc_table[] = 
+static const struct at_urc urc_table[] =
 {
         {"READY",         "\r\n",                 urc_func},
 };
@@ -851,8 +851,8 @@ static int a9g_init(struct at_device *device)
         LOG_E("a9g device(%s) initialize failed, get network interface device failed.", a9g->device_name);
         return -RT_ERROR;
     }
-	
-	/* initialize a9g pin configuration */
+
+    /* initialize a9g pin configuration */
     if (a9g->power_pin != -1 && a9g->power_status_pin != -1)
     {
         rt_pin_mode(a9g->power_pin, PIN_MODE_OUTPUT);
@@ -898,7 +898,7 @@ static int a9g_control(struct at_device *device, int cmd, void *arg)
     return result;
 }
 
-const struct at_device_ops a9g_device_ops = 
+const struct at_device_ops a9g_device_ops =
 {
     a9g_init,
     a9g_deinit,

+ 12 - 12
class/a9g/at_device_a9g.h

@@ -21,7 +21,7 @@
  * Date           Author       Notes
  * 2019-11-23     luliang    first version
  */
- 
+
 #ifndef __A9G_DEVICE_H__
 #define __A9G_DEVICE_H__
 
@@ -34,19 +34,19 @@ extern "C" {
 #include <at_device.h>
 
 /* The maximum number of sockets supported by the a9g device */
-#define AT_DEVICE_A9G_SOCKETS_NUM		8
+#define AT_DEVICE_A9G_SOCKETS_NUM       8
 
 struct at_device_a9g
 {
-	char *device_name;
-	char *client_name;
-	
-	int power_pin;
-	int power_status_pin;
-	size_t recv_line_num;
-	struct at_device device;
-	
-	void *user_data;
+    char *device_name;
+    char *client_name;
+
+    int power_pin;
+    int power_status_pin;
+    size_t recv_line_num;
+    struct at_device device;
+
+    void *user_data;
 };
 
 #ifdef AT_USING_SOCKET
@@ -64,4 +64,4 @@ int a9g_socket_class_register(struct at_device_class *class);
 #endif
 
 
-#endif	/*	__AT_DEVICE_A9G_H__*/
+#endif  /*  __AT_DEVICE_A9G_H__*/

+ 18 - 18
class/a9g/at_socket_a9g.c

@@ -21,7 +21,7 @@
  * Date           Author       Notes
  * 2019-11-23     luliang    first version
  */
- 
+
 #include <stdio.h>
 #include <string.h>
 
@@ -85,15 +85,15 @@ static int a9g_socket_close(struct at_socket *socket)
     at_response_t resp = RT_NULL;
     int device_socket = (int) socket->user_data;
     struct at_device *device = (struct at_device *) socket->device;
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(600));
-    
+
     if (resp == RT_NULL)
     {
         LOG_E("no memory for a9g device(%s) response creat.", device->name);
         return -RT_ENOMEM;
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT+CIPCLOSE=%d", device_socket) < 0)
     {
         result = -RT_ERROR;
@@ -105,7 +105,7 @@ __exit:
     {
         at_delete_resp(resp);
     }
-    
+
     return result;
 }
 
@@ -175,7 +175,7 @@ __retry:
             result = -RT_ERROR;
             goto __exit;
         }
-			}
+            }
 
     /* waiting result event from AT URC, the device default connection timeout is 75 seconds, but it set to 10 seconds is convenient to use */
     if (a9g_socket_event_recv(device, SET_EVENT(device_socket, 0), 10 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
@@ -185,7 +185,7 @@ __retry:
         goto __exit;
     }
     /* waiting OK or failed result */
-    event_result = a9g_socket_event_recv(device, 
+    event_result = a9g_socket_event_recv(device,
             A9G_EVENT_CONN_OK | A9G_EVENT_CONN_FAIL, 1 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
     if (event_result < 0)
     {
@@ -198,7 +198,7 @@ __retry:
     {
         if (retryed == RT_FALSE)
         {
-            LOG_D("a9g device(%s) socket(%d) connect failed, maybe the socket was not be closed at the last time and now will retry.", 
+            LOG_D("a9g device(%s) socket(%d) connect failed, maybe the socket was not be closed at the last time and now will retry.",
                     device->name, device_socket);
             if (a9g_socket_close(socket) < 0)
             {
@@ -218,7 +218,7 @@ __exit:
     {
         at_delete_resp(resp);
     }
-    
+
     return result;
 }
 
@@ -268,14 +268,14 @@ static int a9g_socket_send(struct at_socket *socket, const char *buff, size_t bf
         {
             cur_pkt_size = A9G_MODULE_SEND_MAX_SIZE;
         }
-		
+
         /* send the "AT+CIPSEND" commands to AT server than receive the '>' response on the first line. */
         if (at_obj_exec_cmd(device->client, resp, "AT+CIPSEND=%d,%d", device_socket, cur_pkt_size) < 0)
         {
             result = -RT_ERROR;
             goto __exit;
         }
-		
+
         /* send the real data to server or client */
         result = (int) at_client_obj_send(device->client, buff + sent_size, cur_pkt_size);
         if (result == 0)
@@ -283,8 +283,8 @@ static int a9g_socket_send(struct at_socket *socket, const char *buff, size_t bf
             result = -RT_ERROR;
             goto __exit;
         }
-		
-		/* waiting OK or failed result */
+
+        /* waiting OK or failed result */
         at_resp_set_info(resp, 128, 0, 30 * RT_TICK_PER_SECOND);
         if (at_obj_exec_cmd(device->client, resp, "") < 0)
         {
@@ -369,9 +369,9 @@ static int a9g_domain_resolve(const char *name, char ip[16])
                 goto __exit;
             }
         }
-				
+
         /* parse the third line of response data, get the IP address */
-				if (at_resp_parse_line_args_by_kw(resp, "+CDNSGIP:", "%*[^,],%*[^,],\"%[^\"]", recv_ip) < 0)
+                if (at_resp_parse_line_args_by_kw(resp, "+CDNSGIP:", "%*[^,],%*[^,],\"%[^\"]", recv_ip) < 0)
         {
             rt_thread_mdelay(100);
             /* resolve failed, maybe receive an URC CRLF */
@@ -398,7 +398,7 @@ __exit:
     {
         at_delete_resp(resp);
     }
-		
+
     return result;
 }
 
@@ -582,7 +582,7 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t
 }
 
 /* A9G device URC table for the socket data */
-static const struct at_urc urc_table[] = 
+static const struct at_urc urc_table[] =
 {
     {"",            "CONNECT OK\r\n",      urc_connect_func},
     {"",            ",CONNECT FAIL\r\n",   urc_connect_func},
@@ -591,7 +591,7 @@ static const struct at_urc urc_table[] =
     {"+CIPRCV,",    "\r\n",                urc_recv_func},
 };
 
-static const struct at_socket_ops a9g_socket_ops = 
+static const struct at_socket_ops a9g_socket_ops =
 {
     a9g_socket_connect,
     a9g_socket_close,

+ 2 - 2
class/air720/at_device_air720.h

@@ -34,10 +34,10 @@ extern "C" {
 #include <at_device.h>
 
 /* The maximum number of sockets supported by the air720 device */
-#define AT_DEVICE_AIR720_SOCKETS_NUM      6  
+#define AT_DEVICE_AIR720_SOCKETS_NUM      6
 
 struct at_device_air720
-{     
+{
     char *device_name;
     char *client_name;
 

+ 2 - 2
class/air720/at_socket_air720.c

@@ -624,8 +624,8 @@ static void urc_dataaccept_func(struct at_client *client, const char *data, rt_s
     }
 
     /* get the current socket by receive data */
-	sscanf(data, "DATA ACCEPT:%d,%d", &device_socket, (int *)&bfsz);
-	
+    sscanf(data, "DATA ACCEPT:%d,%d", &device_socket, (int *)&bfsz);
+
     air720_socket_event_send(device, SET_EVENT(device_socket, AIR720_EVENT_SEND_OK));
 }
 

+ 1 - 1
class/bc26/at_device_bc26.h

@@ -48,7 +48,7 @@ struct at_device_bc26
 
     void *socket_data;
     void *user_data;
-    
+
     rt_bool_t power_status;
     rt_bool_t sleep_status;
 };

+ 11 - 11
class/bc26/at_socket_bc26.c

@@ -129,7 +129,7 @@ static int bc26_socket_close(struct at_socket *socket)
         LOG_E("no memory for resp create.");
         return -RT_ENOMEM;
     }
-    
+
     result = at_obj_exec_cmd(device->client, resp, "AT+QICLOSE=%d", device_socket);
 
     at_delete_resp(resp);
@@ -198,7 +198,7 @@ static int bc26_socket_connect(struct at_socket *socket, char *ip, int32_t port,
         event = SET_EVENT(device_socket, BC26_EVENT_CONN_OK | BC26_EVENT_CONN_FAIL);
         bc26_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR);
 
-        if (at_obj_exec_cmd(device->client, resp, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,1", 
+        if (at_obj_exec_cmd(device->client, resp, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,1",
                             device_socket, type_str, ip, port) < 0)
         {
             result = -RT_ERROR;
@@ -206,7 +206,7 @@ static int bc26_socket_connect(struct at_socket *socket, char *ip, int32_t port,
         }
 
         /* waiting result event from AT URC, the device default connection timeout is 60 seconds*/
-        if (bc26_socket_event_recv(device, SET_EVENT(device_socket, 0), 
+        if (bc26_socket_event_recv(device, SET_EVENT(device_socket, 0),
                                     60 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
         {
             LOG_E("%s device socket(%d) wait connect result timeout.", device->name, device_socket);
@@ -214,7 +214,7 @@ static int bc26_socket_connect(struct at_socket *socket, char *ip, int32_t port,
             break;
         }
         /* waiting OK or failed result */
-        event_result = bc26_socket_event_recv(device, BC26_EVENT_CONN_OK | BC26_EVENT_CONN_FAIL, 
+        event_result = bc26_socket_event_recv(device, BC26_EVENT_CONN_OK | BC26_EVENT_CONN_FAIL,
                                                 1 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
         if (event_result < 0)
         {
@@ -228,7 +228,7 @@ static int bc26_socket_connect(struct at_socket *socket, char *ip, int32_t port,
             result = RT_EOK;
             break;
         }
-        
+
         LOG_D("%s device socket(%d) connect failed, the socket was not be closed and now will connect retry.",
                     device->name, device_socket);
         if (bc26_socket_close(socket) < 0)
@@ -243,7 +243,7 @@ static int bc26_socket_connect(struct at_socket *socket, char *ip, int32_t port,
         LOG_E("%s device socket(%d) connect failed.", device->name, device_socket);
         result = -RT_ERROR;
     }
-    
+
     if (resp)
     {
         at_delete_resp(resp);
@@ -369,9 +369,9 @@ static int bc26_socket_send(struct at_socket *socket, const char *buff, size_t b
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         rt_thread_mdelay(5);//delay at least 4ms
-        
+
         /* send the real data to server or client */
         result = (int) at_client_obj_send(device->client, buff + sent_size, cur_pkt_size);
         if (result == 0)
@@ -468,7 +468,7 @@ static int bc26_domain_resolve(const char *name, char ip[16])
 
     /* clear BC26_EVENT_DOMAIN_OK */
     bc26_socket_event_recv(device, BC26_EVENT_DOMAIN_OK, 0, RT_EVENT_FLAG_OR);
-    
+
     bc26 = (struct at_device_bc26 *) device->user_data;
     bc26->socket_data = ip;
 
@@ -571,7 +571,7 @@ static void urc_send_func(struct at_client *client, const char *data, rt_size_t
         LOG_E("get device(%s) failed.", client_name);
         return;
     }
-    
+
     bc26 = (struct at_device_bc26 *) device->user_data;
     device_socket = (int) bc26->user_data;
 
@@ -696,7 +696,7 @@ static void urc_dnsqip_func(struct at_client *client, const char *data, rt_size_
         LOG_E("get device(%s) failed.", client_name);
         return;
     }
-    
+
     bc26 = (struct at_device_bc26 *) device->user_data;
     if (bc26->socket_data == RT_NULL)
     {

+ 26 - 26
class/bc28/at_device_bc28.c

@@ -2,7 +2,7 @@
  * File      : at_device_bc28.c
  * This file is part of RT-Thread RTOS
  * Copyright (c) 2020, RudyLo <luhuadong@163.com>
- * 
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
@@ -67,7 +67,7 @@ static int bc28_check_link_status(struct at_device *device)
     at_response_t resp = RT_NULL;
     struct at_device_bc28 *bc28 = RT_NULL;
     int result = -RT_ERROR;
-    
+
     bc28 = (struct at_device_bc28 *)device->user_data;
 
     if ( ! bc28->power_status) // power off
@@ -85,7 +85,7 @@ static int bc28_check_link_status(struct at_device *device)
             rt_thread_mdelay(200);
         }
     }
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
@@ -106,7 +106,7 @@ static int bc28_check_link_status(struct at_device *device)
         }
     }
 
-    at_delete_resp(resp);    
+    at_delete_resp(resp);
     return(result);
 }
 
@@ -158,14 +158,14 @@ static int bc28_netdev_set_info(struct netdev *netdev)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (at_resp_parse_line_args(resp, 2, "+CGSN:%s", imei) <= 0)
         {
             LOG_E("%s device prase \"AT+CGSN=1\" cmd error.", device->name);
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         LOG_D("%s device IMEI number: %s", device->name, imei);
 
         netdev->hwaddr_len = BC28_NETDEV_HWADDR_LEN;
@@ -186,7 +186,7 @@ static int bc28_netdev_set_info(struct netdev *netdev)
     /* set network interface device IP address */
     {
         char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-        
+
         /* send "AT+CGPADDR" commond to get IP address */
         if (at_obj_exec_cmd(device->client, resp, "AT+CGPADDR") != RT_EOK)
         {
@@ -213,7 +213,7 @@ static int bc28_netdev_set_info(struct netdev *netdev)
     {
         #define DNS_ADDR_SIZE_MAX   16
         char dns_server1[DNS_ADDR_SIZE_MAX] = {0}, dns_server2[DNS_ADDR_SIZE_MAX] = {0};
-        
+
         /* send "AT+QIDNSCFG?" commond to get DNS servers address */
         if (at_obj_exec_cmd(device->client, resp, "AT+QIDNSCFG?") != RT_EOK)
         {
@@ -221,8 +221,8 @@ static int bc28_netdev_set_info(struct netdev *netdev)
             goto __exit;
         }
 
-        /* parse response data "PrimaryDns:<pri_dns>" 
-         *                     "SecondaryDns:<sec_dns>" 
+        /* parse response data "PrimaryDns:<pri_dns>"
+         *                     "SecondaryDns:<sec_dns>"
         */
         if (at_resp_parse_line_args_by_kw(resp, "PrimaryDns:", "PrimaryDns: %s", dns_server1) <= 0)
         {
@@ -270,7 +270,7 @@ static void bc28_check_link_status_entry(void *parameter)
         LOG_E("get device(%s) failed.", netdev->name);
         return;
     }
-    
+
     while (1)
     {
         is_link_up = (bc28_check_link_status(device) == RT_EOK);
@@ -447,8 +447,8 @@ static int bc28_netdev_ping(struct netdev *netdev, const char *host,
         }
     }
 #endif
-    
-    if (at_obj_exec_cmd(device->client, resp, "AT+NPING=%s,%d,%d", 
+
+    if (at_obj_exec_cmd(device->client, resp, "AT+NPING=%s,%d,%d",
                         ip_addr, data_len, timeout*1000/RT_TICK_PER_SECOND) < 0)
     {
         result = -RT_ERROR;
@@ -582,7 +582,7 @@ static void bc28_init_thread_entry(void *parameter)
             result = -RT_ETIMEOUT;
             goto __exit;
         }
-        
+
         /* disable echo */
         if (at_obj_exec_cmd(device->client, resp, "ATE0") != RT_EOK)
         {
@@ -598,7 +598,7 @@ static void bc28_init_thread_entry(void *parameter)
             LOG_E(">> AT+QREGSWT=2");
             goto __exit;
         }
-        
+
         /* disable auto connect */
         if (at_obj_exec_cmd(device->client, resp, "AT+NCONFIG=AUTOCONNECT,FALSE") != RT_EOK)
         {
@@ -655,7 +655,7 @@ static void bc28_init_thread_entry(void *parameter)
             LOG_E(">> AT+CEDRXS=0,5");
             goto __exit;
         }
-        
+
         /* disable PSM mode  */
         if (at_obj_exec_cmd(device->client, resp, "AT+CPSMS=0") != RT_EOK)
         {
@@ -679,7 +679,7 @@ static void bc28_init_thread_entry(void *parameter)
             LOG_E(">> AT+CGATT=1");
             goto __exit;
         }
-        
+
         /* Get the baudrate */
         if (at_obj_exec_cmd(device->client, resp, "AT+NATSPEED?") != RT_EOK)
         {
@@ -689,7 +689,7 @@ static void bc28_init_thread_entry(void *parameter)
         }
         at_resp_parse_line_args_by_kw(resp, "+NATSPEED:", "+NATSPEED:%d", &i);
         LOG_D("%s device baudrate %d", device->name, i);
-        
+
         /* get module version */
         if (at_obj_exec_cmd(device->client, resp, "ATI") != RT_EOK)
         {
@@ -701,7 +701,7 @@ static void bc28_init_thread_entry(void *parameter)
         {
             LOG_D("%s", at_resp_get_line(resp, i + 1));
         }
-        
+
         /* check SIM card */
         for (i = 0; i < CPIN_RETRY; i++)
         {
@@ -726,7 +726,7 @@ static void bc28_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CSQ") == RT_EOK)
             {
                 int signal_strength = 0, err_rate = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CSQ:", "+CSQ:%d,%d", &signal_strength, &err_rate) > 0)
                 {
                     if ((signal_strength != 99) && (signal_strength != 0))
@@ -744,7 +744,7 @@ static void bc28_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-                
+
         /* check the GPRS network is registered */
         for (i = 0; i < CGREG_RETRY; i++)
         {
@@ -752,7 +752,7 @@ static void bc28_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CGATT?") == RT_EOK)
             {
                 int link_stat = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CGATT:", "+CGATT:%d", &link_stat) > 0)
                 {
                     if (link_stat == 1)
@@ -769,7 +769,7 @@ static void bc28_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* check the GPRS network IP address */
         for (i = 0; i < IPADDR_RETRY; i++)
         {
@@ -777,7 +777,7 @@ static void bc28_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CGPADDR") == RT_EOK)
             {
                 char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-                
+
                 /* parse response data "+CGPADDR: 0,<IP_address>" */
                 if (at_resp_parse_line_args_by_kw(resp, "+CGPADDR:", "+CGPADDR:%*d,%s", ipaddr) > 0)
                 {
@@ -792,7 +792,7 @@ static void bc28_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* initialize successfully  */
         result = RT_EOK;
         break;
@@ -909,7 +909,7 @@ static int bc28_init(struct at_device *device)
 static int bc28_deinit(struct at_device *device)
 {
     RT_ASSERT(device);
-    
+
     return bc28_netdev_set_down(device->netdev);
 }
 

+ 15 - 15
class/bc28/at_socket_bc28.c

@@ -207,7 +207,7 @@ static int bc28_socket_close(struct at_socket *socket)
         LOG_E("no memory for resp create.");
         return -RT_ENOMEM;
     }
-    
+
     result = at_obj_exec_cmd(device->client, resp, "AT+NSOCL=%d", device_socket);
     if (result < 0)
     {
@@ -217,7 +217,7 @@ static int bc28_socket_close(struct at_socket *socket)
     {
         LOG_D("%s device close socket(%d).", device->name, device_socket);
     }
-    
+
     at_delete_resp(resp);
 
     return result;
@@ -363,7 +363,7 @@ static int bc28_socket_connect(struct at_socket *socket, char *ip, int32_t port,
         }
 
         /* waiting result event from AT URC, the device default connection timeout is 30 seconds*/
-        if (bc28_socket_event_recv(device, SET_EVENT(device_socket, 0), 
+        if (bc28_socket_event_recv(device, SET_EVENT(device_socket, 0),
                                    30 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
         {
             LOG_D("%s device socket(%d) wait connect result timeout.", device->name, device_socket);
@@ -373,7 +373,7 @@ static int bc28_socket_connect(struct at_socket *socket, char *ip, int32_t port,
         }
 
         /* waiting OK or failed result */
-        event_result = bc28_socket_event_recv(device, BC28_EVENT_CONN_OK | BC28_EVENT_CONN_FAIL, 
+        event_result = bc28_socket_event_recv(device, BC28_EVENT_CONN_OK | BC28_EVENT_CONN_FAIL,
                                               1 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
         if (event_result & BC28_EVENT_CONN_FAIL)
         {
@@ -410,7 +410,7 @@ __exit:
  *          -2: waited socket event timeout
  *          -5: no memory
  */
-static int bc28_socket_send(struct at_socket *socket, const char *buff, 
+static int bc28_socket_send(struct at_socket *socket, const char *buff,
                             size_t bfsz, enum at_socket_type type)
 {
     uint32_t event = 0;
@@ -465,7 +465,7 @@ static int bc28_socket_send(struct at_socket *socket, const char *buff,
         {
         case AT_SOCKET_TCP:
             /* AT+NSOSD=<socket>,<length>,<data>[,<flag>[,<sequence>]] */
-            if (at_obj_exec_cmd(device->client, resp, "AT+NSOSD=%d,%d,%s,0x100,1", device_socket, 
+            if (at_obj_exec_cmd(device->client, resp, "AT+NSOSD=%d,%d,%s,0x100,1", device_socket,
                                 (int)cur_pkt_size, hex_data) < 0)
             {
                 result = -RT_ERROR;
@@ -476,7 +476,7 @@ static int bc28_socket_send(struct at_socket *socket, const char *buff,
 
         case AT_SOCKET_UDP:
             /* AT+NSOST=<socket>,<remote_addr>,<remote_port>,<length>,<data>[,<sequence>] */
-            if (at_obj_exec_cmd(device->client, resp, "AT+NSOST=%d,%s,%d,%d,%s,1", device_socket, 
+            if (at_obj_exec_cmd(device->client, resp, "AT+NSOST=%d,%s,%d,%d,%s,1", device_socket,
                                 ip, port, (int)cur_pkt_size, hex_data) < 0)
             {
                 result = -RT_ERROR;
@@ -484,7 +484,7 @@ static int bc28_socket_send(struct at_socket *socket, const char *buff,
             }
             LOG_D("%s device udp socket(%d) send %d bytes to %s:%d.\n>> %s", device->name, device_socket, ip, port, (int)cur_pkt_size, hex_data);
             break;
-        
+
         default:
             LOG_E("not supported send type %d.", type);
             result = -RT_ERROR;
@@ -516,7 +516,7 @@ static int bc28_socket_send(struct at_socket *socket, const char *buff,
         }
 
         /* waiting result event from AT URC, the device default timeout is 60 seconds*/
-        if (bc28_socket_event_recv(device, SET_EVENT(device_socket, 0), 
+        if (bc28_socket_event_recv(device, SET_EVENT(device_socket, 0),
                                    60 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
         {
             LOG_E("%s device socket(%d) wait send result timeout.", device->name, device_socket);
@@ -524,7 +524,7 @@ static int bc28_socket_send(struct at_socket *socket, const char *buff,
             goto __exit;
         }
         /* waiting OK or failed result */
-        event_result = bc28_socket_event_recv(device, BC28_EVENT_SEND_OK | BC28_EVENT_SEND_FAIL, 
+        event_result = bc28_socket_event_recv(device, BC28_EVENT_SEND_OK | BC28_EVENT_SEND_FAIL,
                                               1 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
         if (event_result & BC28_EVENT_SEND_FAIL)
         {
@@ -591,7 +591,7 @@ int bc28_domain_resolve(const char *name, char ip[16])
 
     /* clear BC28_EVENT_DOMAIN_OK */
     bc28_socket_event_recv(device, BC28_EVENT_DOMAIN_OK, 0, RT_EVENT_FLAG_OR);
-    
+
     bc28 = (struct at_device_bc28 *) device->user_data;
     bc28->socket_data = ip;
 
@@ -604,7 +604,7 @@ int bc28_domain_resolve(const char *name, char ip[16])
     for(i = 0; i < RESOLVE_RETRY; i++)
     {
         /* waiting result event from AT URC, the device default connection timeout is 30 seconds.*/
-        event_result = bc28_socket_event_recv(device, BC28_EVENT_DOMAIN_OK | BC28_EVENT_DOMAIN_FAIL, 
+        event_result = bc28_socket_event_recv(device, BC28_EVENT_DOMAIN_OK | BC28_EVENT_DOMAIN_FAIL,
                                               30 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
         if (event_result < 0)
         {
@@ -695,7 +695,7 @@ static void urc_send_func(struct at_client *client, const char *data, rt_size_t
     }
 
     sscanf(data, "+NSOSTR:%d,%d,%d", &device_socket, &sequence, &status);
-    
+
     if (1 == status)
     {
         bc28_socket_event_send(device, SET_EVENT(device_socket, BC28_EVENT_SEND_OK));
@@ -725,7 +725,7 @@ static void urc_close_func(struct at_client *client, const char *data, rt_size_t
     sscanf(data, "+NSOCLI: %d", &device_socket);
 
     bc28_socket_event_send(device, SET_EVENT(device_socket, BC28_EVENT_CONN_FAIL));
-    
+
     if (device_socket >= 0)
     {
         /* get at socket object by device socket descriptor */
@@ -832,7 +832,7 @@ static void urc_dns_func(struct at_client *client, const char *data, rt_size_t s
         LOG_E("get device(%s) failed.", client_name);
         return;
     }
-    
+
     bc28 = (struct at_device_bc28 *) device->user_data;
     if (bc28->socket_data == RT_NULL)
     {

+ 44 - 44
class/ec200x/at_device_ec200x.c

@@ -54,7 +54,7 @@ static int ec200x_power_on(struct at_device *device)
     {
         return(RT_EOK);
     }
-    
+
     rt_pin_write(ec200x->power_pin, PIN_HIGH);
 
     if (ec200x->power_status_pin != -1)//use power status pin
@@ -64,11 +64,11 @@ static int ec200x_power_on(struct at_device *device)
             rt_thread_mdelay(10);
         }
     }
-    
+
     rt_thread_mdelay(500);
-    
+
     rt_pin_write(ec200x->power_pin, PIN_LOW);
-    
+
     ec200x->power_status = RT_TRUE;
 
     return(RT_EOK);
@@ -98,7 +98,7 @@ static int ec200x_power_off(struct at_device *device)
         rt_pin_write(ec200x->power_pin, PIN_HIGH);
         rt_thread_mdelay(1000);
         rt_pin_write(ec200x->power_pin, PIN_LOW);
-        
+
         while (rt_pin_read(ec200x->power_status_pin) == PIN_HIGH)//wait power down
         {
             rt_thread_mdelay(100);
@@ -109,9 +109,9 @@ static int ec200x_power_off(struct at_device *device)
         at_obj_exec_cmd(device->client, RT_NULL, "AT+QPOWD=0");
         rt_thread_mdelay(5*1000);
     }
-    
+
     ec200x->power_status = RT_FALSE;
-    
+
     return(RT_EOK);
 }
 
@@ -119,13 +119,13 @@ static int ec200x_sleep(struct at_device *device)
 {
     at_response_t resp = RT_NULL;
     struct at_device_ec200x *ec200x = RT_NULL;
-    
+
     ec200x = (struct at_device_ec200x *)device->user_data;
     if ( ! ec200x->power_status)//power off
     {
         return(RT_EOK);
     }
-    if (ec200x->sleep_status)//is sleep status 
+    if (ec200x->sleep_status)//is sleep status
     {
         return(RT_EOK);
     }
@@ -141,22 +141,22 @@ static int ec200x_sleep(struct at_device *device)
         LOG_D("no memory for resp create.");
         return(-RT_ERROR);
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT+QSCLK=1") != RT_EOK)//enable sleep mode
-        
+
     {
         LOG_D("enable sleep fail.\"AT+QSCLK=1\" execute fail.");
         at_delete_resp(resp);
         return(-RT_ERROR);
     }
-    
+
     at_delete_resp(resp);
     */
-    
+
     rt_pin_write(ec200x->wakeup_pin, PIN_HIGH);
-    
+
     ec200x->sleep_status = RT_TRUE;
-    
+
     return(RT_EOK);
 }
 
@@ -164,7 +164,7 @@ static int ec200x_wakeup(struct at_device *device)
 {
     at_response_t resp = RT_NULL;
     struct at_device_ec200x *ec200x = RT_NULL;
-    
+
     ec200x = (struct at_device_ec200x *)device->user_data;
     if ( ! ec200x->power_status)//power off
     {
@@ -194,9 +194,9 @@ static int ec200x_wakeup(struct at_device *device)
     }
     at_delete_resp(resp);
     */
-    
+
     ec200x->sleep_status = RT_FALSE;
-    
+
     return(RT_EOK);
 }
 
@@ -205,7 +205,7 @@ static int ec200x_check_link_status(struct at_device *device)
     at_response_t resp = RT_NULL;
     struct at_device_ec200x *ec200x = RT_NULL;
     int result = -RT_ERROR;
-    
+
     ec200x = (struct at_device_ec200x *)device->user_data;
     if ( ! ec200x->power_status)//power off
     {
@@ -217,7 +217,7 @@ static int ec200x_check_link_status(struct at_device *device)
         rt_pin_write(ec200x->wakeup_pin, PIN_LOW);
         rt_thread_mdelay(200);
     }
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
@@ -237,14 +237,14 @@ static int ec200x_check_link_status(struct at_device *device)
             }
         }
     }
-    
+
     at_delete_resp(resp);
-    
+
     if (ec200x->sleep_status)//is sleep status
     {
         rt_pin_write(ec200x->wakeup_pin, PIN_HIGH);
     }
-    
+
     return(result);
 }
 
@@ -297,14 +297,14 @@ static int ec200x_netdev_set_info(struct netdev *netdev)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (at_resp_parse_line_args(resp, 2, "%s", imei) <= 0)
         {
             LOG_E("%s device prase \"AT+GSN\" cmd error.", device->name);
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         LOG_D("%s device IMEI number: %s", device->name, imei);
 
         netdev->hwaddr_len = EC200X_NETDEV_HWADDR_LEN;
@@ -326,7 +326,7 @@ static int ec200x_netdev_set_info(struct netdev *netdev)
     {
         #define IP_ADDR_SIZE_MAX    16
         char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-        
+
         /* send "AT+CGPADDR=1" commond to get IP address */
         if (at_obj_exec_cmd(device->client, resp, "AT+CGPADDR=1") != RT_EOK)
         {
@@ -348,12 +348,12 @@ static int ec200x_netdev_set_info(struct netdev *netdev)
         inet_aton(ipaddr, &addr);
         netdev_low_level_set_ipaddr(netdev, &addr);
     }
-    
+
     /* set network interface device dns server */
     {
         #define DNS_ADDR_SIZE_MAX   16
         char dns_server1[DNS_ADDR_SIZE_MAX] = {0}, dns_server2[DNS_ADDR_SIZE_MAX] = {0};
-        
+
         /* send "AT+QIDNSCFG=1" commond to get DNS servers address */
         if (at_obj_exec_cmd(device->client, resp, "AT+QIDNSCFG=1") != RT_EOK)
         {
@@ -403,7 +403,7 @@ static void ec200x_check_link_status_entry(void *parameter)
         LOG_E("get device(%s) failed.", netdev->name);
         return;
     }
-    
+
     while (1)
     {
         rt_thread_delay(EC200X_LINK_DELAY_TIME);
@@ -514,7 +514,7 @@ static int ec200x_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num,
     }
 
     /* send "AT+QIDNSCFG=<pri_dns>[,<sec_dns>]" commond to set dns servers */
-    if (at_obj_exec_cmd(device->client, resp, "AT+QIDNSCFG=%d,%s", 
+    if (at_obj_exec_cmd(device->client, resp, "AT+QIDNSCFG=%d,%s",
         dns_num, inet_ntoa(*dns_server)) != RT_EOK)
     {
         result = -RT_ERROR;
@@ -639,7 +639,7 @@ static struct netdev *ec200x_netdev_add(const char *netdev_name)
     {
         return netdev;
     }
-    
+
     netdev = (struct netdev *)rt_calloc(1, sizeof(struct netdev));
     if (netdev == RT_NULL)
     {
@@ -702,14 +702,14 @@ static void ec200x_init_thread_entry(void *parameter)
             result = -RT_ETIMEOUT;
             goto __exit;
         }
-        
+
         /* disable echo */
         if (at_obj_exec_cmd(device->client, resp, "ATE0") != RT_EOK)
         {
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* Get the baudrate */
         if (at_obj_exec_cmd(device->client, resp, "AT+IPR?") != RT_EOK)
         {
@@ -717,8 +717,8 @@ static void ec200x_init_thread_entry(void *parameter)
             goto __exit;
         }
         at_resp_parse_line_args_by_kw(resp, "+IPR:", "+IPR: %d", &i);
-        LOG_D("%s device baudrate %d", device->name, i);     
-        
+        LOG_D("%s device baudrate %d", device->name, i);
+
         /* get module version */
         if (at_obj_exec_cmd(device->client, resp, "ATI") != RT_EOK)
         {
@@ -729,7 +729,7 @@ static void ec200x_init_thread_entry(void *parameter)
         {
             LOG_D("%s", at_resp_get_line(resp, i + 1));
         }
-        
+
         /* check SIM card */
         for (i = 0; i < CPIN_RETRY; i++)
         {
@@ -754,7 +754,7 @@ static void ec200x_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CSQ") == RT_EOK)
             {
                 int signal_strength = 0, err_rate = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CSQ:", "+CSQ: %d,%d", &signal_strength, &err_rate) > 0)
                 {
                     if ((signal_strength != 99) && (signal_strength != 0))
@@ -772,7 +772,7 @@ static void ec200x_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-                
+
         /* check the GPRS network is registered */
         for (i = 0; i < CGREG_RETRY; i++)
         {
@@ -780,7 +780,7 @@ static void ec200x_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CGREG?") == RT_EOK)
             {
                 int link_stat = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CGREG:", "+CGREG: %*d,%d", &link_stat) > 0)
                 {
                     if ((link_stat == 1) || (link_stat == 5))
@@ -813,7 +813,7 @@ static void ec200x_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* Deactivate context profile */
         resp = at_resp_set_info(resp, RESP_SIZE, 0, rt_tick_from_millisecond(40*1000));
         if (at_obj_exec_cmd(device->client, resp, "AT+QIDEACT=1") != RT_EOK)
@@ -821,7 +821,7 @@ static void ec200x_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* Activate context profile */
         resp = at_resp_set_info(resp, RESP_SIZE, 0, rt_tick_from_millisecond(150*1000));
         if (at_obj_exec_cmd(device->client, resp, "AT+QIACT=1") != RT_EOK)
@@ -895,9 +895,9 @@ static int ec200x_net_init(struct at_device *device)
 static int ec200x_init(struct at_device *device)
 {
     struct at_device_ec200x *ec200x = RT_NULL;
-    
+
     RT_ASSERT(device);
-    
+
     ec200x = (struct at_device_ec200x *) device->user_data;
     ec200x->power_status = RT_FALSE;//default power is off.
     ec200x->sleep_status = RT_FALSE;//default sleep is disabled.
@@ -948,7 +948,7 @@ static int ec200x_init(struct at_device *device)
 static int ec200x_deinit(struct at_device *device)
 {
     RT_ASSERT(device);
-    
+
     return ec200x_netdev_set_down(device->netdev);
 }
 

+ 1 - 1
class/ec200x/at_device_ec200x.h

@@ -49,7 +49,7 @@ struct at_device_ec200x
 
     void *socket_data;
     void *user_data;
-    
+
     rt_bool_t power_status;
     rt_bool_t sleep_status;
 };

+ 11 - 11
class/ec200x/at_socket_ec200x.c

@@ -129,7 +129,7 @@ static int ec200x_socket_close(struct at_socket *socket)
         LOG_E("no memory for resp create.");
         return -RT_ENOMEM;
     }
-    
+
     result = at_obj_exec_cmd(device->client, resp, "AT+QICLOSE=%d", device_socket);
 
     at_delete_resp(resp);
@@ -198,7 +198,7 @@ static int ec200x_socket_connect(struct at_socket *socket, char *ip, int32_t por
         event = SET_EVENT(device_socket, EC200X_EVENT_CONN_OK | EC200X_EVENT_CONN_FAIL);
         ec200x_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR);
 
-        if (at_obj_exec_cmd(device->client, resp, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,1", 
+        if (at_obj_exec_cmd(device->client, resp, "AT+QIOPEN=1,%d,\"%s\",\"%s\",%d,0,1",
                             device_socket, type_str, ip, port) < 0)
         {
             result = -RT_ERROR;
@@ -206,7 +206,7 @@ static int ec200x_socket_connect(struct at_socket *socket, char *ip, int32_t por
         }
 
         /* waiting result event from AT URC, the device default connection timeout is 60 seconds*/
-        if (ec200x_socket_event_recv(device, SET_EVENT(device_socket, 0), 
+        if (ec200x_socket_event_recv(device, SET_EVENT(device_socket, 0),
                                     60 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
         {
             LOG_E("%s device socket(%d) wait connect result timeout.", device->name, device_socket);
@@ -214,7 +214,7 @@ static int ec200x_socket_connect(struct at_socket *socket, char *ip, int32_t por
             break;
         }
         /* waiting OK or failed result */
-        event_result = ec200x_socket_event_recv(device, EC200X_EVENT_CONN_OK | EC200X_EVENT_CONN_FAIL, 
+        event_result = ec200x_socket_event_recv(device, EC200X_EVENT_CONN_OK | EC200X_EVENT_CONN_FAIL,
                                                 1 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR);
         if (event_result < 0)
         {
@@ -228,7 +228,7 @@ static int ec200x_socket_connect(struct at_socket *socket, char *ip, int32_t por
             result = RT_EOK;
             break;
         }
-        
+
         LOG_D("%s device socket(%d) connect failed, the socket was not be closed and now will connect retry.",
                     device->name, device_socket);
         if (ec200x_socket_close(socket) < 0)
@@ -243,7 +243,7 @@ static int ec200x_socket_connect(struct at_socket *socket, char *ip, int32_t por
         LOG_E("%s device socket(%d) connect failed.", device->name, device_socket);
         result = -RT_ERROR;
     }
-    
+
     if (resp)
     {
         at_delete_resp(resp);
@@ -369,9 +369,9 @@ static int ec200x_socket_send(struct at_socket *socket, const char *buff, size_t
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         //rt_thread_mdelay(5);//delay at least 4ms
-        
+
         /* send the real data to server or client */
         result = (int) at_client_obj_send(device->client, buff + sent_size, cur_pkt_size);
         if (result == 0)
@@ -469,7 +469,7 @@ static int ec200x_domain_resolve(const char *name, char ip[16])
 
     /* clear EC200X_EVENT_DOMAIN_OK */
     ec200x_socket_event_recv(device, EC200X_EVENT_DOMAIN_OK, 0, RT_EVENT_FLAG_OR);
-    
+
     ec200x = (struct at_device_ec200x *) device->user_data;
     ec200x->socket_data = ip;
 
@@ -572,7 +572,7 @@ static void urc_send_func(struct at_client *client, const char *data, rt_size_t
         LOG_E("get device(%s) failed.", client_name);
         return;
     }
-    
+
     ec200x = (struct at_device_ec200x *) device->user_data;
     device_socket = (int) ec200x->user_data;
 
@@ -708,7 +708,7 @@ static void urc_dnsqip_func(struct at_client *client, const char *data, rt_size_
         LOG_E("get device(%s) failed.", client_name);
         return;
     }
-    
+
     ec200x = (struct at_device_ec200x *) device->user_data;
     if (ec200x->socket_data == RT_NULL)
     {

+ 1 - 1
class/esp32/at_device_esp32.c

@@ -318,7 +318,7 @@ static int esp32_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, i
         return -RT_ENOMEM;
     }
 
-    /* send dns server set commond "AT+CIPDNS_CUR=<enable>[,<DNS	server0>,<DNS	server1>]" and wait response */
+    /* send dns server set commond "AT+CIPDNS_CUR=<enable>[,<DNS    server0>,<DNS   server1>]" and wait response */
     if (at_obj_exec_cmd(device->client, resp, "AT+CIPDNS_CUR=1,\"%s\"", inet_ntoa(*dns_server)) < 0)
     {
         LOG_E("%s device set DNS failed.", device->name);

+ 1 - 1
class/esp8266/at_device_esp8266.c

@@ -319,7 +319,7 @@ static int esp8266_netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num,
         return -RT_ENOMEM;
     }
 
-    /* send dns server set commond "AT+CIPDNS_CUR=<enable>[,<DNS	server0>,<DNS	server1>]" and wait response */
+    /* send dns server set commond "AT+CIPDNS_CUR=<enable>[,<DNS    server0>,<DNS   server1>]" and wait response */
     if (at_obj_exec_cmd(device->client, resp, "AT+CIPDNS_CUR=1,\"%s\"", inet_ntoa(*dns_server)) < 0)
     {
         LOG_E("%s device set DNS failed.", device->name);

+ 2 - 2
class/l610/at_device_l610.c

@@ -35,7 +35,7 @@
 
 
 #ifndef L610_DEEP_SLEEP_EN
-#define L610_DEEP_SLEEP_EN          0//module support  sleep mode
+#define L610_DEEP_SLEEP_EN          0 //module support sleep mode
 #endif
 
 #ifdef AT_DEVICE_USING_L610
@@ -810,7 +810,7 @@ static void l610_init_thread_entry(void *parameter)
         }
 
 // 0: Received data with "+MIPRTCP:" or "+MIPRUDP:" and the data is encoded.
-// 1: Received data only and the data are without encoded. In received character string, Module doesnt accede to any <CR><LF> symbol.
+// 1: Received data only and the data are without encoded. In received character string, Module doesn't accede to any <CR><LF> symbol.
 // 2: Received data with "+MIPRTCP:" or "+MIPRUDP:" and the data is without encoded. In received character string, Module will accede to <CR><LF> before "+MIPRTCP:" or "+MIPRUDP:".
 // 5: Data read mode.
         /* */

+ 1 - 1
class/l610/at_device_l610.h

@@ -47,7 +47,7 @@ struct at_device_l610
 
     void *socket_data;
     void *user_data;
-  
+
     rt_bool_t power_status;
     rt_bool_t sleep_status;
 };

+ 2 - 2
class/l610/at_socket_l610.c

@@ -164,7 +164,7 @@ static int l610_socket_connect(struct at_socket *socket, char *ip, int32_t port,
     int device_socket = (int) socket->user_data;
     struct at_device *device = (struct at_device *) socket->device;
     int sock = -1;
-	int connect_result;
+    int connect_result;
 
     RT_ASSERT(ip);
     RT_ASSERT(port >= 0);
@@ -229,7 +229,7 @@ static int l610_socket_connect(struct at_socket *socket, char *ip, int32_t port,
             result = -RT_ERROR;
             goto __exit;
         }
-       
+
     }
     else
     {

+ 1 - 1
class/m26/at_socket_m26.c

@@ -86,7 +86,7 @@ static int m26_socket_close(struct at_socket *socket)
     int result = 0;
     int device_socke = (int) socket->user_data;
     struct at_device *device  = (struct at_device *) socket->device;
-    
+
     /* clear socket close event */
     m26_socket_event_recv(device, SET_EVENT(device_socke, M26_EVNET_CLOSE_OK), 0, RT_EVENT_FLAG_OR);
 

+ 4 - 4
class/m5311/at_device_m5311.c

@@ -71,7 +71,7 @@ static void m5311_power_off(struct at_device *device)
 
 /* ====================  m5311 network interface operations ================= */
 /* set m5311 network interface device status and address information
- * 
+ *
  * */
 static int m5311_netdev_set_info(struct netdev *netdev)
 {
@@ -100,7 +100,7 @@ static int m5311_netdev_set_info(struct netdev *netdev)
     netdev_low_level_set_status(netdev, RT_TRUE);
     netdev_low_level_set_link_status(netdev, RT_TRUE);
     netdev_low_level_set_dhcp_status(netdev, RT_TRUE);
-    
+
     resp = at_create_resp(M5311_IMEI_RESP_SIZE, 0, M5311_INFO_RESP_TIMO);
     if (resp == RT_NULL)
     {
@@ -177,7 +177,7 @@ static int m5311_netdev_set_info(struct netdev *netdev)
     }
 
     /*  set network interface device dns server
-     *     
+     *
      * */
     {
         #define DNS_ADDR_SIZE_MAX   16
@@ -220,7 +220,7 @@ __exit:
 
 /**
  * Check link status task entry
- * 
+ *
  * @param parameter
  */
 static void check_link_status_entry(void *parameter)

+ 2 - 2
class/m5311/at_device_m5311.h

@@ -21,7 +21,7 @@
  * Date           Author       Notes
  * 2020-03-09     LXGMAX     first version
  */
- 
+
 #ifndef __AT_DEVICE_M5311_H__
 #define __AT_DEVICE_M5311_H__
 
@@ -43,7 +43,7 @@ struct at_device_m5311{
         int power_pin;
         size_t recieve_line_num;
         struct at_device device;
-        
+
         void *socket_data;
         void *user_data;
 };

+ 1 - 1
class/m5311/at_socket_m5311.c

@@ -23,7 +23,7 @@
  * 2020-07-12     LXGMAX       fix parameters and remove redundant content
  * 2020-07-31     LXGMAX       fix a bug of connect function
  */
- 
+
 #include <stdio.h>
 #include <string.h>
 

+ 16 - 16
class/m6315/at_device_m6315.c

@@ -413,7 +413,7 @@ static int m6315_netdev_ping(struct netdev *netdev, const char *host,
     at_response_t resp = RT_NULL;
     struct at_device *device = RT_NULL;
     int sent, recv, lost, min, max, avg;
-		
+
     RT_ASSERT(netdev);
     RT_ASSERT(host);
     RT_ASSERT(ping_resp);
@@ -441,14 +441,14 @@ static int m6315_netdev_ping(struct netdev *netdev, const char *host,
     {
     case 0:
         if (at_resp_parse_line_args(resp, 4, "+QPING: %d, %[^,], %d, %d, %d",
-            &response, ip_addr, &bytes, &time, &ttl) != RT_NULL) 
+            &response, ip_addr, &bytes, &time, &ttl) != RT_NULL)
         {
             /* ping result reponse at the sixth line */
             if (at_resp_parse_line_args(resp, 6, "+QPING: %d, %d, %d, %d, %d, %d, %d",
-                 &response, &sent, &recv, &lost, &min, &max, &avg) != RT_NULL) 
+                 &response, &sent, &recv, &lost, &min, &max, &avg) != RT_NULL)
             {
                 // ping result 2
-                if (response == 2)  
+                if (response == 2)
                 {
                     inet_aton(ip_addr, &(ping_resp->ip_addr));
                     ping_resp->data_len = bytes;
@@ -473,7 +473,7 @@ static int m6315_netdev_ping(struct netdev *netdev, const char *host,
         break;
     default:
         break;
-    }    
+    }
 
 
  __exit:
@@ -566,7 +566,7 @@ static void m6315_init_thread_entry(void *parameter)
     struct at_device *device = (struct at_device *)parameter;
     struct at_client *client = device->client;
 
-    resp = at_create_resp(128, 0, rt_tick_from_millisecond(500));   
+    resp = at_create_resp(128, 0, rt_tick_from_millisecond(500));
     if (resp == RT_NULL)
     {
         LOG_E("no memory for resp create.");
@@ -588,7 +588,7 @@ static void m6315_init_thread_entry(void *parameter)
             result = -RT_ETIMEOUT;
             goto __exit;
         }
-								
+
         /* disable echo */
         AT_SEND_CMD(client, resp, 0, 300, "ATE0");
         /* get module version */
@@ -662,7 +662,7 @@ static void m6315_init_thread_entry(void *parameter)
 
         /* Define PDP Context */
         for (i = 0; i < COMMON_RETRY; i++)
-        {            
+        {
             if (at_obj_exec_cmd(device->client, resp, "AT+CGDCONT=1,\"IP\",\"CMNET\"") == RT_EOK)
             {
                 LOG_D("%s device Define PDP Context Success.", device->name);
@@ -679,7 +679,7 @@ static void m6315_init_thread_entry(void *parameter)
 
         /* PDP Context Activate*/
         for (i = 0; i < COMMON_RETRY; i++)
-        {            
+        {
             if (at_obj_exec_cmd(device->client, resp, "AT+CGACT=1,1") == RT_EOK)
             {
                 LOG_D("%s device PDP Context Activate Success.", device->name);
@@ -735,12 +735,12 @@ static void m6315_init_thread_entry(void *parameter)
 
         /* check the GPRS network IP address */
         for (i = 0; i < IPADDR_RETRY; i++)
-        {            
+        {
             if (at_obj_exec_cmd(device->client, resp, "AT+CGPADDR=1") == RT_EOK)
             {
                 #define IP_ADDR_SIZE_MAX    16
                 char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-                
+
                 /* parse response data "+CGPADDR: 1,<IP_address>" */
                 if (at_resp_parse_line_args_by_kw(resp, "+CGPADDR:", "+CGPADDR: %*d,%s", ipaddr) > 0)
                 {
@@ -766,22 +766,22 @@ static void m6315_init_thread_entry(void *parameter)
         }
         else if (qimux == 1)
         {
-            /* Close Already Opened GPRS/CSD PDP*/                         
+            /* Close Already Opened GPRS/CSD PDP*/
             AT_SEND_CMD(device->client, resp, 2, 300, "AT+QIDEACT");
             if (at_resp_get_line_by_kw(resp, "DEACT OK") == RT_NULL)
             {
                 LOG_E("%s device prase \"AT+QIDEACT\" cmd error.", device->name);
                 result = -RT_ERROR;
                 goto __exit;
-            }                   
+            }
         }
-        
+
         /* Start task & set entry point default apn,username,password */
         if (at_obj_exec_cmd(device->client, resp, "AT+QIREGAPP") < 0)
         {
             LOG_E("%s device Start task & set default params failed.", device->name);
             result = -RT_ERROR;
-            goto __exit;            
+            goto __exit;
         }
 
         /* PDP Context Activate */
@@ -790,7 +790,7 @@ static void m6315_init_thread_entry(void *parameter)
             LOG_E("%s device PDP Context Activate failed.", device->name);
             result = -RT_ERROR;
             goto __exit;
-        }          
+        }
 
         /* initialize successfully  */
         result = RT_EOK;

+ 5 - 5
class/m6315/at_socket_m6315.c

@@ -87,11 +87,11 @@ static int m6315_socket_close(struct at_socket *socket)
     int result = RT_EOK;
     int device_socket = (int) socket->user_data;
     struct at_device *device = (struct at_device *) socket->device;
-    
+
     /* clear socket close event */
     event = SET_EVENT(device_socket, M6315_EVNET_CLOSE_OK);
     m6315_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR);
-    
+
     if (at_obj_exec_cmd(device->client, NULL, "AT+QICLOSE=%d", device_socket) < 0)
     {
         result = -RT_ERROR;
@@ -105,7 +105,7 @@ static int m6315_socket_close(struct at_socket *socket)
         goto __exit;
     }
 
-__exit:    
+__exit:
     return result;
 }
 
@@ -383,7 +383,7 @@ static int m6315_domain_resolve(const char *name, char ip[16])
         {
             rt_thread_mdelay(100);
             /* resolve failed, maybe receive an URC CRLF */
-            continue;            
+            continue;
         }
 
         if (rt_strlen(recv_ip) < 8)
@@ -444,7 +444,7 @@ static void urc_connect_func(struct at_client *client, const char *data, rt_size
     {
         m6315_socket_event_send(device, SET_EVENT(device_socket, M6315_EVENT_CONN_ALREADY));
         return;
-    }    
+    }
 
     /* get the current socket by receive data */
     sscanf(data, "%d,%*s", &device_socket);

+ 49 - 49
class/me3616/at_device_me3616.c

@@ -43,7 +43,7 @@
 static int me3616_power_on(struct at_device *device)
 {
     struct at_device_me3616 *me3616 = RT_NULL;
-    
+
     me3616 = (struct at_device_me3616 *)device->user_data;
     me3616->power_status = RT_TRUE;
 
@@ -52,11 +52,11 @@ static int me3616_power_on(struct at_device *device)
     {
         return(RT_EOK);
     }
-    
+
     rt_pin_write(me3616->power_pin, PIN_HIGH);
     rt_thread_mdelay(500);
     rt_pin_write(me3616->power_pin, PIN_LOW);
-    
+
     LOG_D("power on success.");
 
     return(RT_EOK);
@@ -66,7 +66,7 @@ static int me3616_power_off(struct at_device *device)
 {
     at_response_t resp = RT_NULL;
     struct at_device_me3616 *me3616 = RT_NULL;
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
@@ -81,14 +81,14 @@ static int me3616_power_off(struct at_device *device)
         at_delete_resp(resp);
         return(-RT_ERROR);
     }*/
-    
+
     at_delete_resp(resp);
-    
+
     me3616 = (struct at_device_me3616 *)device->user_data;
     me3616->power_status = RT_FALSE;
-    
+
     LOG_D("power off success.");
-    
+
     return(RT_EOK);
 }
 
@@ -96,24 +96,24 @@ static int me3616_sleep(struct at_device *device)
 {
     at_response_t resp = RT_NULL;
     struct at_device_me3616 *me3616 = RT_NULL;
-    
+
     me3616 = (struct at_device_me3616 *)device->user_data;
     if ( ! me3616->power_status)//power off
     {
         return(RT_EOK);
     }
-    if (me3616->sleep_status)//is sleep status 
+    if (me3616->sleep_status)//is sleep status
     {
         return(RT_EOK);
     }
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
         LOG_E("no memory for resp create.");
         return(-RT_ERROR);
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT+CPSMS=1,,,\"00111110\",\"00000001\"") != RT_EOK)
     {
         LOG_D("enable sleep fail.");
@@ -129,12 +129,12 @@ static int me3616_sleep(struct at_device *device)
         return(-RT_ERROR);
     }
     #endif
-    
+
     at_delete_resp(resp);
     me3616->sleep_status = RT_TRUE;
-    
+
     LOG_D("sleep success.");
-    
+
     return(RT_EOK);
 }
 
@@ -153,14 +153,14 @@ static int me3616_wakeup(struct at_device *device)
     {
         return(RT_EOK);
     }
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
         LOG_E("no memory for resp create.");
         return(-RT_ERROR);
     }
-    
+
     #if ME3616_DEEP_SLEEP_EN
     if (me3616->power_pin != -1)
     {
@@ -170,19 +170,19 @@ static int me3616_wakeup(struct at_device *device)
         rt_thread_mdelay(200);
     }
     #endif
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT+CPSMS=0") != RT_EOK)
     {
         LOG_D("wake up fail.");
         at_delete_resp(resp);
         return(-RT_ERROR);
     }
-    
+
     at_delete_resp(resp);
     me3616->sleep_status = RT_FALSE;
-    
+
     LOG_D("wake up success.");
-    
+
     return(RT_EOK);
 }
 
@@ -200,7 +200,7 @@ static int me3616_check_link_status(struct at_device *device)
         LOG_D("the power is off.");
         return(-RT_ERROR);
     }
-    
+
     #if ME3616_DEEP_SLEEP_EN
     if (me3616->sleep_status)//is sleep status
     {
@@ -213,7 +213,7 @@ static int me3616_check_link_status(struct at_device *device)
         }
     }
     #endif
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
@@ -233,7 +233,7 @@ static int me3616_check_link_status(struct at_device *device)
             }
         }
     }
-    
+
     #if ME3616_DEEP_SLEEP_EN
     if (me3616->sleep_status)//is sleep status
     {
@@ -243,9 +243,9 @@ static int me3616_check_link_status(struct at_device *device)
         }
     }
     #endif
-    
+
     at_delete_resp(resp);
-    
+
     return(result);
 }
 
@@ -298,14 +298,14 @@ static int me3616_netdev_set_info(struct netdev *netdev)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (at_resp_parse_line_args(resp, 2, "%s", imei) <= 0)
         {
             LOG_E("%s device prase \"AT+GSN\" cmd error.", device->name);
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         LOG_D("%s device IMEI number: %s", device->name, imei);
 
         netdev->hwaddr_len = ME3616_NETDEV_HWADDR_LEN;
@@ -327,7 +327,7 @@ static int me3616_netdev_set_info(struct netdev *netdev)
     {
         #define IP_ADDR_SIZE_MAX    16
         char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-        
+
         /* send "AT+CGPADDR=1" commond to get IP address */
         if (at_obj_exec_cmd(device->client, resp, "AT+CGPADDR=1") != RT_EOK)
         {
@@ -349,7 +349,7 @@ static int me3616_netdev_set_info(struct netdev *netdev)
         inet_aton(ipaddr, &addr);
         netdev_low_level_set_ipaddr(netdev, &addr);
     }
-    
+
 __exit:
     if (resp)
     {
@@ -373,7 +373,7 @@ static void me3616_check_link_status_entry(void *parameter)
         LOG_E("get device(%s) failed.", netdev->name);
         return;
     }
-    
+
     while (1)
     {
         is_link_up = (me3616_check_link_status(device) == RT_EOK);
@@ -509,7 +509,7 @@ static int me3616_netdev_ping(struct netdev *netdev, const char *host,
         goto __exit;
     }
 
-    if (at_resp_parse_line_args_by_kw(resp, "received=", "%*[^=]=%d%*[^=]=%d%*[^=]=%d", 
+    if (at_resp_parse_line_args_by_kw(resp, "received=", "%*[^=]=%d%*[^=]=%d%*[^=]=%d",
                                         &recv_data_len, &ping_time, &ttl) <= 0)
     {
         result = -RT_ERROR;
@@ -558,7 +558,7 @@ static struct netdev *me3616_netdev_add(const char *netdev_name)
     {
         return(netdev);
     }
-    
+
     netdev = (struct netdev *)rt_calloc(1, sizeof(struct netdev));
     if (netdev == RT_NULL)
     {
@@ -620,14 +620,14 @@ static void me3616_init_thread_entry(void *parameter)
             result = -RT_ETIMEOUT;
             goto __exit;
         }
-        
+
         /* disable echo */
         if (at_obj_exec_cmd(device->client, resp, "ATE0") != RT_EOK)
         {
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* disable PSM mode  */
         if (at_obj_exec_cmd(device->client, resp, "AT+CPSMS=0") != RT_EOK)
         {
@@ -647,15 +647,15 @@ static void me3616_init_thread_entry(void *parameter)
         {
             result = -RT_ERROR;
             goto __exit;
-        }  
-        
+        }
+
         /* disable sleep function  */
         if (at_obj_exec_cmd(device->client, resp, "AT+ZSLR=0") != RT_EOK)
         {
             result = -RT_ERROR;
             goto __exit;
-        } 
-        
+        }
+
         /* Get the baudrate */
         if (at_obj_exec_cmd(device->client, resp, "AT+IPR?") != RT_EOK)
         {
@@ -664,7 +664,7 @@ static void me3616_init_thread_entry(void *parameter)
         }
         at_resp_parse_line_args_by_kw(resp, "+IPR:", "+IPR: %d\r", &i);
         LOG_D("%s device baudrate %d", device->name, i);
-        
+
         /* get module version */
         if (at_obj_exec_cmd(device->client, resp, "ATI") != RT_EOK)
         {
@@ -674,8 +674,8 @@ static void me3616_init_thread_entry(void *parameter)
         for (i = 0; i < (int) resp->line_counts - 1; i++)
         {
             LOG_D("%s", at_resp_get_line(resp, i + 1));
-        }   
-        
+        }
+
         /* check SIM card */
         for (i = 0; i < CPIN_RETRY; i++)
         {
@@ -700,7 +700,7 @@ static void me3616_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CSQ") == RT_EOK)
             {
                 int signal_strength = 0, err_rate = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CSQ:", "+CSQ: %d,%d", &signal_strength, &err_rate) > 0)
                 {
                     if ((signal_strength != 99) && (signal_strength != 0))
@@ -718,7 +718,7 @@ static void me3616_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-                
+
         /* check the GPRS network is registered */
         for (i = 0; i < CGREG_RETRY; i++)
         {
@@ -726,7 +726,7 @@ static void me3616_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CGREG?") == RT_EOK)
             {
                 int link_stat = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CGREG:", "+CGREG: %*d,%d", &link_stat) > 0)
                 {
                     if ((link_stat == 1) || (link_stat == 5))
@@ -743,7 +743,7 @@ static void me3616_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* check the GPRS network IP address */
         for (i = 0; i < IPADDR_RETRY; i++)
         {
@@ -752,7 +752,7 @@ static void me3616_init_thread_entry(void *parameter)
             {
                 #define IP_ADDR_SIZE_MAX    16
                 char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-                
+
                 /* parse response data "+CGPADDR: 1,<IP_address>" */
                 if (at_resp_parse_line_args_by_kw(resp, "+CGPADDR:", "+CGPADDR: %*[^\"]\"%[^\"]", ipaddr) > 0)
                 {
@@ -767,7 +767,7 @@ static void me3616_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* initialize successfully  */
         result = RT_EOK;
         break;
@@ -877,7 +877,7 @@ static int me3616_init(struct at_device *device)
 static int me3616_deinit(struct at_device *device)
 {
     RT_ASSERT(device);
-    
+
     return me3616_netdev_set_down(device->netdev);
 }
 

+ 1 - 1
class/me3616/at_device_me3616.h

@@ -48,7 +48,7 @@ struct at_device_me3616
 
     void *socket_data;
     void *user_data;
-    
+
     rt_bool_t power_status;
     rt_bool_t sleep_status;
 };

+ 18 - 18
class/me3616/at_socket_me3616.c

@@ -44,12 +44,12 @@ static at_evt_cb_t at_evt_cb_set[] = {
 static int me3616_get_socket_idx(int sock)
 {
     int i;
-    
+
     if (sock < 0)
     {
         return(-1);
     }
-    
+
     for (i=0; i<AT_DEVICE_ME3616_SOCKETS_NUM; i++)
     {
         if (me3616_socket_fd[i] == sock)
@@ -80,7 +80,7 @@ static int me3616_socket_close(struct at_socket *socket)
     {
         return RT_EOK;
     }
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
@@ -90,7 +90,7 @@ static int me3616_socket_close(struct at_socket *socket)
 
     result = at_obj_exec_cmd(device->client, resp, "AT+ESOCL=%d", me3616_socket_fd[device_socket]);
     me3616_socket_fd[device_socket] = -1;
-    
+
     at_delete_resp(resp);
 
     return result;
@@ -114,7 +114,7 @@ static int me3616_socket_connect(struct at_socket *socket, char *ip, int32_t por
     enum at_socket_type type, rt_bool_t is_client)
 {
     #define CONN_RESP_SIZE  128
-    
+
     int type_code = 0;
     int result = RT_EOK;
     at_response_t resp = RT_NULL;
@@ -155,7 +155,7 @@ static int me3616_socket_connect(struct at_socket *socket, char *ip, int32_t por
         at_obj_exec_cmd(device->client, resp, "AT+ESOCL=%d", me3616_socket_fd[device_socket]);
         me3616_socket_fd[device_socket] = -1;
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT+ESOC=1,%d,1", type_code) < 0)
     {
         result = -RT_ERROR;
@@ -176,9 +176,9 @@ static int me3616_socket_connect(struct at_socket *socket, char *ip, int32_t por
         result = -RT_ERROR;
         goto __exit;
     }
-    
+
     me3616_socket_fd[device_socket] = sock;
-    
+
 __exit:
     if (resp)
     {
@@ -260,7 +260,7 @@ static int at_wait_send_finish(struct at_socket *socket, rt_tick_t timeout)
 static int me3616_socket_send(struct at_socket *socket, const char *buff, size_t bfsz, enum at_socket_type type)
 {
     #define SEND_RESP_SIZE      128
-    
+
     int result = 0;
     size_t cur_pkt_size = 0, sent_size = 0;
     at_response_t resp = RT_NULL;
@@ -302,9 +302,9 @@ static int me3616_socket_send(struct at_socket *socket, const char *buff, size_t
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         rt_thread_mdelay(5);//delay at least 4 ms
-        
+
         /* send the real data to server or client */
         result = (int) at_client_obj_send(device->client, buff + sent_size, cur_pkt_size);
         if (result == 0)
@@ -320,7 +320,7 @@ static int me3616_socket_send(struct at_socket *socket, const char *buff, size_t
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (type == AT_SOCKET_TCP)
         {
             at_wait_send_finish(socket, (5*RT_TICK_PER_SECOND));
@@ -329,7 +329,7 @@ static int me3616_socket_send(struct at_socket *socket, const char *buff, size_t
         {
             rt_thread_mdelay(10);//delay at least 10 ms
         }
-        
+
         sent_size += cur_pkt_size;
     }
 
@@ -392,7 +392,7 @@ static int me3616_domain_resolve(const char *name, char ip[16])
         result = -RT_ERROR;
         goto __exit;
     }
-    
+
     ip[15] = 0;
     if (rt_strlen(ip) < 8)
     {
@@ -445,13 +445,13 @@ static void urc_close_func(struct at_client *client, const char *data, rt_size_t
     }
 
     sscanf(data, "+ESOERR=%d,%d", &sock, &err_code);
-    
+
     device_socket = me3616_get_socket_idx(sock);
     if (device_socket < 0 || err_code < 0 || err_code > 4)
     {
         return;
     }
-    
+
     /* get at socket object by device socket descriptor */
     socket = &(device->sockets[device_socket]);
 
@@ -503,13 +503,13 @@ static void urc_recv_func(struct at_client *client, const char *data, rt_size_t
     {
         return;
     }
-    
+
     sscanf(temp, "%d", (int *)&bfsz);
     if(bfsz == 0)
     {
         return;
     }
-    
+
     timeout = bfsz > 10 ? bfsz : 10;
 
     recv_buf = (char *) rt_calloc(1, bfsz);

+ 1 - 1
class/n21/at_device_n21.h

@@ -37,7 +37,7 @@ extern "C" {
 #define AT_DEVICE_N21_SOCKETS_NUM      4
 
 struct at_device_n21
-{     
+{
     char *device_name;
     char *client_name;
 

+ 1 - 1
class/n58/at_device_n58.h

@@ -37,7 +37,7 @@ extern "C" {
 #define AT_DEVICE_N58_SOCKETS_NUM      4
 
 struct at_device_n58
-{     
+{
     char *device_name;
     char *client_name;
 

+ 46 - 46
class/n720/at_device_n720.c

@@ -59,7 +59,7 @@ static int n720_power_on(struct at_device *device)
     {
         return(RT_EOK);
     }
-    
+
     rt_pin_write(n720->power_pin, PIN_HIGH);
 
     if (n720->power_status_pin != -1)//use power status pin
@@ -69,11 +69,11 @@ static int n720_power_on(struct at_device *device)
             rt_thread_mdelay(10);
         }
     }
-    
+
     rt_thread_mdelay(1000);
-    
+
     rt_pin_write(n720->power_pin, PIN_LOW);
-    
+
     n720->power_status = RT_TRUE;
 
     return(RT_EOK);
@@ -84,7 +84,7 @@ static int n720_power_off(struct at_device *device)
     struct at_device_n720 *n720 = RT_NULL;
 
     n720 = (struct at_device_n720 *)device->user_data;
-    
+
     if (n720->power_ctrl)
     {
         n720->power_status = RT_FALSE;
@@ -111,7 +111,7 @@ static int n720_power_off(struct at_device *device)
         rt_pin_write(n720->power_pin, PIN_HIGH);
         rt_thread_mdelay(1000);
         rt_pin_write(n720->power_pin, PIN_LOW);
-        
+
         while (rt_pin_read(n720->power_status_pin) == PIN_HIGH)//wait power down
         {
             rt_thread_mdelay(100);
@@ -122,9 +122,9 @@ static int n720_power_off(struct at_device *device)
         at_obj_exec_cmd(device->client, RT_NULL, "$MYPOWEROFF");
         rt_thread_mdelay(5*1000);
     }
-    
+
     n720->power_status = RT_FALSE;
-    
+
     return(RT_EOK);
 }
 
@@ -132,13 +132,13 @@ static int n720_sleep(struct at_device *device)
 {
     at_response_t resp = RT_NULL;
     struct at_device_n720 *n720 = RT_NULL;
-    
+
     n720 = (struct at_device_n720 *)device->user_data;
     if ( ! n720->power_status)//power off
     {
         return(RT_EOK);
     }
-    if (n720->sleep_status)//is sleep status 
+    if (n720->sleep_status)//is sleep status
     {
         return(RT_EOK);
     }
@@ -154,22 +154,22 @@ static int n720_sleep(struct at_device *device)
         LOG_D("no memory for resp create.");
         return(-RT_ERROR);
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT+QSCLK=1") != RT_EOK)//enable sleep mode
-        
+
     {
         LOG_D("enable sleep fail.\"AT+QSCLK=1\" execute fail.");
         at_delete_resp(resp);
         return(-RT_ERROR);
     }
-    
+
     at_delete_resp(resp);
     */
-    
+
     rt_pin_write(n720->wakeup_pin, PIN_HIGH);
-    
+
     n720->sleep_status = RT_TRUE;
-    
+
     return(RT_EOK);
 }
 
@@ -177,7 +177,7 @@ static int n720_wakeup(struct at_device *device)
 {
     at_response_t resp = RT_NULL;
     struct at_device_n720 *n720 = RT_NULL;
-    
+
     n720 = (struct at_device_n720 *)device->user_data;
     if ( ! n720->power_status)//power off
     {
@@ -207,9 +207,9 @@ static int n720_wakeup(struct at_device *device)
     }
     at_delete_resp(resp);
     */
-    
+
     n720->sleep_status = RT_FALSE;
-    
+
     return(RT_EOK);
 }
 
@@ -218,7 +218,7 @@ static int n720_check_link_status(struct at_device *device)
     at_response_t resp = RT_NULL;
     struct at_device_n720 *n720 = RT_NULL;
     int result = -RT_ERROR;
-    
+
     n720 = (struct at_device_n720 *)device->user_data;
     if ( ! n720->power_status)//power off
     {
@@ -230,7 +230,7 @@ static int n720_check_link_status(struct at_device *device)
         rt_pin_write(n720->wakeup_pin, PIN_LOW);
         rt_thread_mdelay(200);
     }
-    
+
     resp = at_create_resp(64, 0, rt_tick_from_millisecond(300));
     if (resp == RT_NULL)
     {
@@ -250,14 +250,14 @@ static int n720_check_link_status(struct at_device *device)
             }
         }
     }
-    
+
     at_delete_resp(resp);
-    
+
     if (n720->sleep_status)//is sleep status
     {
         rt_pin_write(n720->wakeup_pin, PIN_HIGH);
     }
-    
+
     return(result);
 }
 
@@ -310,14 +310,14 @@ static int n720_netdev_set_info(struct netdev *netdev)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (at_resp_parse_line_args_by_kw(resp, "+GSN:", "%*[^\"]\"%[^\"]", imei) <= 0)
         {
             LOG_E("%s device prase \"AT+GSN\" cmd error.", device->name);
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         LOG_D("%s device IMEI number: %s", device->name, imei);
 
         netdev->hwaddr_len = N720_NETDEV_HWADDR_LEN;
@@ -339,7 +339,7 @@ static int n720_netdev_set_info(struct netdev *netdev)
     {
         #define IP_ADDR_SIZE_MAX    16
         char ipaddr[IP_ADDR_SIZE_MAX] = {0};
-        
+
         /* Get IP address */
         if (at_obj_exec_cmd(device->client, resp, "AT$MYNETACT?") != RT_EOK)
         {
@@ -359,7 +359,7 @@ static int n720_netdev_set_info(struct netdev *netdev)
         inet_aton(ipaddr, &addr);
         netdev_low_level_set_ipaddr(netdev, &addr);
     }
-    
+
     /* set network interface device dns server */
     {
         #define DNS_ADDR_SIZE_MAX 16
@@ -413,7 +413,7 @@ static void n720_check_link_status_entry(void *parameter)
         LOG_E("get device(%s) failed.", netdev->name);
         return;
     }
-    
+
     while (1)
     {
         rt_thread_delay(N720_LINK_DELAY_TIME);
@@ -649,7 +649,7 @@ static struct netdev *n720_netdev_add(const char *netdev_name)
     {
         return netdev;
     }
-    
+
     netdev = (struct netdev *)rt_calloc(1, sizeof(struct netdev));
     if (netdev == RT_NULL)
     {
@@ -712,14 +712,14 @@ static void n720_init_thread_entry(void *parameter)
             goto __exit;
         }
         rt_thread_mdelay(5000);
-        
+
         /* disable echo */
         if (at_obj_exec_cmd(device->client, resp, "ATE0") != RT_EOK)
         {
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* Get the baudrate */
         if (at_obj_exec_cmd(device->client, resp, "AT+IPR?") != RT_EOK)
         {
@@ -727,8 +727,8 @@ static void n720_init_thread_entry(void *parameter)
             goto __exit;
         }
         at_resp_parse_line_args_by_kw(resp, "+IPR:", "+IPR: %d", &i);
-        LOG_D("%s device baudrate %d", device->name, i);     
-        
+        LOG_D("%s device baudrate %d", device->name, i);
+
         /* get module version */
         if (at_obj_exec_cmd(device->client, resp, "ATI") != RT_EOK)
         {
@@ -739,7 +739,7 @@ static void n720_init_thread_entry(void *parameter)
         {
             LOG_D("%s", at_resp_get_line(resp, i + 1));
         }
-        
+
         /* check SIM card */
         for (i = 0; i < CPIN_RETRY; i++)
         {
@@ -764,7 +764,7 @@ static void n720_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CSQ") == RT_EOK)
             {
                 int signal_strength = 0, err_rate = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CSQ:", "+CSQ: %d,%d", &signal_strength, &err_rate) > 0)
                 {
                     if ((signal_strength != 99) && (signal_strength != 0))
@@ -782,7 +782,7 @@ static void n720_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-                
+
         /* check the GPRS network is registered */
         for (i = 0; i < CGREG_RETRY; i++)
         {
@@ -790,7 +790,7 @@ static void n720_init_thread_entry(void *parameter)
             if (at_obj_exec_cmd(device->client, resp, "AT+CGREG?") == RT_EOK)
             {
                 int link_stat = 0;
-                
+
                 if (at_resp_parse_line_args_by_kw(resp, "+CGREG:", "+CGREG: %*d,%d", &link_stat) > 0)
                 {
                     if ((link_stat == 1) || (link_stat == 5))
@@ -807,7 +807,7 @@ static void n720_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (((struct at_device_n720 *)(device->user_data))->wakeup_pin != -1)//use wakeup pin
         {
             if (at_obj_exec_cmd(device->client, resp, "AT+ENPWRSAVE=1") != RT_EOK)// enable sleep mode fail
@@ -816,7 +816,7 @@ static void n720_init_thread_entry(void *parameter)
                 goto __exit;
             }
         }
-        
+
         /* Activate context profile */
         resp = at_resp_set_info(resp, RESP_SIZE, 0, rt_tick_from_millisecond(30*1000));
         if (at_obj_exec_cmd(device->client, resp, "AT+CGATT=1") != RT_EOK)
@@ -824,7 +824,7 @@ static void n720_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* Activate PPP */
         resp = at_resp_set_info(resp, RESP_SIZE, 0, rt_tick_from_millisecond(30*1000));
         if (at_obj_exec_cmd(device->client, resp, "AT$MYNETACT=0,1") != RT_EOK)
@@ -832,12 +832,12 @@ static void n720_init_thread_entry(void *parameter)
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* Get IP address */
         if (at_obj_exec_cmd(device->client, resp, "AT$MYNETACT?") == RT_EOK)
         {
             char ip_str[20];
-            
+
             if (at_resp_parse_line_args_by_kw(resp, "$MYNETACT:", "$MYNETACT: %*[^\"]\"%[^\"]", ip_str) <= 0)
             {
                 result = -RT_ERROR;
@@ -910,9 +910,9 @@ static int n720_net_init(struct at_device *device)
 static int n720_init(struct at_device *device)
 {
     struct at_device_n720 *n720 = RT_NULL;
-    
+
     RT_ASSERT(device);
-    
+
     n720 = (struct at_device_n720 *) device->user_data;
     n720->power_status = RT_FALSE;//default power is off.
     n720->sleep_status = RT_FALSE;//default sleep is disabled.
@@ -963,7 +963,7 @@ static int n720_init(struct at_device *device)
 static int n720_deinit(struct at_device *device)
 {
     RT_ASSERT(device);
-    
+
     return n720_netdev_set_down(device->netdev);
 }
 

+ 1 - 1
class/n720/at_device_n720.h

@@ -50,7 +50,7 @@ struct at_device_n720
 
     void *socket_data;
     void *user_data;
-    
+
     rt_bool_t power_status;
     rt_bool_t sleep_status;
 };

+ 7 - 7
class/n720/at_socket_n720.c

@@ -93,7 +93,7 @@ static int n720_socket_close(struct at_socket *socket)
         LOG_E("no memory for resp create.");
         return -RT_ENOMEM;
     }
-    
+
     result = at_obj_exec_cmd(device->client, resp, "AT$MYNETCLOSE=%d", device_socket);
 
     at_delete_resp(resp);
@@ -151,21 +151,21 @@ static int n720_socket_connect(struct at_socket *socket, char *ip, int32_t port,
         LOG_E("no memory for resp create.");
         return -RT_ENOMEM;
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT$MYNETSRV=0,%d,%d,0,\"%s:%d\"", device_socket, type_val, ip, port) < 0)
     {
         at_delete_resp(resp);
         LOG_E("%s device socket(%d) config params fail.", device->name, device_socket);
         return -RT_ERROR;
     }
-    
+
     if (at_obj_exec_cmd(device->client, resp, "AT$MYNETOPEN=%d", device_socket) < 0)
     {
         at_delete_resp(resp);
         LOG_E("%s device socket(%d) connect failed.", device->name, device_socket);
         result = -RT_ERROR;
     }
-    
+
     at_delete_resp(resp);
     return RT_EOK;
 }
@@ -273,19 +273,19 @@ static int n720_socket_send(struct at_socket *socket, const char *buff, size_t b
         {
             cur_pkt_size = N720_MODULE_SEND_MAX_SIZE;
         }
-        
+
         if (at_obj_exec_cmd(device->client, resp, "AT$MYNETWRITE=%d,%d", device_socket, (int)cur_pkt_size) < 0)
         {
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         if (at_resp_get_line_by_kw(resp, "$MYNETWRITE:") == RT_NULL)
         {
             result = -RT_ERROR;
             goto __exit;
         }
-        
+
         /* send the real data to server or client */
         result = (int) at_client_obj_send(device->client, buff + sent_size, cur_pkt_size);
         if (result == 0)

+ 2 - 2
class/sim76xx/at_socket_sim76xx.c

@@ -216,7 +216,7 @@ static int sim76xx_socket_connect(struct at_socket *socket, char *ip, int32_t po
         return -RT_ENOMEM;
     }
 
-	rt_mutex_take(lock, RT_WAITING_FOREVER);
+    rt_mutex_take(lock, RT_WAITING_FOREVER);
 
     /* check and close current socket */
     sim76xx_socket_close(socket);
@@ -274,7 +274,7 @@ __retry:
             LOG_D("socket(%d) connect failed, the socket was not be closed and now will connect retry.", device_socket);
             if (sim76xx_socket_close(socket) < 0)
             {
-			    result = -RT_ERROR;
+                result = -RT_ERROR;
                 goto __exit;
             }
             retryed = RT_TRUE;

+ 3 - 3
class/sim800c/at_socket_sim800c.c

@@ -86,11 +86,11 @@ static int sim800c_socket_close(struct at_socket *socket)
     int result = RT_EOK;
     int device_socket = (int) socket->user_data;
     struct at_device *device = (struct at_device *) socket->device;
-    
+
     /* clear socket close event */
     event = SET_EVENT(device_socket, SIM800C_EVNET_CLOSE_OK);
     sim800c_socket_event_recv(device, event, 0, RT_EVENT_FLAG_OR);
-    
+
     if (at_obj_exec_cmd(device->client, NULL, "AT+CIPCLOSE=%d", device_socket) < 0)
     {
         result = -RT_ERROR;
@@ -104,7 +104,7 @@ static int sim800c_socket_close(struct at_socket *socket)
         goto __exit;
     }
 
-__exit:    
+__exit:
     return result;
 }
 

+ 2 - 2
class/w60x/at_device_w60x.c

@@ -154,7 +154,7 @@ static void w60x_get_netdev_info(struct rt_work *work, void *work_data)
     }
 
     pos = rt_strstr(resp->buf, "+OK=");
- 
+
     /* parse response data, get the DHCP status */
     if (!pos)
     {
@@ -511,7 +511,7 @@ void w60x_netdev_netstat(struct netdev *netdev)
 {
     at_response_t resp = RT_NULL;
     struct at_device *device = RT_NULL;
- 
+
     device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, netdev->name);
     if (device == RT_NULL)
     {

+ 1 - 1
samples/at_sample_air720.c

@@ -42,7 +42,7 @@ static struct at_device_air720 sim0 =
 static int air720_device_register(void)
 {
     struct at_device_air720 *air720 = &sim0;
-    
+
     return at_device_register(&(air720->device),
                               air720->device_name,
                               air720->client_name,

+ 2 - 2
samples/at_sample_m5311.c

@@ -21,7 +21,7 @@
  * Date           Author            Notes
  * 2020-03-09     LXGMAX       first version
  */
- 
+
 #include <at_device_m5311.h>
 
 #define LOG_TAG              "at.sample.m5311"
@@ -32,7 +32,7 @@
  * RT_SERIAL_RB_BUFSZ          -> 4096
  * M5311_SAMPLE_RECV_BUFF_LEN  -> 2048
  */
- 
+
 #define M5311_SAMPLE_DEVICE_NAME    "m5311"
 
 static struct at_device_m5311 nb_m5311 = {

+ 1 - 1
samples/at_sample_n21.c

@@ -42,7 +42,7 @@ static struct at_device_n21 sim0 =
 static int n21_device_register(void)
 {
     struct at_device_n21 *n21 = &sim0;
-    
+
     return at_device_register(&(n21->device),
                               n21->device_name,
                               n21->client_name,

+ 1 - 1
samples/at_sample_n58.c

@@ -42,7 +42,7 @@ static struct at_device_n58 sim0 =
 static int n58_device_register(void)
 {
     struct at_device_n58 *n58 = &sim0;
-    
+
     return at_device_register(&(n58->device),
                               n58->device_name,
                               n58->client_name,