How to become notified of BSD non-blocking events

Hi there,

I'm intending to use the nrfxlib modem library and its BSD socket implementation on the nRF9160. My goal is to use non-blocking APIs and use `nrf_poll` in response to various events.

For example, I'd like to use `nrf_recv` (1) with `NRF_O_NONBLOCK` and then receive a notification when there is data available given its respective file descriptor. To achieve this, I'm wondering if I can connect an IPC RECEIVE event with all IPC channels, which'd see that `nrf_poll` is then called by my code.

Thanks for any guidance here.

(1) https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfxlib/nrf_modem/doc/api.html#group__nrf__socket__api_1ga1a288076f560857cb46fa0df46e1c7e5

Parents Reply
  • You're halfway right in the understanding of the function, its main purpose is to sleep for a timeout-period or until something happens on that specific socket. Think of it as an event based system.

    My app has other peripherals to service and not just the modem and so I can't block on the latter. I was looking for an interrupt or event that I can hook onto indicating that "something" has happened re. the modem worthy of a subsequent call to nrf_poll. I'm unsure how `nrf_modem_os_timedwait` achieves this as it must be something called indirectly from the main loop of my program. I suspect that subscribing to the IPC events might be sufficient. Thanks for any confirmation and apologies if I'm still not yet understanding something.

Children
Related