Skip to content

Conversation

@luhuadong
Copy link
Contributor

由于部分 AT 模块/固件(比如 BC28)在申请 socket 时并不一定从 0 开始,运行过程的其他服务也可能会占用 socket(比如 DNS 域名解析),因此造成申请的 socket 并不连续。这种情况与 at socket 框架的实现存在冲突,对 at device 的实现造成较大限制。

因此我提出了一种修改方案 #3755,在 at_socket_ops 结构体增加一个成员函数 at_socket,用于申请并返回 AT 设备真实可用的 socket 号,at device 模块可以根据自身情况决定是否需要实现该函数。

同时,为了兼容本次修改,我在 at_device 其他所有设备的 at_socket_ops 构造中均添加了 at_socket 指向 RT_NULL。所以不会影响其他模块的使用。

static const struct at_socket_ops rw007_socket_ops =
{
    RT_NULL,
    rw007_socket_connect,
    rw007_socket_close,
    rw007_socket_send,
    rw007_domain_resolve,
    rw007_socket_set_event_cb,
};


static const struct at_socket_ops bc28_socket_ops =
{
bc28_socket_create,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议添加 AT 组件版本号判断已经将 bc28_socket_create 定义放在结构体最后,以提高版本兼容性。

详见 RT-Thread/rt-thread#3755 PR 说明

@luhuadong
Copy link
Contributor Author

已经调整了成员函数的位置,并且在 at_socket_ops 中增加了版本号判断

@Lawlieta Lawlieta merged commit 6c9041b into RT-Thread-packages:master Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants