/**************************************************************************************************
Filename: simpleBLECentral.c
Revised: $Date: 2011-06-20 11:57:59 -0700 (Mon, 20 Jun 2011) $
Revision: $Revision: 28 $
Description: This file contains the Simple BLE Central sample application
for use with the CC2540 Bluetooth Low Energy Protocol Stack.
Copyright 2010 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.
**************************************************************************************************/
/*********************************************************************
* INCLUDES
*/
#include "bcomdef.h"
#include "OSAL.h"
#include "OSAL_PwrMgr.h"
#include "OnBoard.h"
#include "hal_led.h"
#include "hal_key.h"
#include "hal_lcd.h"
#include "gatt.h"
#include "ll.h"
#include "hci.h"
#include "gapgattserver.h"
#include "gattservapp.h"
#include "central.h"
#include "gapbondmgr.h"
#include "simpleGATTprofile.h"
#include "simpleBLECentral.h"
/*********************************************************************
* MACROS
*/
// Length of bd addr as a string
#define B_ADDR_STR_LEN 15
/*********************************************************************
* CONSTANTS
*/
// Maximum number of scan responses
#define DEFAULT_MAX_SCAN_RES 8
// Scan duration in ms
#define DEFAULT_SCAN_DURATION 4000
// Discovey mode (limited, general, all)
#define DEFAULT_DISCOVERY_MODE DEVDISC_MODE_ALL
// TRUE to use active scan
#define DEFAULT_DISCOVERY_ACTIVE_SCAN TRUE
// TRUE to use white list during discovery
#define DEFAULT_DISCOVERY_WHITE_LIST FALSE
// TRUE to use high scan duty cycle when creating link
#define DEFAULT_LINK_HIGH_DUTY_CYCLE FALSE
// TRUE to use white list when creating link
#define DEFAULT_LINK_WHITE_LIST FALSE
// Default RSSI polling period in ms
#define DEFAULT_RSSI_PERIOD 1000
// Whether to enable automatic parameter update request when a connection is formed
#define DEFAULT_ENABLE_UPDATE_REQUEST FALSE
// Minimum connection interval (units of 1.25ms) if automatic parameter update request is enabled
#define DEFAULT_UPDATE_MIN_CONN_INTERVAL 400
// Maximum connection interval (units of 1.25ms) if automatic parameter update request is enabled
#define DEFAULT_UPDATE_MAX_CONN_INTERVAL 800
// Slave latency to use if automatic parameter update request is enabled
#define DEFAULT_UPDATE_SLAVE_LATENCY 0
// Supervision timeout value (units of 10ms) if automatic parameter update request is enabled
#define DEFAULT_UPDATE_CONN_TIMEOUT 600
// Default passcode
#define DEFAULT_PASSCODE 19655
// Default GAP pairing mode
#define DEFAULT_PAIRING_MODE GAPBOND_PAIRING_MODE_WAIT_FOR_REQ
// Default MITM mode (TRUE to require passcode or OOB when pairing)
#define DEFAULT_MITM_MODE FALSE
// Default bonding mode, TRUE to bond
#define DEFAULT_BONDING_MODE TRUE
// Default GAP bonding I/O capabilities
#define DEFAULT_IO_CAPABILITIES GAPBOND_IO_CAP_DISPLAY_ONLY
// Default service discovery timer delay in ms
#define DEFAULT_SVC_DISCOVERY_DELAY 1000
// TRUE to filter discovery results on desired service UUID
#define DEFAULT_DEV_DISC_BY_SVC_UUID TRUE
// Application states
enum
{
BLE_STATE_IDLE,
BLE_STATE_CONNECTING,
BLE_STATE_CONNECTED,
BLE_STATE_DISCONNECTING
};
// Discovery states
enum
{
BLE_DISC_STATE_IDLE, // Idle
BLE_DISC_STATE_SVC, // Service discovery
BLE_DISC_STATE_CHAR // Characteristic discovery
};
/*********************************************************************
* TYPEDEFS
*/
/*********************************************************************
* GLOBAL VARIABLES
*/
/*********************************************************************
* EXTERNAL VARIABLES
*/
/*********************************************************************
* EXTERNAL FUNCTIONS
*/
/*********************************************************************
* LOCAL VARIABLES
*/
// Task ID for internal task/event processing
static uint8 simpleBLETaskId;
// GAP GATT Attributes
static const uint8 simpleBLEDeviceName[GAP_DEVICE_NAME_LEN] = "Simple BLE Central";
// Number of scan results and scan result index
static uint8 simpleBLEScanRes;
static uint8 simpleBLEScanIdx;
// Scan result list
static gapDevRec_t simpleBLEDevList[DEFAULT_MAX_SCAN_RES];
// Scanning state
static uint8 simpleBLEScanning = FALSE;
// RSSI polling state
static uint8 simpleBLERssi = FALSE;
// Connection handle of current connection
static uint16 simpleBLEConnHandle = GAP_CONNHANDLE_INIT;
// Application state
static uint8 simpleBLEState = BLE_STATE_IDLE;
// Discovery state
static uint8 simpleBLEDiscState = BLE_DISC_STATE_IDLE;
// Discovered service start and end handle
static uint16 simpleBLESvcStartHdl = 0;
static uint16 simpleBLESvcEndHdl = 0;
// Discovered characteristic handle
static uint16 simpleBLECharHdl = 0;
// Value to write
static uint8 simpleBLECharVal = 0;
// Value read/write toggle
static bool simpleBLEDoWrite = FALSE;
// GATT read/write procedure state
static bool simpleBLEProcedureInProgress = FALSE;
/*********************************************************************
* LOCAL FUNCTIONS
*/
static void simpleBLECentralProcessGATTMsg( gattMsgEvent_t *pMsg );
static void simpleBLECentralRssiCB( uint16 connHandle, int8 rssi );
static void simpleBLECentralEventCB( gapCentralRoleEvent_t *pEvent );
static void simpleBLECentralPasscodeCB( uint8 *deviceAddr, uint16 connectionHandle,
uint8 uiInputs, uint8 uiOutputs );
static void simpleBLECentralPairStateCB( uint16 connHandle, uint8 state, uint8 status );
static
没有合适的资源?快使用搜索试试~ 我知道了~
SimpleBLECentral.zip_蓝牙主机
共78个文件
pbi:29个
r51:29个
c:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 196 浏览量
2022-09-24
20:46:24
上传
评论
收藏 857KB ZIP 举报
温馨提示
TI公司提供的蓝牙4.0协议栈的实现代码,代码为实现主机功能
资源推荐
资源详情
资源评论
收起资源包目录
SimpleBLECentral.zip (78个子文件)
SimpleBLECentral
CC2541
buildConfig.cfg 3KB
SimpleBLECentral.eww 170B
SimpleBLECentral.ewp 36KB
SimpleBLECentral.ewd 17KB
Source
simpleBLECentral_Main.c 4KB
OSAL_simpleBLECentral.c 5KB
simpleBLECentral.c 31KB
simpleBLECentral.h 4KB
CC2540
buildConfig.cfg 3KB
SimpleBLECentral.eww 170B
SimpleBLECentral.ewp 36KB
settings
SimpleBLECentral.dbgdt 4KB
SimpleBLECentral.cspy.bat 1KB
SimpleBLECentral.dni 547B
CC2540EM
List
SimpleBLECentral.map 1.86MB
Exe
SimpleBLECentral.d51 1.52MB
SimpleBLECentral.hex 317KB
Obj
hal_lcd.pbi 2KB
npi.r51 12KB
hal_sleep.pbi 2KB
hal_timer.r51 1KB
central.r51 92KB
hal_uart.r51 9KB
hal_drivers.r51 17KB
osal_snv.pbi 2KB
gapbondmgr.r51 296KB
osal_bufmgr.pbi 2KB
hal_adc.r51 10KB
simpleBLECentral.r51 161KB
hal_startup.pbi 3KB
OSAL_Timers.pbi 2KB
hal_flash.pbi 2KB
hal_timer.pbi 2KB
OSAL_ClockBLE.pbi 2KB
OSAL_Memory.r51 17KB
hal_led.pbi 2KB
osal_snv.r51 124KB
hal_led.r51 53KB
hal_dma.pbi 2KB
gapbondmgr.pbi 2KB
OSAL_PwrMgr.r51 11KB
OSAL_simpleBLECentral.r51 13KB
simpleBLECentral_Main.r51 8KB
OnBoard.pbi 2KB
osal_cbtimer.r51 41KB
OSAL_simpleBLECentral.pbi 3KB
hal_drivers.pbi 2KB
gatt_uuid.r51 18KB
OSAL_PwrMgr.pbi 2KB
simpleBLECentral.pbi 3KB
hal_sleep.r51 40KB
hal_flash.r51 12KB
hal_key.r51 27KB
hal_aes.r51 18KB
hal_dma.r51 5KB
gatt_uuid.pbi 2KB
OSAL.pbi 2KB
hal_lcd.r51 96KB
hal_startup.r51 2KB
simpleBLECentral_Main.pbi 3KB
hal_aes.pbi 2KB
SimpleBLECentral.pbd 3KB
OSAL_Memory.pbi 2KB
hal_key.pbi 2KB
osal_cbtimer.pbi 2KB
npi.pbi 2KB
OnBoard.r51 24KB
hal_uart.pbi 2KB
osal_bufmgr.r51 19KB
central.pbi 2KB
OSAL_Timers.r51 69KB
hal_adc.pbi 2KB
gap.pbi 2KB
gap.r51 11KB
OSAL_ClockBLE.r51 64KB
OSAL.r51 144KB
SimpleBLECentral.dep 29KB
SimpleBLECentral.ewd 17KB
共 78 条
- 1
资源评论
alvarocfc
- 粉丝: 109
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Picasso_v3.1 2.ipa
- chromedriver-mac-arm64.zip
- 蓝zapro.apk
- chromedriver-linux64.zip
- UCAS研一深度学习实验-MNIST手写数字识别python源码+详细注释(高分项目)
- 基于Python和PyTorch框架完成的一个手写数字识别实验源码(带MINIST手写数字数据集)+详细注释(高分项目)
- 基于Matlab在MNIST数据集上利用CNN完成手写体数字识别任务,并实现单层CNN反向传播算法+源代码+文档说明(高分项目)
- NVIDIA驱动、CUDA和Pytorch及其依赖
- 基于SVM多特征融合的微表情识别python源码+项目说明+详细注释(高分课程设计)
- html动态爱心代码一(附源码)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功