蓝牙 - BLE Basics

BLE Basics [ BLE基础 ]

需要了解的两个主要概念是 BLE 设备的两种模式:

Two major concepts to know about are the two modes of BLE devices:

* 广播模式(也称为通用访问配置文件 GAP)

* 连接设备模式(也称为通用属性配置文件 GATT)。

* Broadcasting mode (also called GAP for Generic Access Profile)

* Connected device mode (also called GATT for Generic ATTribute Profile).

GAP 模式用于广播外设广告,如 "我是一个名为 LEDBlue-19592CBC 的设备",以及在需要时,为了与专用设备建立连接,来广播相关信息。在需要时建立所需的广告信息。外围设备还可能广播一些其提供的可用服务信息。

GAP mode deals with broadcasting peripheral advertisements, such as "I'm a device named LEDBlue-19592CBC", as well as advertising information necessary to establish a dedicated device connection if desired. The peripheral may also be advertising available services.

GATT 模式处理两台设备连接后的通信和属性传输,如心脏监视器和手机之间。

GATT mode deals with communications and attribute transfer between two devices once they are connected, such as between a heart monitor and a phone.

Bluetooth LE Terms [ 相关术语 ]

  • GAP Mode [ GAP 模式 ]

1, Device Roles [ 设备角色 ]:

* 外围设备 - 播放广告的低功耗设备。外围设备的例子包括:心率监测器、智能手表、健身追踪器、iBeacon。

* 中心设备-"计算机 "主机,负责观察外设播放的广告。它通常是一个移动设备,如手机、平板电脑、台式机或笔记本电脑。

* Peripheral - The low-power device that broadcasts advertisements. Examples of peripherals include: heart rate monitor, smart watch, fitness tracker, iBeacon.

* Central - The host "computer" that observes advertisements being broadcast by the Peripherals. This is often a mobile device such as a phone, tablet, desktop or laptop.

2, Terms [ 术语 ]:

* 广播 - 在建立专用连接之前由外设发送的信息。附近的所有中心设备都能看到这些广告。外围设备发布广告时,可能会传输设备名称、功能描述和/或其他数据。中心设备可以查找要连接的正在广播的外围设备,并利用广播信息确定每个外围设备的功能(或提供的服务,详见下文)。

* Advertising - Information sent by the peripheral before a dedicated connection has been established. All nearby Centrals can observe these advertisements. When a peripheral device advertises, it may be transmitting the name of the device, describing its capabilities, and/or some other piece of data. Central can look for advertising peripherals to connect to, and use that information to determine each peripheral's capabilities (or Services offered, more on that below).

  • GATT Mode [ GATT模式 ]

Device Roles [设备角色] :

* 服务器 - 在连接模式下,设备可以扮演服务器的新角色,为客户端提供服务。它现在可以根据与之连接的客户端设备的要求发送和接收数据包。

* 客户端 - 在连接模式下,设备还可以扮演客户端的新角色,向服务器的一个或多个可用服务发送请求,以发送和接收数据包。

* Server - In connected mode, a device may take on a new role as a Server, providing a Service available to clients. It can now send and receive data packets as requested by the Client device to which it now has a connection.

* Client - In connected mode, a device may also take on a new role as Client that can send requests to one or more of a Server's available Services to send and receive data packets.

注意:在 GATT 模式下,设备在连接到其他设备时可以同时扮演服务器和客户端的角色。

NOTE: A device in GATT mode can take on the role of both Server and Client while connected to another device.

  • Terms [ 术语 ] :

1,配置文件 - BLE 设备可提供的预定义服务集合。例如,心率配置文件或骑行传感器(自行车电脑)配置文件。这些配置文件由蓝牙特殊兴趣小组(SIG)定义。对于不符合预定义配置文件的设备,制造商可创建自己的配置文件。例如,没有 "智能灯泡 "配置文件,因此 Magic Light 制造商创建了自己独特的配置文件。

1, Profile - A pre-defined collection of Services that a BLE device can provide. For example, the Heart Rate Profile, or the Cycling Sensor (bike computer) Profile. These Profiles are defined by the Bluetooth Special Interest Group (SIG). For devices that don't fit into one of the pre-defined Profiles, the manufacturer creates their own Profile. For example, there is not a "Smart Bulb" profile, so the Magic Light manufacturer has created their own unique one.

2,服务 - 服务器提供的功能。例如,心率监测臂带可能有单独的设备信息服务、电池服务和心率服务。每个服务都由称为 "特征 "的信息集合组成。就心率服务而言,两个特征是心率测量和身体传感器位置。外设会广播其服务。

2, Service - A function the Server provides. For example, a heart rate monitor armband may have separate Services for Device Information, Battery Service, and Heart Rate itself. Each Service is comprised of collections of information called Characteristics. In the case of the Heart Rate Service, the two Characteristics are Heart Rate Measurement and Body Sensor Location. The peripheral advertises its services.

3,特性 - 特性是数据值或属性以及相关元数据(如人类可读的名称)的容器。特性可以可读、可写或两者兼有。例如,"心率测量特征 "可以给客户端设备提供的信息是心率测量值报告,具体内容为一个数字,以及单位字符串 "bpm"(表示每分钟心跳次数)。Magic Light 服务器有一个灯泡 RGB 值特性,中心设备可以写入该特性来改变颜色。每个特性都有一个通用唯一标识符(UUID),即 16 位或 128 位 ID。

3, Characteristic - A Characteristic is a container for the value, or attribute, of a piece of data along with any associated metadata, such as a human-readable name. A characteristic may be readable, writable, or both. For example, the Heart Rate Measurement Characteristic can be served up to the Client device and will report the heart rate measurement as a number, as well as the unit string "bpm" for beats-per-minute. The Magic Light Server has a Characteristic for the RGB value of the bulb which can be written to by the Central to change the color. Characteristics each have a Universal Unique Identifier (UUID) which is a 16-bit or 128-bit ID.

4,数据包 - 设备传输的数据。BLE 设备和主机以称为数据包的小单元形式传输和接收数据。

4, Packet - Data transmitted by a device. BLE devices and host computers transmit and receive data in small bursts called packets.

参考:

1,Adafruit

Understanding BLE | BLE HID Keyboard Buttons with CircuitPython | Adafruit Learning System

  • 45
    点赞
  • 42
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值