add bondable flag to hci and provide gap_set_bondable_mode

This commit is contained in:
matthias.ringwald@gmail.com 2014-01-16 10:58:52 +00:00
parent cfe3d8e0db
commit 458bf4e848
4 changed files with 65 additions and 2 deletions

View File

@ -8,5 +8,5 @@ CHARACTERISTIC, GATT_SERVICE_CHANGED, READ,
PRIMARY_SERVICE, FFF0
CHARACTERISTIC, FFF1, READ | WRITE | DYNAMIC | AUTHORIZATION_REQUIRED | ENCRYPTION_KEY_SIZE_7 | AUTHENTICATION_REQUIRED,
CHARACTERISTIC, FFF2, READ | WRITE | DYNAMIC,
CHARACTERISTIC, FFF3, READ | NOTIFY | INDICATE | CLIENT_CONFIGURATION,
CHARACTERISTIC, FFF3, READ | INDICATE | CLIENT_CONFIGURATION,
CHARACTERISTIC, 00001234-0000-1000-8000-00805F9B34FB, READ | WRITE | DYNAMIC,

52
src/gap.h Normal file
View File

@ -0,0 +1,52 @@
/*
* Copyright (C) 2011-2012 BlueKitchen GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* 4. Any redistribution, use, or modification is done solely for
* personal benefit and not for any commercial purpose or for
* monetary gain.
*
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Please inquire about commercial licensing options at contact@bluekitchen-gmbh.com
*
*/
#pragma once
#if defined __cplusplus
extern "C" {
#endif
/**
* @bbrief enable/disable bonding. default is enabled
* @praram enabled
*/
void gap_set_bondable_mode(int enabled);
#if defined __cplusplus
}
#endif

View File

@ -825,7 +825,8 @@ void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, r
hci_stack.connections = NULL;
hci_stack.discoverable = 0;
hci_stack.connectable = 0;
hci_stack.bondable = 1;
// no pending cmds
hci_stack.decline_reason = 0;
hci_stack.new_scan_enable_value = 0xff;
@ -1642,3 +1643,12 @@ void hci_emit_discoverable_enabled(uint8_t enabled){
hci_dump_packet( HCI_EVENT_PACKET, 0, event, sizeof(event));
hci_stack.packet_handler(HCI_EVENT_PACKET, event, sizeof(event));
}
// GAP API
/**
* @bbrief enable/disable bonding. default is enabled
* @praram enabled
*/
void gap_set_bondable_mode(int enabled);{
hci_stack.bondable = enable ? 1 : 0;
}

View File

@ -321,6 +321,7 @@ typedef struct {
uint8_t discoverable;
uint8_t connectable;
uint8_t bondable;
/* buffer for scan enable cmd - 0xff no change */
uint8_t new_scan_enable_value;