Hi all, i am doing a BLE project using nrf51822 hardware, in this project my requirement is to initialize the event, for doing that i took ble_app_proximity,ble_app_hrs as reference code ,
so what i did to meet my requirement is ,
from main() i called services_init()
and in this i intialize
ble_hrs_init_t->evt_handler=evt_handler;[refered from ble_app_hrs ]
and my evt_handlert defination is like this
evt_handler(ble_hrs_t *p_nus, ble_hrs_evt_t * p_evt)
it seems there is two type of structure related to evnt
1)typedef struct
{
ble_hrs_evt_type_t evt_type; /**< Type of event. */
} ble_hrs_evt_t;
2)typedef struct
{
ble_evt_hdr_t header; /**< Event header. */
union
{
ble_common_evt_t common_evt; /**< Common Event, evt_id in BLE_EVT_* series. */
ble_gap_evt_t gap_evt; /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */
ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */
ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */
ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */
} evt;
} ble_evt_t;
so my doubt is:
1) which data structure should use as second pararameter of evt_handler either ble_hrs_evt_t or ble_evt_t?
2)if i use ble_hrs_evt_t as second parameter, then this has member ble_hrs_evt_type_t which is enum of this type
typedef enum
{
BLE_HRS_EVT_NOTIFICATION_ENABLED, /**< Heart Rate value notification enabled event. */
BLE_HRS_EVT_NOTIFICATION_DISABLED /**< Heart Rate value notification disabled event. */
} ble_hrs_evt_type_t;
so in this can i define my own event type?
3) under what situations is one data structure preferred over other, for example in ble_hrs ble_hrs_evt_t; is used
4) under ble_app_proximity project, the ble_evt_t is used and i wanted to know the reason behind using this structure as compared to
point 3.
Can any one please share information related to this....? Thanks Renu