1ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/****************************************************************************** 2ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 3ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * Copyright (C) 2014 The Android Open Source Project 4ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * Copyright 2002 - 2004 Open Interface North America, Inc. All rights reserved. 5ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 6ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * Licensed under the Apache License, Version 2.0 (the "License"); 7ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * you may not use this file except in compliance with the License. 8ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * You may obtain a copy of the License at: 9ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 10ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * http://www.apache.org/licenses/LICENSE-2.0 11ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 12ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * Unless required by applicable law or agreed to in writing, software 13ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * distributed under the License is distributed on an "AS IS" BASIS, 14ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * See the License for the specific language governing permissions and 16ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * limitations under the License. 17ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 18ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta ******************************************************************************/ 19ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#ifndef _OI_BT_SPEC_H 20ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define _OI_BT_SPEC_H 21ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 22ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * @file 23ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 24ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * This file contains common definitions from the Bluetooth specification. 25ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 26ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 27ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 28ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/********************************************************************************** 29ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta $Revision: #1 $ 30ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta***********************************************************************************/ 31ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 32ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#include "oi_stddefs.h" 33ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 34ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** \addtogroup Misc Miscellaneous APIs */ 35ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/**@{*/ 36ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 37ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#ifdef __cplusplus 38ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptaextern "C" { 39ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#endif 40ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 41ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** The maximum number of active slaves in a piconet. */ 42ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_MAX_ACTIVE_SLAVES 7 43ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 44ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** the number of bytes in a Bluetooth device address (BD_ADDR) */ 45ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BD_ADDR_BYTE_SIZE 6 46ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 47ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 48ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 48-bit Bluetooth device address 49ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 50ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * Because 48-bit integers may not be supported on all platforms, the 51ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * address is defined as an array of bytes. This array is big-endian, 52ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * meaning that 53ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[0] contains bits 47-40, 54ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[1] contains bits 39-32, 55ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[2] contains bits 31-24, 56ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[3] contains bits 23-16, 57ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[4] contains bits 15-8, and 58ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[5] contains bits 7-0. 59ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 60ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef struct { 61ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_UINT8 addr[OI_BD_ADDR_BYTE_SIZE] ; /**< Bluetooth device address represented as an array of 8-bit values */ 62ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} OI_BD_ADDR ; 63ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 64ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 65ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * @name Data types for working with UUIDs 66ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * UUIDs are 16 bytes (128 bits). 67ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 68ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * To avoid having to pass around 128-bit values all the time, 32-bit and 16-bit 69ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * UUIDs are defined, along with a mapping from the shorter versions to the full 70ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * version. 71ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 72ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * @{ 73ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 74ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 75ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 76ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 16-bit representation of a 128-bit UUID 77ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 78ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef OI_UINT16 OI_UUID16; 79ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 80ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 81ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 32-bit representation of a 128-bit UUID 82ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 83ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef OI_UINT32 OI_UUID32; 84ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 85ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 86ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * number of bytes in a 128 bit UUID 87ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 88ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_UUID128_SIZE 16 89ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 90ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 91ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * number of bytes in IPv6 style addresses 92ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 93ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_IPV6ADDR_SIZE 16 94ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 95ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 96ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * type definition for a 128-bit UUID 97ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 98ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * To simplify conversion between 128-bit UUIDs and 16-bit and 32-bit UUIDs, 99ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * the most significant 32 bits are stored with the same endian-ness as is 100ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * native on the target (local) device. The remainder of the 128-bit UUID is 101ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * stored as bytes in big-endian order. 102ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 103ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef struct { 104ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_UINT32 ms32bits; /**< most significant 32 bits of 128-bit UUID */ 105ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_UINT8 base[OI_BT_UUID128_SIZE - sizeof(OI_UINT32)]; /**< remainder of 128-bit UUID, array of 8-bit values */ 106ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} OI_UUID128; 107ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 108ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** @} */ 109ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 110ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** number of bytes in a link key */ 111ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_LINK_KEY_SIZE 16 112ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 113ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 114ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * type definition for a baseband link key 115ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 116ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * Because 128-bit integers may not be supported on all platforms, we define 117ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * link keys as an array of bytes. Unlike the Bluetooth device address, 118ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * the link key is stored in little-endian order, meaning that 119ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[0] contains bits 0 - 7, 120ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[1] contains bits 8 - 15, 121ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[2] contains bits 16 - 23, 122ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[3] contains bits 24 - 31, 123ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[4] contains bits 32 - 39, 124ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[5] contains bits 40 - 47, 125ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[6] contains bits 48 - 55, 126ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[7] contains bits 56 - 63, 127ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[8] contains bits 64 - 71, 128ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[9] contains bits 72 - 79, 129ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[10] contains bits 80 - 87, 130ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[11] contains bits 88 - 95, 131ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[12] contains bits 96 - 103, 132ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[13] contains bits 104- 111, 133ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[14] contains bits 112- 119, and 134ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * - array[15] contains bits 120- 127. 135ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 136ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef struct { 137ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_UINT8 key[OI_BT_LINK_KEY_SIZE] ; /**< link key represented as an array of 8-bit values */ 138ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} OI_LINK_KEY ; 139ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 140ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 141ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** Out-of-band data size - C and R values are 16-bytes each */ 142ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_OOB_NUM_BYTES 16 143ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 144ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef struct { 145ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_UINT8 value[OI_BT_OOB_NUM_BYTES] ; /**< same struct used for C and R values */ 146ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} OI_OOB_DATA ; 147ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 148ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 149ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 150ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * link key types 151ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 152ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef enum { 153ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_COMBO = 0, /**< combination key */ 154ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_LOCAL_UNIT = 1, /**< local unit key */ 155ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_REMOTE_UNIT = 2, /**< remote unit key */ 156ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_DEBUG_COMBO = 3, /**< debug combination key */ 157ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_UNAUTHENTICATED = 4, /**< Unauthenticated */ 158ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_AUTHENTICATED = 5, /**< Authenticated */ 159ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_LINK_KEY_TYPE_CHANGED_COMBO = 6 /**< Changed */ 160ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 161ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} OI_BT_LINK_KEY_TYPE ; 162ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 163ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 164ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** amount of space allocated for a PIN (personal indentification number) in bytes */ 165ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_PIN_CODE_SIZE 16 166ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 167ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** data type for a PIN (PINs are treated as strings, so endianness does not apply.) */ 168ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef struct { 169ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta OI_UINT8 pin[OI_BT_PIN_CODE_SIZE] ; /**< PIN represented as an array of 8-bit values */ 170ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} OI_PIN_CODE ; 171ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 172ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** maximum number of SCO connections per device, which is 3 as of version 2.0+EDR 173ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta of the Bluetooth specification (see sec 4.3 of vol 2 part B) */ 174ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_MAX_SCO_CONNECTIONS 3 175ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 176ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** data type for clock offset */ 177ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef OI_UINT16 OI_BT_CLOCK_OFFSET ; 178ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 179ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** data type for a LM handle */ 180ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef OI_UINT16 OI_HCI_LM_HANDLE; 181ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 182ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** opaque data type for a SCO or ACL connection handle */ 183ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef struct _OI_HCI_CONNECTION *OI_HCI_CONNECTION_HANDLE; 184ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 185ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** data type for HCI Error Code, as defined in oi_hcispec.h */ 186ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef OI_UINT8 OI_HCI_ERROR_CODE ; 187ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 188ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** 189ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * The Bluetooth device type is indicated by a 24-bit bitfield, represented as a 190ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * 32-bit number in the stack. The bit layout and values for device class are specified 191ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * in the file oi_bt_assigned_nos.h and in the Bluetooth "Assigned Numbers" specification 192ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta * at http://www.bluetooth.org/assigned-numbers/. 193ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta */ 194ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Guptatypedef OI_UINT32 OI_BT_DEVICE_CLASS ; 195ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 196ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_DEV_CLASS_FORMAT_MASK 0x000003 /**< Bits 0-1 contain format type. */ 197ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_DEV_CLASS_MINOR_DEVICE_MASK 0x0000FC /**< Bits 2-7 contain minor device class value. */ 198ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_DEV_CLASS_MAJOR_DEVICE_MASK 0x001F00 /**< Bits 8-12 contain major device class value. */ 199ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_DEV_CLASS_MAJOR_SERVICE_MASK 0xFFE000 /**< Bits 13-23 contain major service class value. */ 200ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 201ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** There is currently only one device class format defined, type 00. */ 202ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_DEV_CLASS_FORMAT_TYPE 00 203ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 204ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** Bit 13 in device class indicates limited discoverability mode (GAP v2.0+EDR, section 4.1.2.2) */ 205ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_DEV_CLASS_LIMITED_DISCO_BIT BIT13 206ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 207ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** macro to test validity of the Device Class Format */ 208ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_VALID_DEVICE_CLASS_FORMAT(class) (OI_BT_DEV_CLASS_FORMAT_TYPE == ((class) & OI_BT_DEV_CLASS_FORMAT_MASK)) 209ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 210ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** the time between baseband clock ticks, currently 625 microseconds (one slot) */ 211ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_TICK 625 212ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** some macros to convert to/from baseband clock ticks - use no floating point! */ 213ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_SECONDS_TO_BT_TICKS(secs) ((secs)*1600) 214ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_TICKS_TO_SECONDS(ticks) ((ticks)/1600) 215ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_MSECS_TO_BT_TICKS(msecs) (((msecs)*8)/5) 216ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_BT_TICKS_TO_MSECS(ticks) (((ticks)*5)/8) 217ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 218ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/** EIR byte order */ 219ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#define OI_EIR_BYTE_ORDER OI_LITTLE_ENDIAN_BYTE_ORDER 220ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 221ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 222ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#ifdef __cplusplus 223ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta} 224ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#endif 225ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 226ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/**@}*/ 227ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta 228ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta/*****************************************************************************/ 229ce24765fe7620c34e8d88ed4f826c8a6917582b2Hemant Gupta#endif /* _OI_BT_SPEC_H */ 230