TpBluetoothServer 类
V0.2.1TpExtUtils
2025-11-14
基础信息
| 头文件: | include <TpBluetoothServer.h> |
|---|---|
| Cmake: | None |
| 发布版本: | V0.2.1 |
| 继承类: | |
| 派生类: |
信号
| 信号名称 | 参数 | 描述 |
|---|---|---|
| newConnection |
Public 成员函数
| TpBluetoothServer(const TpString &name, TpBluetoothService::Protocol type) | ||
|---|---|---|
| ~TpBluetoothServer() | ||
| close() | 关闭服务端 | |
| setMaxPendingConnects(tpInt32 max) | 设置最大可以连接的数量,需要在监听之前调用 | |
| getMaxPendingConnects() | 获取最大可连接的数量 | |
| listen(const TpBluetoothAddress &addr=TpBluetoothAddress(), tpUInt16 port=0) | 开始监听客户端连接 | |
| listen(const TpString &uuid) | 开始监听客户端连接 | |
| getServerPort() | 获取服务端蓝牙端口 | |
| TpBluetoothAddress | getServerAddress() | 获取服务端蓝牙地址 |
| TpBluetoothService::Protocol | getServerType() | 获取服务端协议类型 |
| isListening() | 查看当前是否在监听 | |
| TpBluetoothSocket * | nextPendingConnection() | 获取下一个可用连接 |
成员函数说明
TpBluetoothServer::TpBluetoothServer(const TpString &name, TpBluetoothService::Protocol type)
暂无注释...
TpBluetoothServer::~TpBluetoothServer()
暂无注释...
tpInt32 TpBluetoothServer::close()
关闭服务端...
关闭服务端
返回值:返回0
void TpBluetoothServer::setMaxPendingConnects(tpInt32 max)
设置最大可以连接的数量,需要在监听之前调用...
设置最大可以连接的数量,需要在监听之前调用
参数:max: 最大连接数量
tpInt32 TpBluetoothServer::getMaxPendingConnects()
获取最大可连接的数量...
获取最大可连接的数量
返回值:
tpBool TpBluetoothServer::listen(const TpBluetoothAddress &addr=TpBluetoothAddress(), tpUInt16 port=0)
开始监听客户端连接...
开始监听客户端连接
参数:addr:
参数:port: 非传统意义上的端口,当RFCOMM时表示channel,当使用L2CAP时表示psm。未来可能扩展其他协议
返回值:
tpBool TpBluetoothServer::listen(const TpString &uuid)
开始监听客户端连接...
开始监听客户端连接
参数:uuid: profile类型
返回值:
tpUInt16 TpBluetoothServer::getServerPort()
获取服务端蓝牙端口...
获取服务端蓝牙端口
返回值:
TpBluetoothAddress TpBluetoothServer::getServerAddress()
获取服务端蓝牙地址...
获取服务端蓝牙地址
返回值:
TpBluetoothService::Protocol TpBluetoothServer::getServerType()
获取服务端协议类型...
获取服务端协议类型
返回值:
tpBool TpBluetoothServer::isListening()
查看当前是否在监听...
查看当前是否在监听
返回值:返回监听状态
TpBluetoothSocket * TpBluetoothServer::nextPendingConnection()
获取下一个可用连接...
获取下一个可用连接
返回值:
