Code Monkey home page Code Monkey logo

qmlqmqtt's Introduction

首先需要编译qmqtt库 然后再编译该插件 Sourcecode taken from:

编译步骤

  1. 进入根目录
  2. qmake
  3. mingw32-make
  4. mingw32-make install

使用

import QmlQMQTT 1.0

QmlQMQTT {
    id:qmlqmqtt
    _hostName:'mqtt.huikezk.com'
    _clientId: 'qml_ttttt'
    _username:'admin'
    _password:'123456'
    _autoReconnect:true
    _cleanSession: true
    onConnected: {
        qmlqmqtt.subscribe("/北京华联回龙观/#");

    }
    onQmlreceived: {
            console.log("topic:",topic)
            console.log("payload:",message)
    }
    Component.onCompleted: qmlqmqtt.connectToHost()
}

增加 信号 onQmlreceived(topic, message) 增加 函数 qmlpublish(const QString &topic, const QString &message, const int qos, const bool retain)

其他函数和qmqtt一样, 本例没有导入其他类型 所以只能使用string 等基本类型, 如果有特殊需要可以更改例子自己编译安装

qmlqmqtt's People

Contributors

changzhiming avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.