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> 398eb8d463SMatthias Ringwald #include "btstack_defines.h" 40*57c643eeSMatthias Ringwald #include "bluetooth.h" 41*57c643eeSMatthias Ringwald 42d40c9ac6SMatthias Ringwald /** 43d40c9ac6SMatthias Ringwald * @brief Create HID Device SDP service record. 44d40c9ac6SMatthias Ringwald * @param service Empty buffer in which a new service record will be stored. 45d40c9ac6SMatthias Ringwald * @param have_remote_audio_control 46d40c9ac6SMatthias Ringwald * @param service 47d40c9ac6SMatthias Ringwald * @param service_record_handle 48d40c9ac6SMatthias Ringwald * @param hid_device_subclass 49d40c9ac6SMatthias Ringwald * @param hid_country_code 50d40c9ac6SMatthias Ringwald * @param hid_virtual_cable 51d40c9ac6SMatthias Ringwald * @param hid_reconnect_initiate 52d40c9ac6SMatthias Ringwald * @param hid_boot_device 53d40c9ac6SMatthias Ringwald * @param hid_descriptor 54d40c9ac6SMatthias Ringwald * @param hid_descriptor_size size of hid_descriptor 55d40c9ac6SMatthias Ringwald * @param device_name 56d40c9ac6SMatthias Ringwald */ 57d40c9ac6SMatthias Ringwald void hid_create_sdp_record( 58d40c9ac6SMatthias Ringwald uint8_t * service, 59d40c9ac6SMatthias Ringwald uint32_t service_record_handle, 60d40c9ac6SMatthias Ringwald uint16_t hid_device_subclass, 61d40c9ac6SMatthias Ringwald uint8_t hid_country_code, 62d40c9ac6SMatthias Ringwald uint8_t hid_virtual_cable, 63d40c9ac6SMatthias Ringwald uint8_t hid_reconnect_initiate, 64d40c9ac6SMatthias Ringwald uint8_t hid_boot_device, 65d40c9ac6SMatthias Ringwald const uint8_t * hid_descriptor, 66d40c9ac6SMatthias Ringwald uint16_t hid_descriptor_size, 67d40c9ac6SMatthias Ringwald const char * device_name); 68d40c9ac6SMatthias Ringwald 698eb8d463SMatthias Ringwald /** 708eb8d463SMatthias Ringwald * @brief Set up HID Device 718eb8d463SMatthias Ringwald */ 728eb8d463SMatthias Ringwald void hid_device_init(void); 738eb8d463SMatthias Ringwald 748eb8d463SMatthias Ringwald /** 758eb8d463SMatthias Ringwald * @brief Register callback for the HID Device client. 768eb8d463SMatthias Ringwald * @param callback 778eb8d463SMatthias Ringwald */ 788eb8d463SMatthias Ringwald void hid_device_register_packet_handler(btstack_packet_handler_t callback); 798eb8d463SMatthias Ringwald 80*57c643eeSMatthias Ringwald 81*57c643eeSMatthias Ringwald /* 82*57c643eeSMatthias Ringwald * @brief Create HID connection to HID Host 83*57c643eeSMatthias Ringwald * @param addr 84*57c643eeSMatthias Ringwald * @param hid_cid to use for other commands 85*57c643eeSMatthias Ringwald * @result status 86*57c643eeSMatthias Ringwald */ 87*57c643eeSMatthias Ringwald uint8_t hid_device_connect(bd_addr_t addr, uint16_t * hid_cid); 88*57c643eeSMatthias Ringwald 898eb8d463SMatthias Ringwald /** 908eb8d463SMatthias Ringwald * @brief Request can send now event to send HID Report 918eb8d463SMatthias Ringwald * Generates an HID_SUBEVENT_CAN_SEND_NOW subevent 928eb8d463SMatthias Ringwald * @param hid_cid 938eb8d463SMatthias Ringwald */ 948eb8d463SMatthias Ringwald void hid_device_request_can_send_now_event(uint16_t hid_cid); 958eb8d463SMatthias Ringwald 968eb8d463SMatthias Ringwald /** 978eb8d463SMatthias Ringwald * @brief Send HID messageon interrupt channel 988eb8d463SMatthias Ringwald * @param hid_cid 998eb8d463SMatthias Ringwald */ 1008eb8d463SMatthias Ringwald void hid_device_send_interrupt_message(uint16_t hid_cid, const uint8_t * message, uint16_t message_len); 1018eb8d463SMatthias Ringwald 1028eb8d463SMatthias Ringwald /** 1038eb8d463SMatthias Ringwald * @brief Send HID messageon control channel 1048eb8d463SMatthias Ringwald * @param hid_cid 1058eb8d463SMatthias Ringwald */ 1068eb8d463SMatthias Ringwald void hid_device_send_contro_message(uint16_t hid_cid, const uint8_t * message, uint16_t message_len); 1078eb8d463SMatthias Ringwald 1088eb8d463SMatthias Ringwald 109