xref: /btstack/src/classic/hid_device.h (revision 8eb8d46326a076a39756a0743157c8a065b9a912)
1d40c9ac6SMatthias Ringwald /*
2d40c9ac6SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
3d40c9ac6SMatthias Ringwald  *
4d40c9ac6SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5d40c9ac6SMatthias Ringwald  * modification, are permitted provided that the following conditions
6d40c9ac6SMatthias Ringwald  * are met:
7d40c9ac6SMatthias Ringwald  *
8d40c9ac6SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9d40c9ac6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10d40c9ac6SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11d40c9ac6SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12d40c9ac6SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13d40c9ac6SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14d40c9ac6SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15d40c9ac6SMatthias Ringwald  *    from this software without specific prior written permission.
16d40c9ac6SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17d40c9ac6SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18d40c9ac6SMatthias Ringwald  *    monetary gain.
19d40c9ac6SMatthias Ringwald  *
20d40c9ac6SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21d40c9ac6SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22d40c9ac6SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23d40c9ac6SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24d40c9ac6SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25d40c9ac6SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26d40c9ac6SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27d40c9ac6SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28d40c9ac6SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29d40c9ac6SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30d40c9ac6SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31d40c9ac6SMatthias Ringwald  * SUCH DAMAGE.
32d40c9ac6SMatthias Ringwald  *
33d40c9ac6SMatthias Ringwald  * Please inquire about commercial licensing options at
34d40c9ac6SMatthias Ringwald  * [email protected]
35d40c9ac6SMatthias Ringwald  *
36d40c9ac6SMatthias Ringwald  */
37d40c9ac6SMatthias Ringwald 
38d40c9ac6SMatthias Ringwald #include <stdint.h>
39*8eb8d463SMatthias Ringwald #include "btstack_defines.h"
40d40c9ac6SMatthias Ringwald /**
41d40c9ac6SMatthias Ringwald  * @brief Create HID Device SDP service record.
42d40c9ac6SMatthias Ringwald  * @param service Empty buffer in which a new service record will be stored.
43d40c9ac6SMatthias Ringwald  * @param have_remote_audio_control
44d40c9ac6SMatthias Ringwald  * @param service
45d40c9ac6SMatthias Ringwald  * @param service_record_handle
46d40c9ac6SMatthias Ringwald  * @param hid_device_subclass
47d40c9ac6SMatthias Ringwald  * @param hid_country_code
48d40c9ac6SMatthias Ringwald  * @param hid_virtual_cable
49d40c9ac6SMatthias Ringwald  * @param hid_reconnect_initiate
50d40c9ac6SMatthias Ringwald  * @param hid_boot_device
51d40c9ac6SMatthias Ringwald  * @param hid_descriptor
52d40c9ac6SMatthias Ringwald  * @param hid_descriptor_size size of hid_descriptor
53d40c9ac6SMatthias Ringwald  * @param device_name
54d40c9ac6SMatthias Ringwald  */
55d40c9ac6SMatthias Ringwald void hid_create_sdp_record(
56d40c9ac6SMatthias Ringwald     uint8_t *       service,
57d40c9ac6SMatthias Ringwald     uint32_t        service_record_handle,
58d40c9ac6SMatthias Ringwald     uint16_t        hid_device_subclass,
59d40c9ac6SMatthias Ringwald     uint8_t         hid_country_code,
60d40c9ac6SMatthias Ringwald     uint8_t         hid_virtual_cable,
61d40c9ac6SMatthias Ringwald     uint8_t         hid_reconnect_initiate,
62d40c9ac6SMatthias Ringwald     uint8_t         hid_boot_device,
63d40c9ac6SMatthias Ringwald     const uint8_t * hid_descriptor,
64d40c9ac6SMatthias Ringwald     uint16_t 		hid_descriptor_size,
65d40c9ac6SMatthias Ringwald     const char *    device_name);
66d40c9ac6SMatthias Ringwald 
67*8eb8d463SMatthias Ringwald /**
68*8eb8d463SMatthias Ringwald  * @brief Set up HID Device
69*8eb8d463SMatthias Ringwald  */
70*8eb8d463SMatthias Ringwald void hid_device_init(void);
71*8eb8d463SMatthias Ringwald 
72*8eb8d463SMatthias Ringwald /**
73*8eb8d463SMatthias Ringwald  * @brief Register callback for the HID Device client.
74*8eb8d463SMatthias Ringwald  * @param callback
75*8eb8d463SMatthias Ringwald  */
76*8eb8d463SMatthias Ringwald void hid_device_register_packet_handler(btstack_packet_handler_t callback);
77*8eb8d463SMatthias Ringwald 
78*8eb8d463SMatthias Ringwald /**
79*8eb8d463SMatthias Ringwald  * @brief Request can send now event to send HID Report
80*8eb8d463SMatthias Ringwald  * Generates an HID_SUBEVENT_CAN_SEND_NOW subevent
81*8eb8d463SMatthias Ringwald  * @param hid_cid
82*8eb8d463SMatthias Ringwald  */
83*8eb8d463SMatthias Ringwald void hid_device_request_can_send_now_event(uint16_t hid_cid);
84*8eb8d463SMatthias Ringwald 
85*8eb8d463SMatthias Ringwald /**
86*8eb8d463SMatthias Ringwald  * @brief Send HID messageon interrupt channel
87*8eb8d463SMatthias Ringwald  * @param hid_cid
88*8eb8d463SMatthias Ringwald  */
89*8eb8d463SMatthias Ringwald void hid_device_send_interrupt_message(uint16_t hid_cid, const uint8_t * message, uint16_t message_len);
90*8eb8d463SMatthias Ringwald 
91*8eb8d463SMatthias Ringwald /**
92*8eb8d463SMatthias Ringwald  * @brief Send HID messageon control channel
93*8eb8d463SMatthias Ringwald  * @param hid_cid
94*8eb8d463SMatthias Ringwald  */
95*8eb8d463SMatthias Ringwald void hid_device_send_contro_message(uint16_t hid_cid, const uint8_t * message, uint16_t message_len);
96*8eb8d463SMatthias Ringwald 
97*8eb8d463SMatthias Ringwald 
98