Open johnlange2 opened 2 years ago
I just wonder if applications could use the BSD socket interface (sendmsg/recvmsg) to send and receive SMS messages. Any opinions about this?
Thanks for this suggestion, @jukkar . Using socket functions sendmsg/recvmsg for SMS on an open socket is an interesting idea. There are a couple of considerations though... one is that recvmsg() is not in struct socket_op_vtable. That would be easy to add, but another consideration is that a couple of modem drivers (quectel-bg9x and ublox-sara-r4) use sendmsg for non-SMS purposes, so using it for SMS would likely break them.
Hi @johnlange2, we briefly discussed the SMS recv support API in the todays networking forum. I think we could have is a simple recv API that would allow both polling and blocking API. Just place a timeout option to the API. If the timeout value is K_NO_WAIT
, then the recv just checks if there is anything available and returns with proper return code. If the user sets the timeout to K_FOREVER
, then the API will wait as long as needed. And if the timeout is some arbitrary value, then the recv will wait that amount.
Sounds good, will do. Thanks!
I submitted a merge request for this here: https://github.com/zephyrproject-rtos/zephyr/pull/41175
Hi @bjarki-trackunit,
This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person.
Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason.
@johnlange2 you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you.
Thanks!
This issue is still relevant. My colleague, @jtbaumann, submitted a different PR, https://github.com/zephyrproject-rtos/zephyr/pull/59805, but it has also gotten closed. I believe he intends to either refresh his PR or submit a new one for SMS functionality.
Many modems support SMS messaging, but there is currently no standard way to use SMS messaging in Zephyr modem drivers.
Proposed solution: Add a header file (modem_sms.h) with supporting defines and structs Add two function pointers to
struct modem_context
for SMS send and receive Addsms
sub-command to modem_shell.c to interactively send and receive SMS messaging Modem drivers will need to add SMS send and receive functions (this can be added separately)Support for SMS messaging should be modem-specific with optional implementation
For most modems, only a valid modem context should be needed. (i.e., no socket must be opened before sending or receiving SMS messages)
In some situations, it may be preferable to send/receive SMS messages using an open socket. To support this, two ioctl/fcntl commands can be defined in modem_sms.h