-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Obex enablement #83781
base: main
Are you sure you want to change the base?
Obex enablement #83781
Conversation
Another massive PR? :) @lylezhu2012 I think the L2CAP and RFCOMM improvements could at least be split out into their own PRs. That way I think we can make faster progress with getting functionality merged incrementally. |
Actually, my PR only implements basic goep/obex operations, but goep and obex define too many concepts.
Well, I will remove all other layers changes from this PR. And make small PR for these changes. |
1dfaefe
to
e4a2256
Compare
e4a2256
to
f70741b
Compare
test failure is unrelated and will be fixed with #83907 |
@@ -0,0 +1,1443 @@ | |||
/* obex.h - IrDA Oject Exchange Protocol handling */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IrDA suppose should be bluetooth?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full name of obex
is IrDA Object Exchange Protocol
.
#include <errno.h> | ||
#include <stdbool.h> | ||
|
||
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_OBEX_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, the header guard should be placed at the very beginning of the header file, it should be before #include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
/** Converts a OBEX response code to string. | ||
* | ||
* @return The string representation of the response code code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate typo "code"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
}; | ||
|
||
/** Converts a OBEX response code to string. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No @param doxygen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
f70741b
to
59ac793
Compare
59ac793
to
4c7feba
Compare
In the function `bt_l2cap_br_server_register()`, the PSM cannot be dynamic allocated. And only pre-set PSM is supported. Improve the function `bt_l2cap_br_server_register()` to support the dynamic PSM allocation if the passed PSM is zero. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In the function `bt_rfcomm_server_register()`, the channel cannot be dynamic allocated. And only pre-set channel is supported. Improve the function `bt_rfcomm_server_register()` to support the dynamic channel allocation if the passed channel is zero. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
In current implementation, the `accept` cannot be identified if the same one `accept` callback is passed by the upper layer. Similar with `accept` of `bt_l2cap_server.accept`, add a parameter `server` to the `bt_rfcomm_server.accept` callback. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Since a new argument `server` is added by `bt_rfcomm_server.accept`, add a argument `server` to function rfcomm_accept() to avoid building issue. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Since a new argument `server` is added by `bt_rfcomm_server.accept`, add a argument `server` to function rfcomm_accept() to avoid building issue. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add a Kconfig BT_GOEP to control the GOEP feature. Implement the GOEP protocol and transport, both for GOEP 1.1 and GOEP 2.x. For GOEP transport, OBEX over RFCOMM, and OBEX over L2CAP are supported. For GOEP protocol, `put`, `get`, `abort`, `setpath`, and `action` are supported. And only one operation can be processed at the same time. The feature `Reliable Session` is unsupported. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The MTU of the GOEP should be not less than 255. So, if the transport is RFCOMM, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 264. It includes, - 255 bytes for the minimum MTU of GOEP, - 4 bytes for L2CAP Header, - 5 bytes for RFCOMM header and FCS. And if the transport is L2CAP, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 259. It includes, - 255 bytes for the minimum MTU of GOEP, - 4 bytes for L2CAP Header. Add Kconfig `BT_GOEP_RFCOMM_MTU` to configure the maximum size for RFCOMM transport. The range of `BT_GOEP_RFCOMM_MTU` is `[264, BT_RFCOMM_L2CAP_MTU]`. And the GOEP MTU via RFCOMM transport should be in the range `[255, (BT_GOEP_RFCOMM_MTU-9)]`. Add Kconfig `BT_GOEP_L2CAP_MTU` to configure the maximum size for L2CAP transport. The range of `BT_GOEP_L2CAP_MTU` is `[259, BT_BUF_ACL_RX_SIZE]`. And the GOEP MTU via L2CAP transport should be in the range `[255, (BT_GOEP_L2CAP_MTU-4)]`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
The buffer `BT_RFCOMM_BUF_SIZE` is used to define the TX buffer size of TX pool. In current implementation, the TX buffer size of RFCOMM cannot be calculated due to the macro `BT_RFCOMM_BUF_SIZE` is defined in internal header file `rfcomm_internal.h`. Move the macro `BT_RFCOMM_BUF_SIZE` form internal header file `rfcomm_internal.h` to interface `rfcomm.h`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add commands for GOEP to test transport features. Add commands for transport over RFCOMM, including `register-rfcomm`, `connect-rfcomm`, and `disconnect-rfcomm`. Add commands for transport over L2CAP, including `register-l2cap`, `connect-l2cap`, and `disconnect-l2cap`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
Add commands for GOEP to test OBEX features. Add command `alloc-buf` and `release-buf` to allocate and release TX buffer. Add command set `add-header` to add the OBEX headers to allocated TX buffer. Add command set `client` to send OBEX client requests with allocated TX buffer. Add command set `server` to send OBEX responses with allocated TX buffer. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
There are types of string can be added by using OBEX adding header function bt_obex_add_header_*(). One is byte sequence. Another is null terminated Unicode text. Add a function bt_obex_string_is_valid() to check if the added string is valid. And add a function bt_obex_unicode_is_valid() dedicated to check Unicode string. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
4c7feba
to
2177c21
Compare
Add a Kconfig BT_GOEP to control the GOEP feature.
Implement the GOEP protocol and transport, both for GOEP 1.1 and GOEP 2.x.
For GOEP transport, OBEX over RFCOMM, and OBEX over L2CAP are supported.
For GOEP protocol,
put
,get
,abort
,setpath
, andaction
are supported. And only one operation can be processed at the same time. The featureReliable Session
is unsupported.The MTU of the GOEP should be not less than 255. So, if the transport is RFCOMM, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 264.
It includes,
And if the transport is L2CAP, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 259.
It includes,
Add Kconfig
BT_GOEP_RFCOMM_MTU
to configure the maximum size for RFCOMM transport. The range ofBT_GOEP_RFCOMM_MTU
is[264, BT_RFCOMM_L2CAP_MTU]
. And the GOEP MTU via RFCOMM transport should be in the range[255, (BT_GOEP_RFCOMM_MTU-9)]
.Add Kconfig
BT_GOEP_L2CAP_MTU
to configure the maximum size for L2CAP transport. The range ofBT_GOEP_L2CAP_MTU
is[259, BT_BUF_ACL_RX_SIZE]
. And the GOEP MTU via L2CAP transport should be in the range[255, (BT_GOEP_L2CAP_MTU-4)]
.Add commands for GOEP to test transport features.
Add commands for transport over RFCOMM, including
register-rfcomm
,connect-rfcomm
, anddisconnect-rfcomm
.Add commands for transport over L2CAP, including
register-l2cap
,connect-l2cap
, anddisconnect-l2cap
.Add commands for GOEP to test OBEX features.
Add command
alloc-buf
andrelease-buf
to allocate and release TX buffer.Add command set
add-header
to add the OBEX headers to allocated TX buffer.Add command set
client
to send OBEX client requests with allocated TX buffer.Add command set
server
to send OBEX responses with allocated TX buffer.There are types of string can be added by using OBEX adding header function bt_obex_add_header_*(). One is byte sequence. Another is null terminated Unicode text.
Add a function bt_obex_string_is_valid() to check if the added string is valid. And add a function bt_obex_unicode_is_valid() dedicated to check Unicode string.