/**@brief Function for initializing the Apple Notification Center Service. */ static void service_init(void) { ble_ancs_c_init_t ancs_init_obj; ble_uuid_t service_uuid; uint32_t err_code; err_code = sd_ble_uuid_vs_add(&ble_ancs_base_uuid128, &m_ancs_uuid_type); APP_ERROR_CHECK(err_code); err_code = sd_ble_uuid_vs_add(&ble_ancs_cp_base_uuid128, &service_uuid.type); APP_ERROR_CHECK(err_code); err_code = sd_ble_uuid_vs_add(&ble_ancs_ns_base_uuid128, &service_uuid.type); APP_ERROR_CHECK(err_code); err_code = sd_ble_uuid_vs_add(&ble_ancs_ds_base_uuid128, &service_uuid.type); APP_ERROR_CHECK(err_code); memset(&ancs_init_obj, 0, sizeof(ancs_init_obj)); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_TITLE, m_attr_title, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_SUBTITLE, m_attr_subtitle, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_MESSAGE, m_attr_message, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE, m_attr_message_size, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_DATE, m_attr_date, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL, m_attr_posaction, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(BLE_ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL, m_attr_negaction, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); ancs_init_obj.evt_handler = on_ancs_c_evt; ancs_init_obj.error_handler = apple_notification_error_handler; err_code = ble_ancs_c_init(&m_ancs_c, &ancs_init_obj); APP_ERROR_CHECK(err_code); }
/**@brief Function for initializing the Apple Notification Center Service. */ void service_init(void) { uint32_t err_code; #if 0 //An LED array cannot show attributes anyway err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_TITLE, m_attr_title, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_SUBTITLE, m_attr_subtitle, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_MESSAGE, m_attr_message, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE, m_attr_message_size, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_DATE, m_attr_date, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL, m_attr_posaction, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); err_code = ble_ancs_c_attr_add(&m_ancs_c, BLE_ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL, m_attr_negaction, ATTR_DATA_SIZE); APP_ERROR_CHECK(err_code); #endif ble_ancs_c_init_t ancs_init_obj = { .evt_handler = on_ancs_c_evt, .error_handler = apple_notification_error_handler }; err_code = ble_ancs_c_init(&m_ancs_c, &ancs_init_obj); APP_ERROR_CHECK(err_code); }