【修改】EC20 适配最新 AT 组件改动
This commit is contained in:
parent
4d42e5b884
commit
79aa87181a
15
README.md
15
README.md
|
@ -10,6 +10,7 @@ AT device 软件包是由 RT-Thread AT 组件针对不同 AT 设备的移植文
|
|||
| ---- | ---- |
|
||||
| at_socket_esp8266.c | ESP8266 模块针对 AT 组件的移植文件,实现 AT socket |
|
||||
| at_socket_m26.c | M26/MC20 模块针对 AT 组件的移植文件,实现 AT socket |
|
||||
| at_socket_ec20.c | EC20 模块针对 AT 组件的移植文件,实现 AT socket |
|
||||
| at_client_sample.c | ESP8266 模块 AT Client 功能示例文件 |
|
||||
|
||||
### 1.2 许可证 ###
|
||||
|
@ -19,7 +20,7 @@ at_device package 遵循 LGPLv2.1 许可,详见 `LICENSE` 文件。
|
|||
### 1.3 依赖 ###
|
||||
|
||||
- RT_Thread 3.0+
|
||||
- RT_Thread AT 组件 0.3.X
|
||||
- RT_Thread AT 组件 1.0.0
|
||||
- RT_Thread SAL 组件
|
||||
|
||||
## 2. 获取方式 ##
|
||||
|
@ -31,7 +32,7 @@ AT device 软件包是对 AT 组件库和 AT socket 功能的移植,需开启
|
|||
RT-Thread Components --->
|
||||
Network stack --->
|
||||
Socket abstraction layer --->
|
||||
protocol family type --->
|
||||
protocol stack implement --->
|
||||
[ ] Support lwIP stack
|
||||
[*] Support AT Commands stack
|
||||
|
||||
|
@ -39,11 +40,13 @@ AT device 软件包是对 AT 组件库和 AT socket 功能的移植,需开启
|
|||
|
||||
RT-Thread online packages --->
|
||||
IoT - internet of things --->
|
||||
-*- AT DEVICE: RT-Thread AT component porting or samples for different device
|
||||
-*- AT DEVICE: RT-Thread AT component porting or samples for different device
|
||||
[ ] Enable at device init by thread
|
||||
AT socket device modules (Not selected, please select) --->
|
||||
Version (latest) --->
|
||||
|
||||
- `AT socket device modules`: AT 设备选择,目前支持 ESP8266、M26/MC20 等设备;
|
||||
|
||||
- `Enable at device init by thread`: 配置开启设备网络初始化是否通过创建线程完成;
|
||||
- `AT socket device modules`: AT 设备选择,目前支持 ESP8266、M26/MC20、EC20 等设备;
|
||||
- `Version`: 下载软件包版本;
|
||||
|
||||
## 3. 注意事项 ##
|
||||
|
@ -53,5 +56,5 @@ AT device 软件包是对 AT 组件库和 AT socket 功能的移植,需开启
|
|||
|
||||
## 5. 联系方式
|
||||
|
||||
* 维护:[chenyong](https://github.com/chenyong111)
|
||||
* 维护:RT-Thread 开发团队及社区开发者
|
||||
* 主页:https://github.com/RT-Thread-packages/at_device
|
|
@ -665,7 +665,6 @@ static int ec20_socket_send(int socket, const char *buff, size_t bfsz, enum at_s
|
|||
/* set current socket for send URC event */
|
||||
cur_socket = socket;
|
||||
/* set AT client end sign to deal with '>' sign.*/
|
||||
extern int at_set_end_sign(char ch);
|
||||
at_set_end_sign('>');
|
||||
|
||||
while (sent_size < bfsz)
|
||||
|
@ -1054,32 +1053,6 @@ static const struct at_urc urc_table[] = {
|
|||
{"+QIURC:", "\r\n", urc_qiurc_func},
|
||||
};
|
||||
|
||||
/* AT client port initialization */
|
||||
int at_client_port_init(void)
|
||||
{
|
||||
/* create current AT socket event */
|
||||
at_socket_event = rt_event_create("at_sock_event", RT_IPC_FLAG_FIFO);
|
||||
if (!at_socket_event)
|
||||
{
|
||||
LOG_E("AT client port initialize failed! at_sock_event create failed!");
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
/* create current AT socket lock */
|
||||
at_event_lock = rt_mutex_create("at_event_lock", RT_IPC_FLAG_FIFO);
|
||||
if (!at_event_lock)
|
||||
{
|
||||
LOG_E("AT client port initialize failed! at_sock_lock create failed!");
|
||||
rt_event_delete(at_socket_event);
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
/* register URC data execution function */
|
||||
at_set_urc_table(urc_table, sizeof(urc_table) / sizeof(urc_table[0]));
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
#define AT_SEND_CMD(resp, resp_line, timeout, cmd) \
|
||||
do \
|
||||
{ \
|
||||
|
@ -1417,17 +1390,42 @@ MSH_CMD_EXPORT_ALIAS(ec20_domain, at_domain, AT domain resolve);
|
|||
#endif
|
||||
|
||||
static const struct at_device_ops ec20_socket_ops = {
|
||||
.connect = ec20_socket_connect,
|
||||
.close = ec20_socket_close,
|
||||
.send = ec20_socket_send,
|
||||
.domain_resolve = ec20_domain_resolve,
|
||||
.set_event_cb = ec20_socket_set_event_cb,
|
||||
ec20_socket_connect,
|
||||
ec20_socket_close,
|
||||
ec20_socket_send,
|
||||
ec20_domain_resolve,
|
||||
ec20_socket_set_event_cb,
|
||||
};
|
||||
|
||||
static int at_socket_device_init(void)
|
||||
{
|
||||
{
|
||||
/* create current AT socket event */
|
||||
at_socket_event = rt_event_create("at_se", RT_IPC_FLAG_FIFO);
|
||||
if (!at_socket_event)
|
||||
{
|
||||
LOG_E("AT client port initialize failed! at_sock_event create failed!");
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
/* create current AT socket lock */
|
||||
at_event_lock = rt_mutex_create("at_se", RT_IPC_FLAG_FIFO);
|
||||
if (!at_event_lock)
|
||||
{
|
||||
LOG_E("AT client port initialize failed! at_sock_lock create failed!");
|
||||
rt_event_delete(at_socket_event);
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
|
||||
/* initialize AT client */
|
||||
at_client_init(AT_DEVICE_NAME, AT_DEVICE_RECV_BUFF_LEN);
|
||||
|
||||
/* register URC data execution function */
|
||||
at_set_urc_table(urc_table, sizeof(urc_table) / sizeof(urc_table[0]));
|
||||
|
||||
/* initialize EC20 network */
|
||||
ec20_net_init();
|
||||
|
||||
/* set EC20 AT Socket options */
|
||||
at_scoket_device_register(&ec20_socket_ops);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue