Beispiel #1
0
void att_server_init(uint8_t const * db, att_read_callback_t read_callback, att_write_callback_t write_callback){

    sm_register_packet_handler(att_event_packet_handler);

    att_dispatch_register_server(att_packet_handler);

    att_server_state = ATT_SERVER_IDLE;
    att_set_db(db);
    att_set_read_callback(read_callback);
    att_set_write_callback(write_callback);

}
Beispiel #2
0
void att_server_init(uint8_t const * db, att_read_callback_t read_callback, att_write_callback_t write_callback){

    // store callbacks
    att_server_client_read_callback  = read_callback;
    att_server_client_write_callback = write_callback;

    // register for HCI Events
    hci_event_callback_registration.callback = &att_event_packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);

    // register for SM events
    sm_event_callback_registration.callback = &att_event_packet_handler;
    sm_add_event_handler(&sm_event_callback_registration);

    // and L2CAP ATT Server PDUs
    att_dispatch_register_server(att_packet_handler);

    att_set_db(db);
    att_set_read_callback(att_server_read_callback);
    att_set_write_callback(att_server_write_callback);

}