TpBluetoothLocal 类
V0.2.1TpExtUtils
2025-11-14
介绍
可以对本地蓝牙设备进行管理
基础信息
| 头文件: | include <TpBluetoothLocal.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | |
| 派生类: |
Public 类型
enum TpBluetoothLocal::TpLocalPair
| 名称 | 值 | 描述 |
|---|---|---|
| TP_LOCAL_PAIRED | 0 | |
| TP_LOCAL_UNPAIRED | 1 | |
| TP_LOCAL_AUTHORIZED_PAIRED | 2 |
Public 成员函数
| TpBluetoothLocal(int id, const char *address, const char *name) | ||
|---|---|---|
| TpBluetoothLocal(const char *name) | ||
| TpBluetoothLocal(const TpString &name) | ||
| TpBluetoothLocal(TpBluetoothLocal &other) | ||
| TpBluetoothLocal(TpBluetoothLocal &&other) | ||
| ~TpBluetoothLocal() | ||
| TpString | getName() | 获取蓝牙名字 |
| setName(const TpString &name) | ||
| TpBluetoothAddress | getAddress() | 获取蓝牙地址 |
| TpList< TpBluetoothAddress > | getPairedDevices() | 获取以配对的设备列表 |
| TpList< TpBluetoothAddress > | getConnectedDevices() | 获取已连接的设备列表 |
| connectToDevice(const TpBluetoothAddress &addr) | 和远程的蓝牙设备建立物理连接 | |
| disconnectToDevice(const TpBluetoothAddress &addr) | 和远程的蓝牙设备断开物理连接 | |
| setTrusted(TpBluetoothAddress &address, tpBool trusted) | 设置远程蓝牙设备的信任状态 | |
| requestPairing(TpBluetoothAddress &address, TpBluetoothLocal::TpLocalPair pair) | 设置蓝牙配对请求 | |
| TpBluetoothLocal::TpLocalPair | getPairStatus(TpBluetoothAddress &address) | 获取配对状态 |
| removeDevice(TpBluetoothAddress &address) | ||
| setDiscoverable(tpBool discoverable) | 设置蓝牙可见性 | |
| setDiscoverableTimeout(tpUInt32 timeout) | 设置蓝牙可见的超时时间 | |
| TpList< TpBluetoothUuid > | getUuids() | 获取本机蓝牙上所有注册的UUID |
| isHaveUuid(TpBluetoothUuid &uuid) | 是否已经有某个服务(若想获取该uuid的具体注册信息需要使用服务扫描) | |
| isPowerOn() | 本机蓝牙是否打开 | |
| powerOn() | 打开蓝牙 | |
| powerOff() | 关闭蓝牙 | |
| getHostMode() | ||
| setHostMode() | ||
| static TpList< TpBluetoothLocal > TpBluetoothLocal::getAllDevice | getAllDevice() | 获取所有适配器列表 |
成员函数说明
TpBluetoothLocal::TpBluetoothLocal(int id, const char *address, const char *name)
暂无注释...
TpBluetoothLocal::TpBluetoothLocal(const char *name)
暂无注释...
TpBluetoothLocal::TpBluetoothLocal(const TpString &name)
暂无注释...
TpBluetoothLocal::TpBluetoothLocal(TpBluetoothLocal &other)
暂无注释...
TpBluetoothLocal::TpBluetoothLocal(TpBluetoothLocal &&other)
暂无注释...
TpBluetoothLocal::~TpBluetoothLocal()
暂无注释...
TpString TpBluetoothLocal::getName()
获取蓝牙名字...
获取蓝牙名字
返回值:
int TpBluetoothLocal::setName(const TpString &name)
暂无注释...
TpBluetoothAddress TpBluetoothLocal::getAddress()
获取蓝牙地址...
获取蓝牙地址
返回值:
TpList< TpBluetoothAddress > TpBluetoothLocal::getPairedDevices()
获取以配对的设备列表...
获取以配对的设备列表
返回值:
TpList< TpBluetoothAddress > TpBluetoothLocal::getConnectedDevices()
获取已连接的设备列表...
获取已连接的设备列表
返回值:
int TpBluetoothLocal::connectToDevice(const TpBluetoothAddress &addr)
和远程的蓝牙设备建立物理连接...
和远程的蓝牙设备建立物理连接
参数:addr:
返回值:
int TpBluetoothLocal::disconnectToDevice(const TpBluetoothAddress &addr)
和远程的蓝牙设备断开物理连接...
和远程的蓝牙设备断开物理连接
参数:addr:
返回值:
int TpBluetoothLocal::setTrusted(TpBluetoothAddress &address, tpBool trusted)
设置远程蓝牙设备的信任状态...
设置远程蓝牙设备的信任状态
参数:address: 远程设备地址
参数:trusted: 信任/不信任
返回值:
int TpBluetoothLocal::requestPairing(TpBluetoothAddress &address, TpBluetoothLocal::TpLocalPair pair)
设置蓝牙配对请求...
设置蓝牙配对请求
参数:address: 远程蓝牙的地址
参数:pair: 配对状态(手动授权配对/取消配对/自动授权配对)
返回值:
TpBluetoothLocal::TpLocalPair TpBluetoothLocal::getPairStatus(TpBluetoothAddress &address)
获取配对状态...
获取配对状态
参数:address: 远程蓝牙的地址
返回值:
int TpBluetoothLocal::removeDevice(TpBluetoothAddress &address)
暂无注释...
int TpBluetoothLocal::setDiscoverable(tpBool discoverable)
设置蓝牙可见性...
设置蓝牙可见性
参数:discoverable: 可见/不可见
返回值:
int TpBluetoothLocal::setDiscoverableTimeout(tpUInt32 timeout)
设置蓝牙可见的超时时间...
设置蓝牙可见的超时时间
参数:timeout: 超时时间
返回值:
TpList< TpBluetoothUuid > TpBluetoothLocal::getUuids()
获取本机蓝牙上所有注册的UUID...
获取本机蓝牙上所有注册的UUID
返回值:
tpBool TpBluetoothLocal::isHaveUuid(TpBluetoothUuid &uuid)
是否已经有某个服务(若想获取该uuid的具体注册信息需要使用...
是否已经有某个服务(若想获取该uuid的具体注册信息需要使用服务扫描)
参数:uuid: uuid值
返回值:
tpBool TpBluetoothLocal::isPowerOn()
本机蓝牙是否打开...
本机蓝牙是否打开
返回值:
int TpBluetoothLocal::powerOn()
打开蓝牙...
打开蓝牙
返回值:
int TpBluetoothLocal::powerOff()
关闭蓝牙...
关闭蓝牙
返回值:
int TpBluetoothLocal::getHostMode()
暂无注释...
int TpBluetoothLocal::setHostMode()
暂无注释...
static TpList< TpBluetoothLocal > TpBluetoothLocal::getAllDevice()
获取所有适配器列表...
获取所有适配器列表
返回值:
