CC2540/2541软件开发指南

本文是在阅读CC2540/2541 software programming guide的过程当中翻译总结出来的。

Overview

蓝牙4.0标准包含2套技术系统:

经典蓝牙(BR/EDR,也就是basic rate/enhanced data rate);

低功耗蓝牙(BLE)。

BLE蓝牙技术功耗更低,传输速度也比较低,用在监控和可穿戴的消费电子领域。

手机/平板/电脑,里面一般包含双模蓝牙芯片(也就是经典蓝牙和BLE技术都实现了)。

手环,计步器,气体传感器等要求纽扣电池供电的领域,一般使用BLE技术的蓝牙芯片,也叫单模蓝牙。

BLE协议栈概述

图1.2描述了BLE协议栈的基本架构。

BLE协议栈分为两个部分:控制器和主机。这样的分层,来源于经典蓝牙协议栈。在蓝牙经典协议栈里面两个层通常都是分开实现的。属性(Profiles)和应用(Applications)是在协议栈的GAP和GATT层实现的。

物理层(PHY)工作在1Mbps,GFSK调制方式,工业/科学/医疗频段即无需license的2.4GHZ频段。

链路层(LL)控制着设备的RF状态。

设备有5个可能的状态:

  1. 等待
  2. 广播
  3. 扫描
  4. 发起链接
  5. 已链接

HCI定义了Host和Controller之间的信息交互方式。

L2CAP定义了对上层的数据封装服务,这一层保证可以进行逻辑端到端的数据通讯。

SM(安全管理器)定义了密钥生成和配对的方法,并对其上层提供了和对端进行安全连接和数据交换的服务。

GAP和application以及profile直接相接,负责提供设备的发现和连接服务。GAP同时还负责安全模块的初始化工作。

GATT_PRIMARY_SERVICE_UUID – This indicates the start of a new service, and the type
of the service provided

GATT_CHARACTER_UUID – This is known as the “characteristic declaration”, and it
indicates that the attribute immediately following it is a GATT characteristic value

GATT_CLIENT_CHAR_CFG_UUID – This attribute represents a characteristic descriptor that
corresponds to the nearest preceding (by handle) characteristic value in the attribute table. It
allows the GATT client to enable notifications of the characteristic value

GATT_CHAR_USER_DESC_UUID – This attribute represents a characteristic descriptor that
corresponds to the nearest preceding (by handle) characteristic value in the attribute table. It
contains an ASCII string with a description of the corresponding characteristic

posted @ 2015-09-25 17:35  ironX  阅读(1344)  评论(0编辑  收藏  举报