# thmar **Repository Path**: l0km/thmar ## Basic Information - **Project Name**: thmar - **Description**: thrift mqtt agent(thmar)提供基于MQTT消息系统thrift RPC调用抽象化实现。 - **Primary Language**: Unknown - **License**: BSD-2-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-08-21 - **Last Updated**: 2024-09-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # thmar thrift mqtt agent(thmar)提供基于MQTT消息系统thrift RPC调用抽象化实现。 默认提供基于 `paho-mqtt-c`的MQTT客户端的实现 ## 代码下载 ```bash git clone https://gitee.com/l0km/thmar.git ``` ## Conan 2 thmar使用[Conan](https://conan.io/) 2管理依赖库,所以使用前务必有Conan 2环境. ## 依赖库 thmar依赖[common_source_cpp: 公用的C/C++11代码 (gitee.com)](https://gitee.com/l0km/common_source_cpp)项目. 执行编译前需要如下将此项目安装到Conan本地仓库 ```bash git clone https://gitee.com/l0km/common_source_cpp.git -b common_source_cpp-1.0.2 conan create . ``` ## 编译 thmar使用Conan 2管理依赖库,执行conan create 命令即完成编译,并安装到Conan本地仓库 ```bash conan create . ``` 如果要安装到非conan 本地仓库,执行`./gnu_build.sh`则完成编译安装到release文件夹下。 ## ThmarMqttClient ThmarMqttClient 是MQTT客户端抽象化封装,提供了MQTT客户端的基本操作,包括连接、订阅、发布等。 ## PahoMqttClient PahoMqttClient 继承自ThmarMqttClient, 是基于 `paho-mqtt-c` 实现的MQTT客户端,提供了MQTT客户端的基本操作,包括连接、订阅、发布等。 ## 消息订阅示例 参见 [unittest/paho_subasync_test.cpp](unittest/paho_subasync_test.cpp) ### 消息发布示例 参见 [unittest/paho_publish_test.cpp](unittest/paho_publish_test.cpp) ## MqInvoker MqInvoker基于ThmarMqttClient实现与thrift RPC服务的调用交互。 示例参见 [unittest/mqinvoker_addDevice_test.cpp](unittest/mqinvoker_addDevice_test.cpp)和 [unittest/mqinvoker_getDevice_test.cpp](unittest/mqinvoker_addDevice_test.cpp)