ser_conn_handlers.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. /**
  13. * @addtogroup ser_conn Connectivity application code
  14. * @ingroup ble_sdk_lib_serialization
  15. */
  16. /** @file
  17. *
  18. * @defgroup ser_conn_handlers Events handlers in the connectivity chip
  19. * @{
  20. * @ingroup ser_conn
  21. *
  22. * @brief Events handlers used to process high level events in the connectivity application.
  23. *
  24. * @details This file contains functions: processing the HAL Transport layer events, processing BLE
  25. * SoftDevice events, starting processing received packets.
  26. */
  27. #ifndef SER_CONN_HANDLERS_H__
  28. #define SER_CONN_HANDLERS_H__
  29. #include <stdint.h>
  30. #include "nordic_common.h"
  31. #include "app_util.h"
  32. #include "ble_stack_handler_types.h"
  33. #include "ant_stack_handler_types.h"
  34. #include "softdevice_handler.h"
  35. #include "ble.h"
  36. #include "ser_hal_transport.h"
  37. /** Maximum number of events in the application scheduler queue. */
  38. #define SER_CONN_SCHED_QUEUE_SIZE 16u
  39. /** Maximum size of events data in the application scheduler queue aligned to 32 bits - this is
  40. * size of the buffer created in the SOFTDEVICE_HANDLER_INIT macro, which stores events pulled
  41. * from the SoftDevice. */
  42. #define SER_CONN_SCHED_MAX_EVENT_DATA_SIZE ((CEIL_DIV(MAX( \
  43. MAX(BLE_STACK_EVT_MSG_BUF_SIZE, \
  44. ANT_STACK_EVT_STRUCT_SIZE), \
  45. SYS_EVT_MSG_BUF_SIZE \
  46. ), \
  47. sizeof(uint32_t))) * \
  48. sizeof(uint32_t))
  49. /**@brief A function for processing the HAL Transport layer events.
  50. *
  51. * @param[in] event HAL Transport layer event.
  52. */
  53. void ser_conn_hal_transport_event_handle(ser_hal_transport_evt_t event);
  54. /**@brief A function to call the function to process a packet when it is fully received.
  55. *
  56. * @retval NRF_SUCCESS Operation success.
  57. * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied.
  58. * @retval NRF_ERROR_INTERNAL Operation failure. Internal error ocurred.
  59. */
  60. uint32_t ser_conn_rx_process(void);
  61. /**@brief A function for processing BLE SoftDevice events.
  62. *
  63. * @details BLE events are put into application scheduler queue to be processed at a later time.
  64. *
  65. * @param[in] p_ble_evt A pointer to a BLE event.
  66. */
  67. void ser_conn_ble_event_handle(ble_evt_t * p_ble_evt);
  68. #endif /* SER_CONN_HANDLERS_H__ */
  69. /** @} */