Esempio n. 1
0
/**@brief Initialization of the Alert Notification Service Client.
 */
static void alert_notification_init(void)
{
    uint32_t         err_code;
    ble_ans_c_init_t ans_init_obj;
    bool             services_delete;

    memset(&ans_init_obj, 0, sizeof(ans_init_obj));
    memset(m_alert_message_buffer, 0, MESSAGE_BUFFER_SIZE);

    ans_init_obj.evt_handler            = on_ans_c_evt;
    ans_init_obj.message_buffer_size    = MESSAGE_BUFFER_SIZE;
    ans_init_obj.p_message_buffer       = m_alert_message_buffer;
    ans_init_obj.flash_page_num         = ANS_FLASH_PAGE;
    ans_init_obj.error_handler          = alert_notification_error_handler;

    err_code = ble_ans_c_init(&m_ans_c, &ans_init_obj);
    APP_ERROR_CHECK(err_code);

    // Clear all discovered and stored services if the "non-connectable advertisement start"
    // button is pushed
    err_code = app_button_is_pushed(BONDMNGR_DELETE_BUTTON_PIN_NO, &services_delete);
    APP_ERROR_CHECK(err_code);

    if (services_delete)
    {
        err_code = ble_ans_c_service_delete();
        APP_ERROR_CHECK(err_code);
    }

    err_code = ble_ans_c_service_load(&m_ans_c);
    APP_ERROR_CHECK(err_code);
}
Esempio n. 2
0
/**@brief Function for initialization of the Alert Notification Service Client.
 */
static void alert_notification_init()
{
    uint32_t         err_code;
    ble_ans_c_init_t ans_init_obj;

    memset(&ans_init_obj, 0, sizeof(ans_init_obj));
    memset(m_alert_message_buffer, 0, MESSAGE_BUFFER_SIZE);

    ans_init_obj.evt_handler         = on_ans_c_evt;
    ans_init_obj.message_buffer_size = MESSAGE_BUFFER_SIZE;
    ans_init_obj.p_message_buffer    = m_alert_message_buffer;
    ans_init_obj.error_handler       = alert_notification_error_handler;

    err_code = ble_ans_c_init(&m_ans_c, &ans_init_obj);
    APP_ERROR_CHECK(err_code);
}