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 38*fe9125ceSMilanka Ringwald #ifndef hid_device_h 39*fe9125ceSMilanka Ringwald #define hid_device_h 40*fe9125ceSMilanka Ringwald 41d40c9ac6SMatthias Ringwald #include <stdint.h> 428eb8d463SMatthias Ringwald #include "btstack_defines.h" 4357c643eeSMatthias Ringwald #include "bluetooth.h" 4457c643eeSMatthias Ringwald 45*fe9125ceSMilanka Ringwald #if defined __cplusplus 46*fe9125ceSMilanka Ringwald extern "C" { 47*fe9125ceSMilanka Ringwald #endif 48*fe9125ceSMilanka Ringwald 49d40c9ac6SMatthias Ringwald /** 50d40c9ac6SMatthias Ringwald * @brief Create HID Device SDP service record. 51d40c9ac6SMatthias Ringwald * @param service Empty buffer in which a new service record will be stored. 52d40c9ac6SMatthias Ringwald * @param have_remote_audio_control 53d40c9ac6SMatthias Ringwald * @param service 54d40c9ac6SMatthias Ringwald * @param service_record_handle 55d40c9ac6SMatthias Ringwald * @param hid_device_subclass 56d40c9ac6SMatthias Ringwald * @param hid_country_code 57d40c9ac6SMatthias Ringwald * @param hid_virtual_cable 58d40c9ac6SMatthias Ringwald * @param hid_reconnect_initiate 59d40c9ac6SMatthias Ringwald * @param hid_boot_device 60d40c9ac6SMatthias Ringwald * @param hid_descriptor 61d40c9ac6SMatthias Ringwald * @param hid_descriptor_size size of hid_descriptor 62d40c9ac6SMatthias Ringwald * @param device_name 63d40c9ac6SMatthias Ringwald */ 64d40c9ac6SMatthias Ringwald void hid_create_sdp_record( 65d40c9ac6SMatthias Ringwald uint8_t * service, 66d40c9ac6SMatthias Ringwald uint32_t service_record_handle, 67d40c9ac6SMatthias Ringwald uint16_t hid_device_subclass, 68d40c9ac6SMatthias Ringwald uint8_t hid_country_code, 69d40c9ac6SMatthias Ringwald uint8_t hid_virtual_cable, 70d40c9ac6SMatthias Ringwald uint8_t hid_reconnect_initiate, 71d40c9ac6SMatthias Ringwald uint8_t hid_boot_device, 72d40c9ac6SMatthias Ringwald const uint8_t * hid_descriptor, 73d40c9ac6SMatthias Ringwald uint16_t hid_descriptor_size, 74d40c9ac6SMatthias Ringwald const char * device_name); 75d40c9ac6SMatthias Ringwald 76*fe9125ceSMilanka Ringwald /* API_START */ 77*fe9125ceSMilanka Ringwald 788eb8d463SMatthias Ringwald /** 798eb8d463SMatthias Ringwald * @brief Set up HID Device 808eb8d463SMatthias Ringwald */ 818eb8d463SMatthias Ringwald void hid_device_init(void); 828eb8d463SMatthias Ringwald 838eb8d463SMatthias Ringwald /** 848eb8d463SMatthias Ringwald * @brief Register callback for the HID Device client. 858eb8d463SMatthias Ringwald * @param callback 868eb8d463SMatthias Ringwald */ 878eb8d463SMatthias Ringwald void hid_device_register_packet_handler(btstack_packet_handler_t callback); 888eb8d463SMatthias Ringwald 8957c643eeSMatthias Ringwald 9057c643eeSMatthias Ringwald /* 9157c643eeSMatthias Ringwald * @brief Create HID connection to HID Host 9257c643eeSMatthias Ringwald * @param addr 9357c643eeSMatthias Ringwald * @param hid_cid to use for other commands 9457c643eeSMatthias Ringwald * @result status 9557c643eeSMatthias Ringwald */ 9657c643eeSMatthias Ringwald uint8_t hid_device_connect(bd_addr_t addr, uint16_t * hid_cid); 9757c643eeSMatthias Ringwald 988eb8d463SMatthias Ringwald /** 998eb8d463SMatthias Ringwald * @brief Request can send now event to send HID Report 1008eb8d463SMatthias Ringwald * Generates an HID_SUBEVENT_CAN_SEND_NOW subevent 1018eb8d463SMatthias Ringwald * @param hid_cid 1028eb8d463SMatthias Ringwald */ 1038eb8d463SMatthias Ringwald void hid_device_request_can_send_now_event(uint16_t hid_cid); 1048eb8d463SMatthias Ringwald 1058eb8d463SMatthias Ringwald /** 1068eb8d463SMatthias Ringwald * @brief Send HID messageon interrupt channel 1078eb8d463SMatthias Ringwald * @param hid_cid 1088eb8d463SMatthias Ringwald */ 1098eb8d463SMatthias Ringwald void hid_device_send_interrupt_message(uint16_t hid_cid, const uint8_t * message, uint16_t message_len); 1108eb8d463SMatthias Ringwald 1118eb8d463SMatthias Ringwald /** 1128eb8d463SMatthias Ringwald * @brief Send HID messageon control channel 1138eb8d463SMatthias Ringwald * @param hid_cid 1148eb8d463SMatthias Ringwald */ 1158eb8d463SMatthias Ringwald void hid_device_send_contro_message(uint16_t hid_cid, const uint8_t * message, uint16_t message_len); 1168eb8d463SMatthias Ringwald 117*fe9125ceSMilanka Ringwald /* API_END */ 1188eb8d463SMatthias Ringwald 119*fe9125ceSMilanka Ringwald #if defined __cplusplus 120*fe9125ceSMilanka Ringwald } 121*fe9125ceSMilanka Ringwald #endif 122*fe9125ceSMilanka Ringwald 123*fe9125ceSMilanka Ringwald #endif 124