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

how to call "parse_get_notif_attrs_response" function in ANCS?

Hello, All.

I want to know AppID in iPhone's App using ANCS. (for example, Facebook App's AppID is "com.facebook.Facebook", Facetime's AppID is "com.apple.facetime")

These are my environments.


Board: custom board.

chip: nrf51822AA

SDK 8.1

SD 8.0.0

Debugger: J-link EDU

Base code : C:\Keil_v5\ARM\Device\Nordic\nRF51_SDK_8.1.0_b6ed55f\examples\ble_peripheral\ble_app_ancs_c\pca10028\s110\arm5_no_packs\ble_app_ancs_c_s110_pca10028.uvprojx


In SDK 6.1.0. version, I make the "ble_ancs_get_app_attributes" function which modifies the "ble_ancs_get_notification_attributes" function. In this function, I send the parameter like below in "event_notify" function in ble_ancs_c.c


ble_ancs_attr_list_t attr_list_2[1];

attr_list_2[0].attribute_id = BLE_ANCS_APP_ATTRIBUTE_ID_DISPLAYNAME; attr_list_2[0].attribute_len = 32;

uint32_t err_code2 = ble_ancs_get_app_attributes(p_ancs, assigned_app_identifier, 1, attr_list_2);


But, in SDK 8.1.0 version, I don't know how to make function like this, or any other way to know AppID.

I thought that maybe I use the "parse_get_notif_attrs_response" function or "ble_ancs_c_request_attrs" function.

But "parse_get_notif_attrs_response" function is called only when in "on_evt_gattc_notif" function, "p_notif->handle" is equal to "m_service.data_source.handle_value". How I make "p_notif-> handle" value is equal to "m_service.data_source.handle_value"? (This value(data source handle value) is 33. )

And, another way I thought is calling "ble_ancs_c_request_attrs" function. This function is called when the "BSP_EVENT_KEY_1" button is pushed. But I don't need button event. So, where I call this "ble_ancs_c_request_attrs" function" to show AppID?

Last, is it right what I thought to know AppID?

Parents
  • Hi Min,

    In SDK v8.0 we only configure to receive Title, Subtitle, Message, MessageSize, etc. But not the AppID. If you want to get the app ID reported when you send Get Notification Attributes, you would need to enable it in service_init(), you should add:

    err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER, m_attr_appID, ATTR_DATA_SIZE);
    APP_ERROR_CHECK(err_code);
    

    After that you should have the appid when you press button 2 on the nRF51DK.

Reply
  • Hi Min,

    In SDK v8.0 we only configure to receive Title, Subtitle, Message, MessageSize, etc. But not the AppID. If you want to get the app ID reported when you send Get Notification Attributes, you would need to enable it in service_init(), you should add:

    err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER, m_attr_appID, ATTR_DATA_SIZE);
    APP_ERROR_CHECK(err_code);
    

    After that you should have the appid when you press button 2 on the nRF51DK.

Children
No Data
Related