This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Multilink Central how to access the data received from HVX

I can't find anything related to this in the docs :(

In the client_handling.c is a function static void on_evt_hvx(ble_evt_t * p_ble_evt, client_t * p_client, uint32_t index). That looks promising. Also there is p_ble_evt->evt.gattc_evt.params.hvx.data[0]

How can I access this in main()? I can't get a variable I declared in either main.c or client_handling.c to be seen in the other file

Parents
  • Ok. This will do quite fine for the start:

    uint8_t test[7] = {0};
    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
    	for (int i=0; i<7; i++) {
    		test[i] = p_ble_evt->evt.gattc_evt.params.hvx.data[i]; }
    		printf("%X %X %X %X %X %X %X\n",test[0],test[1],test[2],test[3],test[4],test[5],test[6]);
    

    Now I just have to add a way to distinguish the different sender and to only print this when I really receive a notification (on startup it outputs lot lines of garbage..) -> add

    	   switch (p_ble_evt->header.evt_id)
    {
    		case BLE_GATTC_EVT_HVX:
    

    seems to do the trick.

    Now I only need to find a way to distinguish between the different sender... not only by a random index when they got paired or whatever is used in the example.. Well maybe I will just stick to the workaround. 1 byte more with each notification every 4seconds shouldn't consume that much current..

Reply
  • Ok. This will do quite fine for the start:

    uint8_t test[7] = {0};
    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
    	for (int i=0; i<7; i++) {
    		test[i] = p_ble_evt->evt.gattc_evt.params.hvx.data[i]; }
    		printf("%X %X %X %X %X %X %X\n",test[0],test[1],test[2],test[3],test[4],test[5],test[6]);
    

    Now I just have to add a way to distinguish the different sender and to only print this when I really receive a notification (on startup it outputs lot lines of garbage..) -> add

    	   switch (p_ble_evt->header.evt_id)
    {
    		case BLE_GATTC_EVT_HVX:
    

    seems to do the trick.

    Now I only need to find a way to distinguish between the different sender... not only by a random index when they got paired or whatever is used in the example.. Well maybe I will just stick to the workaround. 1 byte more with each notification every 4seconds shouldn't consume that much current..

Children
No Data
Related