|
CodexPad Arduino 库 4.1.0
|
Client主类 更多...
#include <client.h>
Public 成员函数 | |
| Client () noexcept | |
| 构造函数 | |
| ~Client () noexcept | |
| 析构函数 | |
| void | Init (int8_t local_tx_power=3) noexcept |
| 初始化 | |
| bool | Connect (const std::string &bluetooth_device_address, uint32_t timeout_ms=5000) noexcept |
| 连接 | |
| bool | ScanAndConnect (gamepad::input::Button buttons) noexcept |
| 扫描附近的 CodexPad 设备,并自动连接到一个按键状态与指定掩码匹配的设备。 | |
| void | Disconnect () noexcept |
| 断开连接 | |
| const gamepad::input::Tracker & | Update () noexcept |
| 更新,需要在Loop中不断调用 | |
| bool | is_connected () const noexcept |
| 是否连接 | |
| const std::string & | remote_device_name () const noexcept |
| 获取CodexPad的型号 | |
| const std::string & | remote_model_number () const noexcept |
| 获取CodexPad的型号 | |
| const std::array< uint8_t, 3 > & | remote_firmware_version () const noexcept |
| 获取CodexPad的固件版本 | |
| const gamepad::input::Tracker & | input_tracker () const noexcept |
| 获取输入跟踪器对象 | |
| int32_t | rssi () const noexcept |
| 获取CodexPad的RSSI | |
| NimBLEClient * | ble_client () const noexcept |
| 获取 BLE 客户端对象 | |
Client主类
|
noexcept |
构造函数
在文件 client.cpp 第 37 行定义.
|
noexcept |
析构函数
在文件 client.cpp 第 39 行定义.
|
inlinenoexcept |
获取 BLE 客户端对象
此函数返回内部 BLE 客户端对象的指针。调用者不应尝试释放/删除它。
|
noexcept |
连接
| [in] | bluetooth_device_address | CodexPad的蓝牙设备地址(BD_ADDR),格式为"XX:XX:XX:XX:XX:XX",X为数字或者大写字母, 半角冒号分隔 |
| [in] | timeout_ms | 超时时间,单位毫秒 |
| true | 连接成功 |
| false | 连接失败 |
在文件 client.cpp 第 48 行定义.
|
noexcept |
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
获取CodexPad的型号
|
inlinenoexcept |
获取CodexPad的固件版本
|
inlinenoexcept |
获取CodexPad的型号
|
noexcept |
|
noexcept |
扫描附近的 CodexPad 设备,并自动连接到一个按键状态与指定掩码匹配的设备。
此方法会主动扫描蓝牙设备。当发现一个或多个 CodexPad 设备,其当前按键状态与提供的 button_mask 完全匹配时,它将尝试建立连接。 如果附近有多个设备都符合按键掩码,则会选择信号最强(RSSI 值最大)的设备进行连接。
| [in] | button_mask | 用于匹配目标设备按键状态的32位按钮掩码。 使用 ButtonMask() 函数来组合多个 Button 枚举值。 |
| true | 连接成功(找到了符合按键掩码的设备并成功连接)。 |
| false | 连接失败(未找到匹配设备或连接尝试失败)。 |
Button::kHome。按住 Home 键会触发设备重启,这将中断连接过程。 示例: 在文件 client.cpp 第 59 行定义.
|
noexcept |
更新,需要在Loop中不断调用
在文件 client.cpp 第 118 行定义.