updated example name”

This commit is contained in:
2017-06-10 17:57:47 +08:00
parent 5de4ac202c
commit c5327f8717
827 changed files with 1 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,254 @@
/**
@headerfile: bcomdef.h
<!--
Revised: $Date: 2012-11-27 14:14:39 -0800 (Tue, 27 Nov 2012) $
Revision: $Revision: 32324 $
Description: Type definitions and macros for BLE stack.
Copyright 2009 - 2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
-->
**************************************************************************************************/
#ifndef BCOMDEF_H
#define BCOMDEF_H
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* INCLUDES
*/
#include "comdef.h"
/*********************************************************************
* CONSTANTS
*/
#if defined ( HOST_CONFIG )
// Set the Controller Configuration
#if ( HOST_CONFIG == ( CENTRAL_CFG | PERIPHERAL_CFG ) )
#define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG | INIT_CFG )
#elif ( HOST_CONFIG == ( CENTRAL_CFG | BROADCASTER_CFG ) )
#define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG | INIT_CFG )
#elif ( HOST_CONFIG == ( PERIPHERAL_CFG | OBSERVER_CFG ) )
#define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG )
#elif ( HOST_CONFIG == ( BROADCASTER_CFG | OBSERVER_CFG ) )
#define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG )
#elif ( HOST_CONFIG == CENTRAL_CFG )
#define CTRL_CONFIG ( SCAN_CFG | INIT_CFG )
#elif ( HOST_CONFIG == PERIPHERAL_CFG )
#define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG )
#elif ( HOST_CONFIG == OBSERVER_CFG )
#define CTRL_CONFIG SCAN_CFG
#elif ( HOST_CONFIG == BROADCASTER_CFG )
#define CTRL_CONFIG ADV_NCONN_CFG
#else
#error "Build Configuration Error: Invalid Host Role!"
#endif
#else
// Controller Sanity Check: Stop build when no configuration is defined.
#if !defined( CTRL_CONFIG ) || !( CTRL_CONFIG & ( ADV_NCONN_CFG | \
ADV_CONN_CFG | \
SCAN_CFG | \
INIT_CFG ) )
#error "Build Configuration Error: At least one Controller build component required!"
#endif // no Controller build components defined
#endif
#if !defined ( MAX_NUM_LL_CONN )
#if ( CTRL_CONFIG & INIT_CFG )
#define MAX_NUM_LL_CONN 3
#elif ( !( CTRL_CONFIG & INIT_CFG ) && ( CTRL_CONFIG & ADV_CONN_CFG ) )
#define MAX_NUM_LL_CONN 1
#else // no connection needed
#define MAX_NUM_LL_CONN 0
#endif // CTRL_CONFIG=INIT_CFG
#endif // !MAX_NUM_LL_CONN
/** @defgroup BLE_COMMON_DEFINES BLE Common Defines
* @{
*/
//! Default Public and Random Address Length
#define B_ADDR_LEN 6
//! Default key length
#define KEYLEN 16
//! BLE Channel Map length
#define B_CHANNEL_MAP_LEN 5
//! BLE Event mask length
#define B_EVENT_MASK_LEN 8
//! BLE Local Name length
#define B_LOCAL_NAME_LEN 248
//! BLE Maximum Advertising Packet Length
#define B_MAX_ADV_LEN 31
//! BLE Random Number Size
#define B_RANDOM_NUM_SIZE 8
//! BLE Feature Supported length
#define B_FEATURE_SUPPORT_LENGTH 8
/** @defgroup BLE_STATUS_VALUES BLE Default BLE Status Values
* returned as bStatus_t
* @{
*/
#define bleInvalidTaskID INVALID_TASK //!< Task ID isn't setup properly
#define bleNotReady 0x10 //!< Not ready to perform task
#define bleAlreadyInRequestedMode 0x11 //!< Already performing that task
#define bleIncorrectMode 0x12 //!< Not setup properly to perform that task
#define bleMemAllocError 0x13 //!< Memory allocation error occurred
#define bleNotConnected 0x14 //!< Can't perform function when not in a connection
#define bleNoResources 0x15 //!< There are no resource available
#define blePending 0x16 //!< Waiting
#define bleTimeout 0x17 //!< Timed out performing function
#define bleInvalidRange 0x18 //!< A parameter is out of range
#define bleLinkEncrypted 0x19 //!< The link is already encrypted
#define bleProcedureComplete 0x1A //!< The Procedure is completed
// GAP Status Return Values - returned as bStatus_t
#define bleGAPUserCanceled 0x30 //!< The user canceled the task
#define bleGAPConnNotAcceptable 0x31 //!< The connection was not accepted
#define bleGAPBondRejected 0x32 //!< The bound information was rejected.
// ATT Status Return Values - returned as bStatus_t
#define bleInvalidPDU 0x40 //!< The attribute PDU is invalid
#define bleInsufficientAuthen 0x41 //!< The attribute has insufficient authentication
#define bleInsufficientEncrypt 0x42 //!< The attribute has insufficient encryption
#define bleInsufficientKeySize 0x43 //!< The attribute has insufficient encryption key size
// L2CAP Status Return Values - returned as bStatus_t
#define INVALID_TASK_ID 0xFF //!< Task ID isn't setup properly
/** @} End BLE_STATUS_VALUES */
/** @defgroup BLE_NV_IDS BLE Non-volatile IDs
* @{
*/
// Device NV Items - Range 0 - 0x1F
#define BLE_NVID_IRK 0x02 //!< The Device's IRK
#define BLE_NVID_CSRK 0x03 //!< The Device's CSRK
#define BLE_NVID_SIGNCOUNTER 0x04 //!< The Device's Sign Counter
// Bonding NV Items - Range 0x20 - 0x5F - This allows for 10 bondings
#define BLE_NVID_GAP_BOND_START 0x20 //!< Start of the GAP Bond Manager's NV IDs
#define BLE_NVID_GAP_BOND_END 0x5f //!< End of the GAP Bond Manager's NV IDs Range
// GATT Configuration NV Items - Range 0x70 - 0x79 - This must match the number of Bonding entries
#define BLE_NVID_GATT_CFG_START 0x70 //!< Start of the GATT Configuration NV IDs
#define BLE_NVID_GATT_CFG_END 0x79 //!< End of the GATT Configuration NV IDs
/** @} End BLE_NV_IDS */
/*********************************************************************
* BLE OSAL GAP GLOBAL Events
*/
#define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000 //!< The device level sign counter changed
/** @defgroup BLE_MSG_IDS BLE OSAL Message ID Events
* Reserved Message ID Event Values:<BR>
* 0xC0 - Key Presses<BR>
* 0xE0 to 0xFC - App<BR>
* @{
*/
// GAP - Messages IDs (0xD0 - 0xDF)
#define GAP_MSG_EVENT 0xD0 //!< Incoming GAP message
// SM - Messages IDs (0xC1 - 0xCF)
#define SM_NEW_RAND_KEY_EVENT 0xC1 //!< New Rand Key Event message
// GATT - Messages IDs (0xB0 - 0xBF)
#define GATT_MSG_EVENT 0xB0 //!< Incoming GATT message
#define GATT_SERV_MSG_EVENT 0xB1 //!< Incoming GATT Serv App message
// L2CAP - Messages IDs (0xA0 - 0xAF)
#define L2CAP_DATA_EVENT 0xA0 //!< Incoming data on a channel
#define L2CAP_SIGNAL_EVENT 0xA2 //!< Incoming Signaling message
// HCI - Messages IDs (0x90 - 0x9F)
#define HCI_DATA_EVENT 0x90 //!< HCI Data Event message
#define HCI_GAP_EVENT_EVENT 0x91 //!< GAP Event message
#define HCI_SMP_EVENT_EVENT 0x92 //!< SMP Event message
#define HCI_EXT_CMD_EVENT 0x93 //!< HCI Extended Command Event message
/** @} End BLE_MSG_IDS */
/*********************************************************************
* TYPEDEFS
*/
//! BLE Generic Status return: @ref BLE_STATUS_VALUES
typedef Status_t bStatus_t;
/** @} End GAP_MSG_EVENT_DEFINES */
/*********************************************************************
* System Events
*/
/*********************************************************************
* Global System Messages
*/
/*********************************************************************
* MACROS
*/
// TI Base 128-bit UUID: F000XXXX-0451-4000-B000-000000000000
#define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
/*********************************************************************
* GLOBAL VARIABLES
*/
/*********************************************************************
* FUNCTIONS
*/
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* BCOMDEF_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,235 @@
/**************************************************************************************************
Filename: gatt_uuid.h
Revised: $Date: 2009-06-29 16:20:52 -0700 (Mon, 29 Jun 2009) $
Revision: $Revision: 20240 $
Description: This file contains Generic Attribute Profile (GATT)
UUID types.
Copyright 2010-2013 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef GATT_UUID_H
#define GATT_UUID_H
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* INCLUDES
*/
/*********************************************************************
* CONSTANTS
*/
/*
* WARNING: The 16-bit UUIDs are assigned by the Bluetooth SIG and published
* in the Bluetooth Assigned Numbers page. Do not change these values.
* Changing them will cause Bluetooth interoperability issues.
*/
/**
* GATT Services
*/
#define GAP_SERVICE_UUID 0x1800 // Generic Access Profile
#define GATT_SERVICE_UUID 0x1801 // Generic Attribute Profile
/**
* GATT Declarations
*/
#define GATT_PRIMARY_SERVICE_UUID 0x2800 // Primary Service
#define GATT_SECONDARY_SERVICE_UUID 0x2801 // Secondary Service
#define GATT_INCLUDE_UUID 0x2802 // Include
#define GATT_CHARACTER_UUID 0x2803 // Characteristic
/**
* GATT Descriptors
*/
#define GATT_CHAR_EXT_PROPS_UUID 0x2900 // Characteristic Extended Properties
#define GATT_CHAR_USER_DESC_UUID 0x2901 // Characteristic User Description
#define GATT_CLIENT_CHAR_CFG_UUID 0x2902 // Client Characteristic Configuration
#define GATT_SERV_CHAR_CFG_UUID 0x2903 // Server Characteristic Configuration
#define GATT_CHAR_FORMAT_UUID 0x2904 // Characteristic Format
#define GATT_CHAR_AGG_FORMAT_UUID 0x2905 // Characteristic Aggregate Format
#define GATT_VALID_RANGE_UUID 0x2906 // Valid Range
#define GATT_EXT_REPORT_REF_UUID 0x2907 // External Report Reference Descriptor
#define GATT_REPORT_REF_UUID 0x2908 // Report Reference Descriptor
/**
* GATT Characteristics
*/
#define DEVICE_NAME_UUID 0x2A00 // Device Name
#define APPEARANCE_UUID 0x2A01 // Appearance
#define PERI_PRIVACY_FLAG_UUID 0x2A02 // Peripheral Privacy Flag
#define RECONNECT_ADDR_UUID 0x2A03 // Reconnection Address
#define PERI_CONN_PARAM_UUID 0x2A04 // Peripheral Preferred Connection Parameters
#define SERVICE_CHANGED_UUID 0x2A05 // Service Changed
/**
* GATT Units
*/
#define GATT_UNITLESS_UUID 0x2700 // <Symbol>, <Expressed in terms of SI base units>
#define GATT_UNIT_LENGTH_METER_UUID 0x2701 // m, m
#define GATT_UNIT_MASS_KGRAM_UUID 0x2702 // kg, kg
#define GATT_UNIT_TIME_SECOND_UUID 0x2703 // s, s
#define GATT_UNIT_ELECTRIC_CURRENT_A_UUID 0x2704 // A, A
#define GATT_UNIT_THERMODYNAMIC_TEMP_K_UUID 0x2705 // K, K
#define GATT_UNIT_AMOUNT_SUBSTANCE_M_UUID 0x2706 // mol, mol
#define GATT_UNIT_LUMINOUS_INTENSITY_C_UUID 0x2707 // cd, cd
#define GATT_UNIT_AREA_SQ_MTR_UUID 0x2710 // m^2, m^2
#define GATT_UNIT_VOLUME_CUBIC_MTR_UUID 0x2711 // m^3, m^3
#define GATT_UNIT_VELOCITY_MPS_UUID 0x2712 // m/s, m s^-1
#define GATT_UNIT_ACCELERATION_MPS_SQ_UUID 0x2713 // m/s^2, m s^-2
#define GATT_UNIT_WAVENUMBER_RM_UUID 0x2714 // ó, m^-1
#define GATT_UNIT_DENSITY_KGPCM_UUID 0x2715 // p, kg m^-3
#define GATT_UNIT_SURFACE_DENSITY_KGPSM_UUID 0x2716 // pA, kg m^-2
#define GATT_UNIT_SPECIFIC_VOLUME_CMPKG_UUID 0x2717 // v, m^3 kg^-1
#define GATT_UNIT_CURRENT_DENSITY_APSM_UUID 0x2718 // j, A m^-2
#define GATT_UNIT_MAGNETIC_FIELD_STRENGTH_UUID 0x2719 // H, A m
#define GATT_UNIT_AMOUNT_CONCENTRATE_MPCM_UUID 0x271A // c, mol m^-3
#define GATT_UNIT_MASS_CONCENTRATE_KGPCM_UUID 0x271B // c, kg m^-3
#define GATT_UNIT_LUMINANCE_CPSM_UUID 0x271C // Lv, cd m^-2
#define GATT_UNIT_REFRACTIVE_INDEX_UUID 0x271D // n, 1
#define GATT_UNIT_RELATIVE_PERMEABLILTY_UUID 0x271E // u, 1
#define GATT_UNIT_PLANE_ANGLE_RAD_UUID 0x2720 // rad, m m-1
#define GATT_UNIT_SOLID_ANGLE_STERAD_UUID 0x2721 // sr, m2 m-2
#define GATT_UNIT_FREQUENCY_HTZ_UUID 0x2722 // Hz, s-1
#define GATT_UNIT_FORCE_NEWTON_UUID 0x2723 // N, m kg s-2
#define GATT_UNIT_PRESSURE_PASCAL_UUID 0x2724 // Pa, N/m2 = m2 kg s-2
#define GATT_UNIT_ENERGY_JOULE_UUID 0x2725 // J, N m = m2 kg s-2
#define GATT_UNIT_POWER_WATT_UUID 0x2726 // W, J/s = m2 kg s-3
#define GATT_UNIT_ELECTRIC_CHARGE_C_UUID 0x2727 // C, sA
#define GATT_UNIT_ELECTRIC_POTENTIAL_DIF_V_UUID 0x2728 // V, W/A = m2 kg s-3 A-1
#define GATT_UNIT_CELSIUS_TEMP_DC_UUID 0x272F // oC, t/oC = T/K - 273.15
#define GATT_UNIT_TIME_MINUTE_UUID 0x2760 // min, 60 s
#define GATT_UNIT_TIME_HOUR_UUID 0x2761 // h, 3600 s
#define GATT_UNIT_TIME_DAY_UUID 0x2762 // d, 86400 s
#define GATT_UNIT_PLANE_ANGLE_DEGREE_UUID 0x2763 // o, (pi/180) rad
#define GATT_UNIT_PLANE_ANGLE_MINUTE_UUID 0x2764 // ', (pi/10800) rad
#define GATT_UNIT_PLANE_ANGLE_SECOND_UUID 0x2765 // '', (pi/648000) rad
#define GATT_UNIT_AREA_HECTARE_UUID 0x2766 // ha, 10^4 m^2
#define GATT_UNIT_VOLUME_LITRE_UUID 0x2767 // l, 10^-3 m^3
#define GATT_UNIT_MASS_TONNE_UUID 0x2768 // t, 10^3 kg
#define GATT_UINT_LENGTH_YARD_UUID 0x27A0 // yd, 0.9144 m
#define GATT_UNIT_LENGTH_PARSEC_UUID 0x27A1 // pc, 3.085678 × 1016 m
#define GATT_UNIT_LENGTH_INCH_UUID 0x27A2 // in, 0.0254 m
#define GATT_UNIT_LENGTH_FOOT_UUID 0x27A3 // ft, 0.3048 m
#define GATT_UNIT_LENGTH_MILE_UUID 0x27A4 // mi, 1609.347 m
#define GATT_UNIT_PRESSURE_PFPSI_UUID 0x27A5 // psi, 6.894757 × 103 Pa
#define GATT_UNIT_VELOCITY_KMPH_UUID 0x27A6 // km/h, 0.2777778 m^s-1
#define GATT_UNIT_VELOCITY_MPH_UUID 0x27A7 // mi/h, 0.44704 m^ s-1
#define GATT_UNIT_ANGULAR_VELOCITY_RPM_UUID 0x27A8 // r/min, 0.1047198 rad s-1
#define GATT_UNIT_ENERGY_GCAL_UUID 0x27A9 //
#define GATT_UNIT_ENERGY_KCAL_UUID 0x27AA // kcal, 4190.02 J
#define GATT_UNIT_ENERGY_KWH_UUID 0x27AB // kWh, 3600000 J
#define GATT_UNIT_THERMODYNAMIC_TEMP_DF_UUID 0x27AC // oF, t/oF = T/K × 1.8 - 459.67
#define GATT_UNIT_PERCENTAGE_UUID 0x27AD // %
#define GATT_UNIT_PER_MILE_UUID 0x27AE //
#define GATT_UNIT_PERIOD_BPM_UUID 0x27AF //
#define GATT_UNIT_ELECTRIC_CHARGE_AH_UUID 0x27B0 //
#define GATT_UNIT_MASS_DENSITY_MGPD_UUID 0x27B1 //
#define GATT_UNIT_MASS_DENSITY_MMPL_UUID 0x27B2 //
#define GATT_UNIT_TIME_YEAR_UUID 0x27B3 //
#define GATT_UNIT_TIME_MONTH_UUID 0x27B4 //
/*********************************************************************
* MACROS
*/
/*********************************************************************
* TYPEDEFS
*/
/*********************************************************************
* VARIABLES
*/
/**
* GATT Services
*/
extern CONST uint8 gapServiceUUID[];
extern CONST uint8 gattServiceUUID[];
/**
* GATT Attribute Types
*/
extern CONST uint8 primaryServiceUUID[];
extern CONST uint8 secondaryServiceUUID[];
extern CONST uint8 includeUUID[];
extern CONST uint8 characterUUID[];
/**
* GATT Characteristic Descriptors
*/
extern CONST uint8 charExtPropsUUID[];
extern CONST uint8 charUserDescUUID[];
extern CONST uint8 clientCharCfgUUID[];
extern CONST uint8 servCharCfgUUID[];
extern CONST uint8 charFormatUUID[];
extern CONST uint8 charAggFormatUUID[];
extern CONST uint8 validRangeUUID[];
extern CONST uint8 extReportRefUUID[];
extern CONST uint8 reportRefUUID[];
/**
* GATT Characteristic Types
*/
extern CONST uint8 deviceNameUUID[];
extern CONST uint8 appearanceUUID[];
extern CONST uint8 periPrivacyFlagUUID[];
extern CONST uint8 reconnectAddrUUID[];
extern CONST uint8 periConnParamUUID[];
extern CONST uint8 serviceChangedUUID[];
extern CONST uint8 manuNameUUID[];
extern CONST uint8 serialNumUUID[];
extern CONST uint8 manuAddrUUID[];
/*********************************************************************
* FUNCTIONS
*/
extern const uint8 *GATT_FindUUIDRec( uint8 *pUUID, uint8 len );
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* GATT_UUID_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,407 @@
/**************************************************************************************************
Filename: l2cap.h
Revised: $Date: 2012-01-04 14:47:09 -0800 (Wed, 04 Jan 2012) $
Revision: $Revision: 28826 $
Description: This file contains the L2CAP definitions.
Copyright 2009-2011 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
#ifndef L2CAP_H
#define L2CAP_H
#ifdef __cplusplus
extern "C"
{
#endif
/*********************************************************************
* INCLUDES
*/
#include "bcomdef.h"
#include "OSAL.h"
/*********************************************************************
* CONSTANTS
*/
// Minimum supported information payload for the Basic information frame (B-frame)
#define L2CAP_MTU_SIZE 23
// Minimum supported information payload for the Control frame (C-frame)
#define L2CAP_SIG_MTU_SIZE 23
// Basic L2CAP header: Length (2 bytes) + Channel ID (2 bytes)
#define L2CAP_HDR_SIZE 4
// Minimum size of PDU received from lower layer protocol (incoming
// packet), or delivered to lower layer protocol (outgoing packet).
#define L2CAP_PDU_SIZE ( L2CAP_HDR_SIZE + L2CAP_MTU_SIZE )
// L2CAP Channel Identifiers. Identifiers from 0x0001 to 0x003F are
// reserved for specific L2CAP functions. Identifiers 0x0001-0x0003
// are reserved by BR/EDR.
#define L2CAP_CID_NULL 0x0000 // Illegal Identifier
#define L2CAP_CID_ATT 0x0004 // Attribute Protocol
#define L2CAP_CID_SIG 0x0005 // L2CAP Signaling
#define L2CAP_CID_SMP 0x0006 // Security Management Protocol
#define L2CAP_CID_GENERIC 0x0007 // Generic Fixed Channel
// L2CAP Dynamic Channel Identifiers
#define L2CAP_BASE_DYNAMIC_CID 0x0040
#define L2CAP_LAST_DYNAMIC_CID ( BASE_DYNAMIC_CID + L2CAP_NUM_CHANNELS - 1 )
// Number of Fixed channels: one for each of ATT, Signaling, SMP channels and one Generic Channel
#define L2CAP_NUM_FIXED_CHANNELS 4
// Number of Protocols supported -- for future use
#define L2CAP_NUM_PROTOCOLS 0
// Number of Auxiliary channels: one for each of Echo Request, Information
// Request and Connection Parameter Update Request
#define L2CAP_NUM_AUX_CHANNELS 3
// Number of Dynamic channels: one per each protocol supported on each physical connection
#define L2CAP_NUM_DYNAMIC_CHANNELS ( L2CAP_NUM_PROTOCOLS * MAX_NUM_LL_CONN )
// Total number of L2CAP channels: Dynamic channels plus Auxiliary channels
#define L2CAP_NUM_CHANNELS ( L2CAP_NUM_DYNAMIC_CHANNELS + L2CAP_NUM_AUX_CHANNELS )
// L2CAP Response Timeout expired (RTX) value for Signaling commands (in seconds).
// The RTX timer is used for response timeout or to terminate a dynamic channel
// when the remote device is unresponsive to signaling requests. Its value may
// range from 1 to 60 seconds.
#define L2CAP_RTX_TIMEOUT 30
// L2CAP Signaling Codes (type of commands)
#define L2CAP_CMD_REJECT 0x01
#define L2CAP_ECHO_REQ 0x08 // No longer supported
#define L2CAP_ECHO_RSP 0x09 // No longer supported
#define L2CAP_INFO_REQ 0x0a // No longer supported
#define L2CAP_INFO_RSP 0x0b // No longer supported
#define L2CAP_PARAM_UPDATE_REQ 0x12
#define L2CAP_PARAM_UPDATE_RSP 0x13
/*********************************************************************
* Command Reject: Reason Codes
*/
// Command not understood
#define L2CAP_REJECT_CMD_NOT_UNDERSTOOD 0x0000
// Signaling MTU exceeded
#define L2CAP_REJECT_SIGNAL_MTU_EXCEED 0x0001
// Invalid CID in request
#define L2CAP_REJECT_INVALID_CID 0x0002
/*********************************************************************
* Information Request/Response: Info Type
*/
// Connectionless MTU
#define L2CAP_INFO_CONNLESS_MTU 0x0001
// Extended features supported
#define L2CAP_INFO_EXTENDED_FEATURES 0x0002
// Fixed channels supported
#define L2CAP_INFO_FIXED_CHANNELS 0x0003
/*********************************************************************
* Information Response: Extended Features Mask Values
*/
// Fixed channels are supported
#define L2CAP_FIXED_CHANNELS 0x00000080
// Length of Extended Features bit mask
#define L2CAP_EXTENDED_FEATURES_SIZE 4
/*********************************************************************
* Information Response: Fixed Channels Mask Values
*/
// Fixed Channel ATT is supported
#define L2CAP_FIXED_CHANNELS_ATT 0x10
// Fixed Channel L2CAP Signaling is supported
#define L2CAP_FIXED_CHANNELS_SIG 0x20
// Fixed Channel SMP is supported
#define L2CAP_FIXED_CHANNELS_SMP 0x40
// Length of Fixed Channels bit mask
#define L2CAP_FIXED_CHANNELS_SIZE 8
/*********************************************************************
* Information Response: Result Values
*/
// Success
#define L2CAP_INFO_SUCCESS 0x0000
// Not supported
#define L2CAP_INFO_NOT_SUPPORTED 0x0001
/*********************************************************************
* Connection Parameter Update Response: Result values
*/
// Connection Parameters accepted
#define L2CAP_CONN_PARAMS_ACCEPTED 0x0000
// Connection Parameters rejected
#define L2CAP_CONN_PARAMS_REJECTED 0x0001
/*********************************************************************
* VARIABLES
*/
/*********************************************************************
* MACROS
*/
/*********************************************************************
* TYPEDEFS
*/
// Invalid CID in Request format
typedef struct
{
uint16 localCID; // Destination CID from the rejected command
uint16 remoteCID; // Source CID from the rejected command
} l2capInvalidCID_t;
// Command Reject Reason Data format
typedef union
{
uint16 signalMTU; // Maximum Signaling MTU
l2capInvalidCID_t invalidCID; // Invalid CID in Request
} l2capReasonData_t;
// Command Reject format
typedef struct
{
uint16 reason; // Reason
l2capReasonData_t reasonData; // Reason Data
// Shorthand access for union members
#define maxSignalMTU reasonData.signalMTU
#define invalidLocalCID reasonData.invalidCID.localCID
#define invalidRemoteCID reasonData.invalidCID.remoteCID
} l2capCmdReject_t;
// Echo Request format
typedef struct
{
uint8 *pData; // Optional data field
uint16 len; // Length of data
} l2capEchoReq_t;
// Echo Response format
typedef struct
{
uint8 *pData; // Optional data field -- must be freed by the application
uint16 len; // Length of data
} l2capEchoRsp_t;
// Information Request format
typedef struct
{
uint16 infoType; // Information type
} l2capInfoReq_t;
// Information Response Data field
typedef union
{
uint16 connectionlessMTU; // Connectionless MTU
uint32 extendedFeatures; // Extended features supported
uint8 fixedChannels[L2CAP_FIXED_CHANNELS_SIZE]; // Fixed channels supported
} l2capInfo_t;
// Information Response format
typedef struct
{
uint16 result; // Result
uint16 infoType; // Information type
l2capInfo_t info; // Content of Info field depends on infoType
} l2capInfoRsp_t;
// Connection Parameter Update Request format
typedef struct
{
uint16 intervalMin; // Minimum Interval
uint16 intervalMax; // Maximum Interval
uint16 slaveLatency; // Slave Latency
uint16 timeoutMultiplier; // Timeout Multiplier
} l2capParamUpdateReq_t;
// Connection Parameter Update Response format
typedef struct
{
uint16 result; // Result
} l2capParamUpdateRsp_t;
// Union of all L2CAP Signaling commands
typedef union
{
// Requests
l2capEchoReq_t echoReq;
l2capInfoReq_t infoReq;
l2capParamUpdateReq_t updateReq;
// Responses
l2capCmdReject_t cmdReject;
l2capEchoRsp_t echoRsp;
l2capInfoRsp_t infoRsp;
l2capParamUpdateRsp_t updateRsp;
} l2capSignalCmd_t;
// OSAL L2CAP_SIGNAL_EVENT message format. This message is used to deliver an
// incoming Signaling command up to an upper layer application.
typedef struct
{
osal_event_hdr_t hdr; // L2CAP_SIGNAL_EVENT and status
uint16 connHandle; // connection message was received on
uint8 id; // identifier to match responses with requests
uint8 opcode; // type of command
l2capSignalCmd_t cmd; // command data
} l2capSignalEvent_t;
// L2CAP packet structure
typedef struct
{
uint16 CID; // local channel id
uint8 *pPayload; // pointer to information payload. This contains the payload
// received from the upper layer protocol (outgoing packet),
// or delivered to the upper layer protocol (incoming packet).
uint16 len; // length of information payload
} l2capPacket_t;
// OSAL L2CAP_DATA_EVENT message format. This message is used to forward an
// incoming data packet up to an upper layer application.
typedef struct
{
osal_event_hdr_t hdr; // L2CAP_DATA_EVENT and status
uint16 connHandle; // connection packet was received on
l2capPacket_t pkt; // received packet
} l2capDataEvent_t;
/*********************************************************************
* VARIABLES
*/
/*********************************************************************
* FUNCTIONS
*/
/*
* Initialize L2CAP layer.
*/
extern void L2CAP_Init( uint8 taskId );
/*
* L2CAP Task event processing function.
*/
extern uint16 L2CAP_ProcessEvent( uint8 taskId, uint16 events );
/*
* Register a protocol/application with an L2CAP channel.
*/
extern bStatus_t L2CAP_RegisterApp( uint8 taskId, uint16 CID );
/*
* Send L2CAP Data Packet.
*/
extern bStatus_t L2CAP_SendData( uint16 connHandle, l2capPacket_t *pPkt );
/*
* Send Command Reject.
*/
extern bStatus_t L2CAP_CmdReject( uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject );
/*
* Build Command Reject.
*/
extern uint16 L2CAP_BuildCmdReject( uint8 *pBuf, uint8 *pCmd );
/*
* Send L2CAP Echo Request.
*/
extern bStatus_t L2CAP_EchoReq( uint16 connHandle, l2capEchoReq_t *pEchoReq, uint8 taskId );
/*
* Send L2CAP Information Request.
*/
extern bStatus_t L2CAP_InfoReq( uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId );
/*
* Build Information Response.
*/
extern uint16 L2CAP_BuildInfoRsp( uint8 *pBuf, uint8 *pCmd );
/*
* Parse Information Request.
*/
extern bStatus_t L2CAP_ParseInfoReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
/*
* Send L2CAP Connection Parameter Update Request.
*/
extern bStatus_t L2CAP_ConnParamUpdateReq( uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId );
/*
* Parse Connection Parameter Update Request.
*/
extern bStatus_t L2CAP_ParseParamUpdateReq( l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len );
/*
* Send L2CAP Connection Parameter Update Response.
*/
extern bStatus_t L2CAP_ConnParamUpdateRsp( uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp );
/*
* Build Connection Parameter Update Response.
*/
extern uint16 L2CAP_BuildParamUpdateRsp( uint8 *pBuf, uint8 *pData );
/*
* Allocate a block of memory at the L2CAP layer.
*/
extern void *L2CAP_bm_alloc( uint16 size );
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* L2CAP_H */

View File

@@ -0,0 +1,381 @@
/**
@headerfile: sm.h
$Date: 2012-10-29 13:32:07 -0700 (Mon, 29 Oct 2012) $
$Revision: 31951 $
@mainpage BLE SM API
This file contains the interface to the SM.
Copyright 2009 - 2012 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
*/
#ifndef SM_H
#define SM_H
#ifdef __cplusplus
extern "C"
{
#endif
/*-------------------------------------------------------------------
* INCLUDES
*/
#include "bcomdef.h"
#include "OSAL.h"
/*-------------------------------------------------------------------
* MACROS
*/
/*-------------------------------------------------------------------
* CONSTANTS
*/
/** @defgroup SM_IO_CAP_DEFINES SM I/O Capabilities
* @{
*/
#define DISPLAY_ONLY 0x00 //!< Display Only Device
#define DISPLAY_YES_NO 0x01 //!< Display and Yes and No Capable
#define KEYBOARD_ONLY 0x02 //!< Keyboard Only
#define NO_INPUT_NO_OUTPUT 0x03 //!< No Display or Input Device
#define KEYBOARD_DISPLAY 0x04 //!< Both Keyboard and Display Capable
/** @} End SM_IO_CAP_DEFINES */
#define SM_AUTH_MITM_MASK(a) (((a) & 0x04) >> 2)
/** @defgroup SM_PASSKEY_TYPE_DEFINES SM Passkey Types (Bit Masks)
* @{
*/
#define SM_PASSKEY_TYPE_INPUT 0x01 //!< Input the passkey
#define SM_PASSKEY_TYPE_DISPLAY 0x02 //!< Display the passkey
/** @} End SM_PASSKEY_TYPE_DEFINES */
/** @defgroup SM_BONDING_FLAGS_DEFINES SM AuthReq Bonding Flags
* Bonding flags 0x02 and 0x03 are reserved.
* @{
*/
#define SM_AUTH_REQ_NO_BONDING 0x00 //!< No bonding
#define SM_AUTH_REQ_BONDING 0x01 //!< Bonding
/** @} End SM_BONDING_FLAGS_DEFINES */
#define PASSKEY_LEN 6 //! Passkey Character Length (ASCII Characters)
#define SM_AUTH_STATE_AUTHENTICATED 0x04 //! Authenticate requested
#define SM_AUTH_STATE_BONDING 0x01 //! Bonding requested
/*-------------------------------------------------------------------
* General TYPEDEFS
*/
/**
* SM_NEW_RAND_KEY_EVENT message format. This message is sent to the
* requesting task.
*/
typedef struct
{
osal_event_hdr_t hdr; //!< SM_NEW_RAND_KEY_EVENT and status
uint8 newKey[KEYLEN]; //!< New key value - if status is SUCCESS
} smNewRandKeyEvent_t;
/**
* Key Distribution field - True or False fields
*/
typedef struct
{
unsigned int sEncKey:1; //!< Set to distribute slave encryption key
unsigned int sIdKey:1; //!< Set to distribute slave identity key
unsigned int sSign:1; //!< Set to distribute slave signing key
unsigned int mEncKey:1; //!< Set to distribute master encryption key
unsigned int mIdKey:1; //!< Set to distribute master identity key
unsigned int mSign:1; //!< Set to distribute master signing key
unsigned int reserved:2; //!< Reserved - not to be used
} keyDist_t;
/**
* Link Security Requirements
*/
typedef struct
{
uint8 ioCaps; //!< I/O Capabilities (ie.
uint8 oobAvailable; //!< True if Out-of-band key available
uint8 oob[KEYLEN]; //!< Out-Of-Bounds key
uint8 authReq; //!< Authentication Requirements
keyDist_t keyDist; //!< Key Distribution mask
uint8 maxEncKeySize; //!< Maximum Encryption Key size (7-16 bytes)
} smLinkSecurityReq_t;
/**
* Link Security Information
*/
typedef struct
{
uint8 ltk[KEYLEN]; //!< Long Term Key (LTK)
uint16 div; //!< LTK Diversifier
uint8 rand[B_RANDOM_NUM_SIZE]; //!< LTK random number
uint8 keySize; //!< LTK Key Size (7-16 bytes)
} smSecurityInfo_t;
/**
* Link Identity Information
*/
typedef struct
{
uint8 irk[KEYLEN]; //!< Identity Resolving Key (IRK)
uint8 bd_addr[B_ADDR_LEN]; //!< The advertiser may set this to zeroes to not disclose its BD_ADDR (public address).
} smIdentityInfo_t;
/**
* Signing Information
*/
typedef struct
{
uint8 srk[KEYLEN]; //!< Signature Resolving Key (CSRK)
uint32 signCounter; //!< Sign Counter
} smSigningInfo_t;
/**
* Pairing Request & Response - authReq field
*/
typedef struct
{
unsigned int bonding:2; //!< Bonding flags
unsigned int mitm:1; //!< Man-In-The-Middle (MITM)
unsigned int reserved:5; //!< Reserved - don't use
} authReq_t;
/*-------------------------------------------------------------------
* GLOBAL VARIABLES
*/
/**
* @defgroup SM_API Security Manager API Functions
*
* @{
*/
/*-------------------------------------------------------------------
* FUNCTIONS - MASTER API - Only use these in a master device
*/
/**
* @brief Initialize SM Initiator on a master device.
*
* @return SUCCESS
*/
extern bStatus_t SM_InitiatorInit( void );
/**
* @brief Start the pairing process. This function is also
* called if the device is already bound.
*
* NOTE: Only one pairing process at a time per device.
*
* @param initiator - TRUE to start pairing as Initiator.
* @param taskID - task ID to send results.
* @param connectionHandle - Link's connection handle
* @param pSecReqs - Security parameters for pairing
*
* @return SUCCESS,<BR>
* INVALIDPARAMETER,<BR>
* bleAlreadyInRequestedMode
*/
extern bStatus_t SM_StartPairing( uint8 initiator,
uint8 taskID,
uint16 connectionHandle,
smLinkSecurityReq_t *pSecReqs );
/**
* @brief Send Start Encrypt through HCI
*
* @param connHandle - Connection Handle
* @param pLTK - pointer to 16 byte lkt
* @param div - div or ediv
* @param pRandNum - pointer to 8 byte random number
* @param keyLen - length of LTK (bytes)
*
* @return SUCCESS,<BR>
* INVALIDPARAMETER,<BR>
* other from HCI/LL
*/
extern bStatus_t SM_StartEncryption( uint16 connHandle, uint8 *pLTK,
uint16 div, uint8 *pRandNum, uint8 keyLen );
/*-------------------------------------------------------------------
* FUNCTIONS - SLAVE API - Only use these in a slave device
*/
/**
* @brief Initialize SM Responder on a slave device.
*
* @return SUCCESS
*/
extern bStatus_t SM_ResponderInit( void );
/*-------------------------------------------------------------------
* FUNCTIONS - GENERAL API - both master and slave
*/
/**
* @brief Generate a key with a random value.
*
* @param taskID - task ID to send results.
*
* @return SUCCESS,<BR>
* bleNotReady,<BR>
* bleMemAllocError,<BR>
* FAILURE
*/
extern bStatus_t SM_NewRandKey( uint8 taskID );
/**
* @brief Calculate a new Private Resolvable address.
*
* @param pIRK - Identity Root Key.
* @param pNewAddr - pointer to place to put new calc'd address
*
* @return SUCCESS - if started,<BR>
* INVALIDPARAMETER
*/
extern bStatus_t SM_CalcRandomAddr( uint8 *pIRK, uint8 *pNewAddr );
/**
* @brief Resolve a Private Resolveable Address.
*
* @param pIRK - pointer to the IRK
* @param pAddr - pointer to the random address
*
* @return SUCCESS - match,<BR>
* FAILURE - don't match,<BR>
* INVALIDPARAMETER - parameters invalid
*/
extern bStatus_t SM_ResolveRandomAddrs( uint8 *pIRK, uint8 *pAddr );
/**
* @brief Encrypt the plain text data with the key..
*
* @param pKey - key data
* @param pPlainText - Plain text data
* @param pResult - place to put the encrypted result
*
* @return SUCCESS - if started,<BR>
* INVALIDPARAMETER - one of the parameters are NULL,<BR>
* bleAlreadyInRequestedMode,<BR>
* bleMemAllocError
*/
extern bStatus_t SM_Encrypt( uint8 *pKey, uint8 *pPlainText, uint8 *pResult );
/**
* @brief Generate an outgoing Authentication Signature.
*
* @param pData - message data
* @param len - length of pData
* @param pAuthenSig - place to put new signature
*
* @return SUCCESS - signature authentication generated,<BR>
* INVALIDPARAMETER - pData or pAuthenSig is NULL,<BR>
* bleMemAllocError
*/
extern bStatus_t SM_GenerateAuthenSig( uint8 *pData, uint8 len, uint8 *pAuthenSig );
/**
* @brief Verify an Authentication Signature.
*
* @param connHandle - connection to verify against.
* @param authentication - TRUE if requires an authenticated CSRK, FALSE if not
* @param pData - message data
* @param len - length of pData
* @param pAuthenSig - message signature to verify
*
* @return SUCCESS - signature authentication verified,<BR>
* FAILURE - if not verified,<BR>
* bleNotConnected - Connection not found,<BR>
* INVALIDPARAMETER - pData or pAuthenSig is NULL, or signCounter is invalid,<BR>
* bleMemAllocError
*/
extern bStatus_t SM_VerifyAuthenSig( uint16 connHandle,
uint8 authentication,
uint8 *pData,
uint8 len,
uint8 *pAuthenSig );
/**
* @brief Update the passkey for the pairing process.
*
* @param pPasskey - pointer to the 6 digit passkey
* @param connectionHandle - connection handle to link.
*
* @return SUCCESS,<BR>
* bleIncorrectMode - Not pairing,<BR>
* INVALIDPARAMETER - link is incorrect
*/
extern bStatus_t SM_PasskeyUpdate( uint8 *pPasskey, uint16 connectionHandle );
/**
* @} End SM_API
*/
/*-------------------------------------------------------------------
* TASK API - These functions must only be called OSAL.
*/
/**
* @internal
*
* @brief SM Task Initialization Function.
*
* @param taskID - SM task ID.
*
* @return void
*/
extern void SM_Init( uint8 task_id );
/**
* @internal
*
* @brief SM Task event processing function.
*
* @param taskID - SM task ID
* @param events - SM events.
*
* @return events not processed
*/
extern uint16 SM_ProcessEvent( uint8 task_id, uint16 events );
/*-------------------------------------------------------------------
-------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* SM_H */