瀏覽代碼

修改中文注释,添加部分使用说明

shao7936626 6 年之前
父節點
當前提交
117bd4f076
共有 4 個文件被更改,包括 10 次插入15 次删除
  1. 2 1
      README.md
  2. 6 11
      class/air720/at_device_air720.c
  3. 1 1
      class/air720/at_device_air720.h
  4. 1 2
      class/air720/at_socket_air720.c

+ 2 - 1
README.md

@@ -2,7 +2,7 @@
 
 ## 1. 简介 ##
 
-AT device 软件包是由 RT-Thread AT 组件针对不同 AT 设备的移植文件和示例代码组成,目前支持的 AT 设备有:ESP8266、ESP32、M26、MC20、RW007、MW31、SIM800C、W60X 、 SIM76XX以及A9/A9G 系列设备等,目前上述设备都完成对 `AT socket` 功能的移植,及设备通过 AT 命令实现标准 socket 编程接口,完成 socket 通讯的功能,具体功能介绍可参考 [《RT-Thread 编程指南》](https://www.rt-thread.org/document/site/programming-manual/at/at/)AT 命令章节 。 
+AT device 软件包是由 RT-Thread AT 组件针对不同 AT 设备的移植文件和示例代码组成,目前支持的 AT 设备有:ESP8266、ESP32、M26、MC20、RW007、MW31、SIM800C、W60X 、air720、SIM76XX以及A9/A9G 系列设备等,目前上述设备都完成对 `AT socket` 功能的移植,及设备通过 AT 命令实现标准 socket 编程接口,完成 socket 通讯的功能,具体功能介绍可参考 [《RT-Thread 编程指南》](https://www.rt-thread.org/document/site/programming-manual/at/at/)AT 命令章节 。 
 
 ### 1.1. 目录结构 ###
 
@@ -123,6 +123,7 @@ RT-Thread online packages  --->
 - **Notion MW31**:开启 MW31 (WIFI 模块)设备支持; 
 - **WinnerMicro W60X**:开启 W60X (WIFI 模块)设备支持;
 - **AiThink A9/A9G**:开启 A9/A9G (2G 模块)设备支持;
+- **Luat air720**:开启 air720 4G 模块)设备支持;
 - **Version** 下载软件包版本;
 
 上面配置选项以 2G 模块和 WIFI 模块选项为例,介绍了`V2.X.X` 版本 AT device 软件包配置方式,如下几点值得注意:

+ 6 - 11
class/air720/at_device_air720.c

@@ -247,8 +247,8 @@ static void check_link_status_entry(void *parameter)
 
     char parsed_data[10] = {0};
     struct netdev *netdev = (struct netdev *)parameter;
-    // rt_uint8_t buf[2] = {0};
-    //LOG_E("statrt air720 device(%s) link status check \n");
+    
+    LOG_D("statrt air720 device(%s) link status check \n");
 
     device = at_device_get_by_name(AT_DEVICE_NAMETYPE_NETDEV, netdev->name);
     if (device == RT_NULL)
@@ -284,7 +284,7 @@ static void check_link_status_entry(void *parameter)
             netdev_low_level_set_link_status(netdev, (air720_LINK_STATUS_OK == link_status));
         }
 
-        if (rt_pin_read(air720->power_status_pin) == PIN_HIGH) //判断lte是否掉线,如果掉线需要重启
+        if (rt_pin_read(air720->power_status_pin) == PIN_HIGH) //check the module_status , if moduble_status is Low, user can do your logic here
         {
             if (at_obj_exec_cmd(device->client, resp, "AT+CSQ") == 0)
             {
@@ -297,7 +297,7 @@ static void check_link_status_entry(void *parameter)
         }
         else
         {
-            //LTE 掉线
+            //LTE down
             LOG_E("the lte pin is low");
         }
 
@@ -664,7 +664,7 @@ static void air720_init_thread_entry(void *parameter)
         rt_memset(parsed_data, 0, sizeof(parsed_data));
         rt_thread_mdelay(1000);
         air720_power_on(device);
-        rt_thread_mdelay(25000);
+        rt_thread_mdelay(25000); //check the air720 hardware manual, when we use the pow_key to start air720, it takes about 20s,so we put 25s here to ensure starting air720 normally.
 
         LOG_I("start initializing the air720 device(%s)", device->name);
         /* wait air720 startup finish */
@@ -783,19 +783,16 @@ static void air720_init_thread_entry(void *parameter)
         {
             /* "CMCC" */
             LOG_E("air720 device(%s) network operator: %s", device->name, parsed_data);
-            client = device->client; //我也很疑惑
             AT_SEND_CMD(client, resp, 0, 300, CSTT_CHINA_MOBILE);
         }
         else if (rt_strcmp(parsed_data, "CHN-UNICOM") == 0)
         {
             /* "UNICOM" */
             LOG_E("air720 device(%s) network operator: %s", device->name, parsed_data);
-            client = device->client; //我也很疑惑
             AT_SEND_CMD(client, resp, 0, 300, CSTT_CHINA_UNICOM);
         }
         else if (rt_strcmp(parsed_data, "CHINA TELECOM") == 0)
         {
-            client = device->client; //我也很疑惑
             AT_SEND_CMD(client, resp, 0, 300, CSTT_CHINA_TELECOM);
             /* "CT" */
             LOG_E("air720 device(%s) network operator: %s", device->name, parsed_data);
@@ -836,9 +833,8 @@ static void air720_init_thread_entry(void *parameter)
     if (result == RT_EOK)
     {
         /* set network interface device status and address information */
-        air720_netdev_set_info(device->netdev); //这边有问题
+        air720_netdev_set_info(device->netdev); 
         air720_netdev_check_link_status(device->netdev);
-        //  flag_at_conn_success = DEF_bON;
         LOG_I("air720 device(%s) network initialize success!", device->name);
     }
     else
@@ -851,7 +847,6 @@ static int air720_net_init(struct at_device *device)
 {
 #ifdef AT_DEVICE_AIR720_INIT_ASYN
     rt_thread_t tid;
-
     tid = rt_thread_create("air720_net_init", air720_init_thread_entry, (void *)device,
                            AIR720_THREAD_STACK_SIZE, AIR720_THREAD_PRIORITY, 20);
     if (tid)

+ 1 - 1
class/air720/at_device_air720.h

@@ -34,7 +34,7 @@ extern "C" {
 #include <at_device.h>
 
 /* The maximum number of sockets supported by the air720 device */
-#define AT_DEVICE_AIR720_SOCKETS_NUM      5  //不清楚这个怎么查
+#define AT_DEVICE_AIR720_SOCKETS_NUM      6  
 
 struct at_device_air720
 {     

+ 1 - 2
class/air720/at_socket_air720.c

@@ -197,7 +197,6 @@ __retry:
     /* 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 (air720_socket_event_recv(device, SET_EVENT(device_socket, 0), 10 * RT_TICK_PER_SECOND, RT_EVENT_FLAG_OR) < 0)
     {
-        //这边会有问题bug  在这边考虑直接如果这样就直接重启模块,还是重复几次重启模块
         LOG_E("air720 device(%s) socket(%d) connect failed, wait connect result timeout.", device->name, device_socket);
         result = -RT_ETIMEOUT;
         goto __exit;
@@ -635,7 +634,7 @@ static const struct at_socket_ops air720_socket_ops =
         air720_socket_connect,
         air720_socket_close,
         air720_socket_send,
-        air720_domain_resolve, //域名解析
+        air720_domain_resolve, 
         air720_socket_set_event_cb,
 };