xref: /btstack/src/ble/gatt-service/nordic_spp_service_server.h (revision 67b65e8f108eb716cb65c6192e677b0f719b3e70)
1ebdf3c68SMilanka Ringwald /*
2ebdf3c68SMilanka Ringwald  * Copyright (C) 2018 BlueKitchen GmbH
3ebdf3c68SMilanka Ringwald  *
4ebdf3c68SMilanka Ringwald  * Redistribution and use in source and binary forms, with or without
5ebdf3c68SMilanka Ringwald  * modification, are permitted provided that the following conditions
6ebdf3c68SMilanka Ringwald  * are met:
7ebdf3c68SMilanka Ringwald  *
8ebdf3c68SMilanka Ringwald  * 1. Redistributions of source code must retain the above copyright
9ebdf3c68SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer.
10ebdf3c68SMilanka Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11ebdf3c68SMilanka Ringwald  *    notice, this list of conditions and the following disclaimer in the
12ebdf3c68SMilanka Ringwald  *    documentation and/or other materials provided with the distribution.
13ebdf3c68SMilanka Ringwald  * 3. Neither the name of the copyright holders nor the names of
14ebdf3c68SMilanka Ringwald  *    contributors may be used to endorse or promote products derived
15ebdf3c68SMilanka Ringwald  *    from this software without specific prior written permission.
16ebdf3c68SMilanka Ringwald  * 4. Any redistribution, use, or modification is done solely for
17ebdf3c68SMilanka Ringwald  *    personal benefit and not for any commercial purpose or for
18ebdf3c68SMilanka Ringwald  *    monetary gain.
19ebdf3c68SMilanka Ringwald  *
20ebdf3c68SMilanka Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21ebdf3c68SMilanka Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22ebdf3c68SMilanka Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
232fca4dadSMilanka Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
242fca4dadSMilanka Ringwald  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25ebdf3c68SMilanka Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26ebdf3c68SMilanka Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27ebdf3c68SMilanka Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28ebdf3c68SMilanka Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29ebdf3c68SMilanka Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30ebdf3c68SMilanka Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31ebdf3c68SMilanka Ringwald  * SUCH DAMAGE.
32ebdf3c68SMilanka Ringwald  *
33ebdf3c68SMilanka Ringwald  * Please inquire about commercial licensing options at
34ebdf3c68SMilanka Ringwald  * [email protected]
35ebdf3c68SMilanka Ringwald  *
36ebdf3c68SMilanka Ringwald  */
37fe5a6c4eSMilanka Ringwald 
38fe5a6c4eSMilanka Ringwald /**
39fe5a6c4eSMilanka Ringwald  * @title Nordic SPP Service Server
40fe5a6c4eSMilanka Ringwald  *
41fe5a6c4eSMilanka Ringwald  */
42fe5a6c4eSMilanka Ringwald 
4380e33422SMatthias Ringwald #ifndef NORDIC_SPP_H
4480e33422SMatthias Ringwald #define NORDIC_SPP_H
45ebdf3c68SMilanka Ringwald 
46ebdf3c68SMilanka Ringwald #include <stdint.h>
47ebdf3c68SMilanka Ringwald #include "bluetooth.h"
48ebdf3c68SMilanka Ringwald #include "btstack_defines.h"
49ebdf3c68SMilanka Ringwald 
50ebdf3c68SMilanka Ringwald #if defined __cplusplus
51ebdf3c68SMilanka Ringwald extern "C" {
52ebdf3c68SMilanka Ringwald #endif
53ebdf3c68SMilanka Ringwald 
54ebdf3c68SMilanka Ringwald /* API_START */
55ebdf3c68SMilanka Ringwald 
56ebdf3c68SMilanka Ringwald /**
571ea30d1bSMilanka Ringwald  * @text The Nordic SPP Service is implementation of the Nordic SPP-like profile.
58ebdf3c68SMilanka Ringwald  *
59*67b65e8fSChristian Erhardt  * To use with your application, add `#import <nordic_spp_service.gatt>` to your .gatt file
60ebdf3c68SMilanka Ringwald  * and call all functions below. All strings and blobs need to stay valid after calling the functions.
61ebdf3c68SMilanka Ringwald  */
62ebdf3c68SMilanka Ringwald 
63ebdf3c68SMilanka Ringwald /**
64ebdf3c68SMilanka Ringwald  * @brief Init Nordic SPP Service Server with ATT DB
65257f2b00SMatthias Ringwald  * @param packet_handler for events and tx data from peer as RFCOMM_DATA_PACKET
66ebdf3c68SMilanka Ringwald  */
67257f2b00SMatthias Ringwald void nordic_spp_service_server_init(btstack_packet_handler_t packet_handler);
68ebdf3c68SMilanka Ringwald 
69ebdf3c68SMilanka Ringwald /**
70ebdf3c68SMilanka Ringwald  * @brief Queue send request. When called, one packet can be send via nordic_spp_service_send below
71ebdf3c68SMilanka Ringwald  * @param request
72ebdf3c68SMilanka Ringwald  * @param con_handle
73ebdf3c68SMilanka Ringwald  */
74ebdf3c68SMilanka Ringwald void nordic_spp_service_server_request_can_send_now(btstack_context_callback_registration_t * request, hci_con_handle_t con_handle);
75ebdf3c68SMilanka Ringwald 
76ebdf3c68SMilanka Ringwald /**
77ebdf3c68SMilanka Ringwald  * @brief Send data
78ebdf3c68SMilanka Ringwald  * @param con_handle
79ebdf3c68SMilanka Ringwald  * @param data
80ebdf3c68SMilanka Ringwald  * @param size
81ebdf3c68SMilanka Ringwald  */
82ebdf3c68SMilanka Ringwald int nordic_spp_service_server_send(hci_con_handle_t con_handle, const uint8_t * data, uint16_t size);
83ebdf3c68SMilanka Ringwald 
84ebdf3c68SMilanka Ringwald /* API_END */
85ebdf3c68SMilanka Ringwald 
86ebdf3c68SMilanka Ringwald #if defined __cplusplus
87ebdf3c68SMilanka Ringwald }
88ebdf3c68SMilanka Ringwald #endif
89ebdf3c68SMilanka Ringwald 
90ebdf3c68SMilanka Ringwald #endif
91ebdf3c68SMilanka Ringwald 
92