Support alloc socket dynamically#126
Merged
Lawlieta merged 3 commits intoRT-Thread-packages:masterfrom Jul 25, 2020
Merged
Conversation
Lawlieta
reviewed
Jul 22, 2020
class/bc28/at_socket_bc28.c
Outdated
|
|
||
| static const struct at_socket_ops bc28_socket_ops = | ||
| { | ||
| bc28_socket_create, |
Contributor
There was a problem hiding this comment.
建议添加 AT 组件版本号判断已经将 bc28_socket_create 定义放在结构体最后,以提高版本兼容性。
详见 RT-Thread/rt-thread#3755 PR 说明
Contributor
Author
|
已经调整了成员函数的位置,并且在 at_socket_ops 中增加了版本号判断 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
由于部分 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。所以不会影响其他模块的使用。