Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

define queue in a structure

I have searched this website,there is only 1 post,but that is not my scenario.

I think this is a normal use case:

There is a struct:

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I want to allocate a queue for each struct.(I have to connect up to 20 BLE peripherals in a single nRF52840 module,it is better to allocate queue for each one for some BLE peripherals maybe lose connection temperarily,that will block the whole tranfer process  with only one buffer)

Do we have a right way to call NRF_QUEUE_DEF?

If no,this port code is right?

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

-> normal funtion

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • I misunderstanded the  nrf_queue_cb_t type,I thought it is a callback function.It is not.

    But not understand the Log code, actually don't get the whole LOG module structure.

    Except log function, it looks like we can just define a nrf_queue_t instance,allocate memory,and then we can process with queue functions.

  • Hi,

     

    I might be misunderstanding you scenario here, but most of these GATT based queues are handled with the nrf_ble_gq library, which is used by most examples in nRF5 SDK v17. Please correct me if I have not understood your scenario fully.

    Here's a high-level documentation that explains the BLE GATT queue: https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/lib_ble_gatt_queue.html

    OldXiao said:

    But not understand the Log code, actually don't get the whole LOG module structure.

    Have you tried enabling logging (and set sdk_config.h::NRF_QUEUE_CONFIG_LOG_ENABLED to '1') to see how it behaves for the specific module?

    Have you checked the documentation chapter on the subject?

    https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/lib_nrf_log.html

    OldXiao said:
    Except log function, it looks like we can just define a nrf_queue_t instance,allocate memory,and then we can process with queue functions.

    Have you looked at how this is implemented in other central implemented services, like ble_nus_c for instance? Follow the p_gatt_queue and other vars/API calls to the nrf_ble_gq module.

     

    Kind regards,

    Håkon