蓝牙 - Terminal I/O Service Specification

1, Introduction

1.1, Scope

通过该服务,终端 I/O 客户端设备可连接终端 I/O 服务器设备并与之交互,从而实现串行数据和 GPIO 状态信息的双向交流。

终端 I/O 服务公开本地 UART 数据和本地 GPIO 状态变化,并允许 GATT 客户向 GATT 服务器传送自己的本地 UART 数据和本地 GPIO 状态变化。

This service enables a Terminal I/O Client device to connect and interact with a Terminal I/O Server device for bidirectional exchange of serial data and GPIO status information.

The Terminal I/O Service exposes local UART data and local GPIO state changes and allows a GATT Client to transmit own local UART data and local GPIO state changes to a GATT Server.

1.2, Conformance

如果设备声称符合本服务,则必须以指定的方式(流程强制)支持本服务的所有必选功能。这也适用于所有表示支持的可选和有条件功能。

If a device claims conformance to this service, all capabilities indicated as mandatory for this service shall be supported in the specified manner (process-mandatory). This also applies for all optional and conditional capabilities for which support is indicated.

1.3, Service Dependency

这项服务不依赖于任何其他服务。

This service is not dependent upon any other services.

1.4, Bluetooth Specification Release Compatibility

本规范兼容 CSA4 修订的任何蓝牙核心规范,其中包括通用属性配置文件 (GATT) 规范。

This specification is compatible with any Bluetooth core specification as amended by CSA4 that includes the Generic Attribute Profile (GATT) specification.

1.5, GATT Sub-Procedure Requirements

本节中的要求是对服务器的最低要求。如果客户机和服务器都支持,也可以使用其他 GATT 子程序。

表 2-1 总结了所有 GATT 服务器要求之外的其他 GATT 子程序要求。

Requirements in this section represent a minimum set of requirements for a Server. Other GATT sub-procedures may be used, if supported by both Client and Server

Table 2-1 summarizes additional GATT sub-procedure requirements beyond those required by all GATT Servers.

GATT Sub-Procedure

Requirements

Write Characteristic Value

M

Write Without Response

O

Notifications

M

Indications

M

Read Characteristic Descriptors

M

Write Characteristic Descriptors

M

Table 2-1: GATT Sub-procedure Requirements

1.6, Transport Dependencies

这项服务只能通过 LE 传输方式提供。

This service shall operate over LE transport only.

1.7, Byte Transmission Order

与本服务一起使用的所有特征、特征值和配置文件定义的描述符在传输时应以最小有效八位字节为先(即 little endian)。

All characteristics, characteristic values and profile defined descriptors used with this service shall be transmitted with the least significant octet first (i.e., little endian).

2, SERVICE DECLARATION

终端 I/O 服务应作为 "主服务 "实例化。服务 UUID 应设置为后面定义的分配给 "终端 I/O 服务 "的 UUID 值。

The Terminal I/O Service should be instantiated as a «Primary Service».The service UUID shall be set to the UUID value assigned to «Terminal I/O Service» as defined later.

3,  SERVICE CHARACTERISTICS

终端 I/O 服务具有以下特性。在此服务中,每个特性只允许有一个实例。

如果可以通知某个特性,则应按照核心规范的要求在该特性中包含客户端特性配置描述符。

The following characteristics are exposed in the Terminal I/O Service. Only one instance of each characteristic is permitted within this service.

Where a characteristic can be notified, a Client Characteristic Configuration descriptor shall be included in that characteristic as required by the Core Specification.

Characteristic Name

Requirement

Mandatory Properties

Security Permissions

UART Data Rx

M

Write without Response

C1

UART Data Tx

M

Notify

C1

UART Credits Rx

M

Write

C1

UART Credits Tx

M

Indicate

C1

GPIO Rx

O

Write without Response

C1

GPIO Tx

O

Notify

C1

Command and Configure In

O

Write

C1

Command and Configure Out

O

Notify

C1

Table 4-1: Terminal I/O Service Characteristics

C1: 如果需要安全性,应可通过验证写入。如果不需要安全性,则不需要任何安全权限。

C1: Shall be Writeable with Authentication, if security is required. Shall not require any security permissions, if security is not required.

3.1, UART Data

UART 数据特性用于在终端 I/O 设备之间传输串行数据。

用于写入和通知的值格式应设置为 UINT8 值数组。终端 I/O 设备应能接收 20 个 UINT8 值的数组。

特征 UUID 应设置为后面定义的分配给 "UART 数据 "的 UUID 值。

The UART Data characteristics shall be used to transfer serial data between Terminal I/O Devices.

The value format used for writes and notifications shall be set to an array of UINT8 values. A Terminal I/O Device shall be able to receive arrays of 20 UINT8 values.

The characteristic UUIDs shall be set to the UUID value assigned to «UART Data» as defined later.

Characteristic Behavior

当客户端特性配置描述符配置为通知,且终端 I/O 服务器上有串行数据时,应在连接中通知此特性。

在连接中,终端 I/O 客户端可将 UART 数据写入此特性。

When the Client Characteristic Configuration descriptor is configured for notifications and serial data is available on the Terminal I/O Server, this characteristic shall be notified while in a connection.

While in a connection, the Terminal I/O Client may write UART data to this characteristic.

3.2, UART Credits

终端 I/O UART credit特性用于发送和接收远程 UART credit。

UART 信用值的值格式为 UINT8。

一个 UART 点数代表一个可随时存储的指示或写入特性值。

特征 UUID 应设置为后面定义的分配给 "UART 点数 "的 UUID 值。

The Terminal I/O UART credits characteristics are used to send and receive remote UART Credits.

The value format for the UART credits value is UINT8.

One UART credit shall represent one indicate or write characteristic value that can be stored at all time.

The characteristic UUIDs shall be set to the UUID value assigned to «UART Credits» as defined later.

Characteristic Behavior

UART 信贷特性用于数据交换过程中的流量控制。

The UART Credits characteristic is used for flow control during data exchange.

3.3, GPIO State

终端 I/O GPIO 特性用于发送和接收 GPIO 状态变化。

GPIO 状态变化用 UINT32 表示,代表数据源的所有 GPIO 状态。激活信号解释为 1,非激活信号解释为 0。

举例说明 如果所有 GPIO 都处于非激活状态,而 GPIO 0 处于激活状态,则生成的 UINT32 值为 0x00000001。

特征 UUID 应设置为后面定义的分配给 "GPIO 状态 "的 UUID 值。

The Terminal I/O GPIO characteristics are used to send and receive GPIO state changes.

GPIO state changes are represented by values of UINT32 and represent all GPIO states of the data source. An active signal is interpreted as 1 and an inactive signal is interpreted as 0. GPIO 0 is the lowest bit of the UINT32 value

Example: If all GPIOs are inactive and GPIO 0 is turned active the resulting UINT32 value is 0x00000001.

The characteristic UUIDs shall be set to the UUID value assigned to «GPIO State» as defined later.

Characteristic Behavior

当客户端特性配置描述符配置为通知且至少有一个 GPIO 状态变化可用时,在连接中应通知此特性。

在连接中,终端 I/O 客户端可将输出 GPIO 状态变化写入此特性。

每个 GPIO 状态通知都应包括状态变化发生时所有输入 GPIO 的实际状态。这可确保 GPIO 状态可随时恢复。

When the Client Characteristic Configuration descriptor is configured for notifications and at least one GPIO state change is available, this characteristic shall be notified while in a connection.

While in a connection the Terminal I/O Client may write output GPIO state changes to this characteristic.

Every GPIO state notification shall include the actual state of all input GPIOs at the time the state change occurred. This ensures that the GPIO state can be recovered at all times.

3.4, Command and Configure

终端 I/O 命令和配置特性是通用特性,允许终端 I/O 客户端在已连接的终端 I/O 服务器上触发定义的事件。

写入命令和配置特性的命令值格式为 UINT16。表 4-2 列出了所有允许的命令。

特性 UUID 应设置为后面定义的分配给 "命令和配置 "的 UUID 值。

The Terminal I/O command and configure characteristics are general purpose characteristics that allows a Terminal I/O Client to trigger defined events on a connected Terminal I/O Server.

The value format for commands written to the command and configure characteristic is UINT16. All allowed commands are shown in Table 4-2.

The characteristic UUIDs shall be set to the UUID value assigned to «Command and Configure» as defined later.

Characteristic Behavior

终端 I/O 客户端应使用命令和配置特性来触发模块上定义的行为。

下表列出了允许用于配置终端 I/O 服务器或触发事件的命令。

The Command and Configure characteristic shall be used by the Terminal I/O Client to trigger defined behaviors on the module

The following table shows the allowed commands that can be used for configuring the Terminal I/O Server or trigger events.

Command

Op Code

Action

Disconnect

0x01000001

Triggers the Terminal I/O Server to initiate a disconnect. Can be used by devices that cannot do an immediate disconnect.

Table 4-2: Supported Commands for Command and Configure characteristic

4, APPENDIX

UUID Terminal I/O Service

0xFEFB

UUID Terminal I/O UART Rx characteristic

00000001-0000-1000-8000-008025000000

UUID Terminal I/O UART Tx characteristic

00000002-0000-1000-8000-008025000000

UUID Terminal I/O UART Rx Credits characteristic

00000003-0000-1000-8000-008025000000

UUID Terminal I/O UART Tx Credits characteristic

00000004-0000-1000-8000-008025000000

UUID Terminal I/O GPIO Rx characteristic

00000005-0000-1000-8000-008025000000

UUID Terminal I/O GPIO Tx characteristic

00000006-0000-1000-8000-008025000000

UUID Terminal I/O Command and Control In characteristic

00000007-0000-1000-8000-008025000000

UUID Terminal I/O Command and Control Out characteristic

00000008-0000-1000-8000-008025000000

UUID Terminal I/O UART Rx MTU size characteristic

00000009-0000-1000-8000-008025000000

UUID Terminal I/O UART Tx MTU size characteristic

0000000A-0000-1000-8000-008025000000

使用 `wget` 下载文件时出现 GnuTLS 在 `pull` 函数中出错、无法建立 SSL 连接的问题,通常是由网络环境、SSL 证书、GnuTLS 库等因素引起的。以下是一些可能的解决办法: #### 1. 检查网络连接和 DNS 配置 确保网络连接正常,并且 DNS 配置正确。可以尝试使用 `ping` 和 `nslookup` 命令进行测试: ```bash ping github.com nslookup github.com ``` 如果 DNS 配置有问题,可以修改 `/etc/resolv.conf` 文件,添加可靠的 DNS 服务器地址,例如 Google 的公共 DNS: ```plaintext nameserver 8.8.8.8 nameserver 8.8.4.4 ``` #### 2. 更新系统和软件包 有时候系统和软件包过旧可能会导致 SSL 连接问题。可以使用以下命令更新系统和软件包: ```bash sudo apt update sudo apt upgrade ``` 对于基于 Red Hat 的系统,可以使用以下命令: ```bash sudo yum update ``` #### 3. 绕过 SSL 验证(不推荐用于生产环境) 在测试环境中,可以尝试绕过 SSL 验证。使用 `--no-check-certificate` 选项: ```bash wget --no-check-certificate https://github.com/dushixiang/next-terminal/releases/latest/download/next-terminal.tar.gz ``` 但这种方法存在安全风险,因为它会忽略 SSL 证书的有效性检查,可能会使你暴露在中间人攻击的风险中。 #### 4. 检查和更新 GnuTLS 库 GnuTLS 库可能存在版本过低或损坏的情况。可以尝试更新 GnuTLS 库: ```bash sudo apt install --only-upgrade gnutls-bin gnutls28-dev ``` 对于基于 Red Hat 的系统: ```bash sudo yum update gnutls ``` #### 5. 清除 DNS 缓存 有时候 DNS 缓存可能会导致解析问题。可以使用以下命令清除 DNS 缓存: ```bash sudo systemd-resolve --flush-caches ``` #### 6. 使用代理 如果网络环境需要使用代理,可以设置代理参数: ```bash export http_proxy=http://your_proxy_server:port export https_proxy=http://your_proxy_server:port wget https://github.com/dushixiang/next-terminal/releases/latest/download/next-terminal.tar.gz ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜流冰

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

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

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

打赏作者

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

抵扣说明:

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

余额充值