xref: /btstack/test/mock/mock_att_server.h (revision 0f9df0ab0a5d77809a31b4e1c18374fb34ce7841)
10b0c01c9SMilanka Ringwald /*
20b0c01c9SMilanka Ringwald  * Copyright (C) 2020 BlueKitchen GmbH
30b0c01c9SMilanka Ringwald  *
40b0c01c9SMilanka Ringwald  * Redistribution and use in source and binary forms, with or without
50b0c01c9SMilanka Ringwald  * modification, are permitted provided that the following conditions
60b0c01c9SMilanka Ringwald  * are met:
70b0c01c9SMilanka Ringwald  *
80b0c01c9SMilanka Ringwald  * 1. Redistributions of source code must retain the above copyright
90b0c01c9SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer.
100b0c01c9SMilanka Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
110b0c01c9SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer in the
120b0c01c9SMilanka Ringwald  *    documentation and/or other materials provided with the distribution.
130b0c01c9SMilanka Ringwald  * 3. Neither the name of the copyright holders nor the names of
140b0c01c9SMilanka Ringwald  *    contributors may be used to endorse or promote products derived
150b0c01c9SMilanka Ringwald  *    from this software without specific prior written permission.
160b0c01c9SMilanka Ringwald  * 4. Any redistribution, use, or modification is done solely for
170b0c01c9SMilanka Ringwald  *    personal benefit and not for any commercial purpose or for
180b0c01c9SMilanka Ringwald  *    monetary gain.
190b0c01c9SMilanka Ringwald  *
200b0c01c9SMilanka Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
210b0c01c9SMilanka Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
220b0c01c9SMilanka Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
230b0c01c9SMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
240b0c01c9SMilanka Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
250b0c01c9SMilanka Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
260b0c01c9SMilanka Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
270b0c01c9SMilanka Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
280b0c01c9SMilanka Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
290b0c01c9SMilanka Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
300b0c01c9SMilanka Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
310b0c01c9SMilanka Ringwald  * SUCH DAMAGE.
320b0c01c9SMilanka Ringwald  *
330b0c01c9SMilanka Ringwald  * Please inquire about commercial licensing options at
340b0c01c9SMilanka Ringwald  * [email protected]
350b0c01c9SMilanka Ringwald  *
360b0c01c9SMilanka Ringwald  */
370b0c01c9SMilanka Ringwald #ifndef MOCK_ATT_SERVER_H
380b0c01c9SMilanka Ringwald #define MOCK_ATT_SERVER_H
390b0c01c9SMilanka Ringwald 
400b0c01c9SMilanka Ringwald #include <stdint.h>
410b0c01c9SMilanka Ringwald 
420b0c01c9SMilanka Ringwald #if defined __cplusplus
430b0c01c9SMilanka Ringwald extern "C" {
440b0c01c9SMilanka Ringwald #endif
450b0c01c9SMilanka Ringwald 
460b0c01c9SMilanka Ringwald #include "ble/att_db.h"
470b0c01c9SMilanka Ringwald 
480b0c01c9SMilanka Ringwald att_service_handler_t * mock_att_server_get_service(void);
490b0c01c9SMilanka Ringwald 
500b0c01c9SMilanka Ringwald uint16_t mock_att_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size);
510b0c01c9SMilanka Ringwald 
520b0c01c9SMilanka Ringwald uint16_t mock_att_service_write_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t transaction_mode, uint16_t offset, const uint8_t *buffer, uint16_t buffer_size);
530b0c01c9SMilanka Ringwald 
54*0f9df0abSMilanka Ringwald void mock_att_service_trigger_can_send_now(void);
55*0f9df0abSMilanka Ringwald 
56*0f9df0abSMilanka Ringwald void mock_deinit(void);
57*0f9df0abSMilanka Ringwald 
580b0c01c9SMilanka Ringwald #if defined __cplusplus
590b0c01c9SMilanka Ringwald }
600b0c01c9SMilanka Ringwald #endif
610b0c01c9SMilanka Ringwald 
620b0c01c9SMilanka Ringwald #endif
630b0c01c9SMilanka Ringwald 
64