示例#1
0
void MqttBridge::received(const QMQTT::Message &message){
    //Now we have to pass on the different command to the DBUS command
    //That will be done by emitting signals, as we have no
    //knowlege of the dBus class, We will try to have a clean interface

    qDebug()<<"Message Topic and payload "<<message.topic() << message.payload();
    if      (message.topic()==mediaPlayCommand) emit setPlay();
    else if (message.topic()==mediaNextCommand) emit setNext();
    else if (message.topic()==mediaPrevCommand) emit setPrevious();
    else if (message.topic()==mediaVolumeCommand) {
        double volume = message.payload().toDouble()/100;
        emit setVolume(volume);
        }
    else if (message.topic()==mediaPlayIdCommand) {
     QDBusObjectPath _path;
     _path.setPath(message.payload());
     emit setPlayId(_path);
    }
    else if (message.topic()==mediaPlayPauseCommand) emit setPlayPause();
    else if (message.topic()==mediaRepeatCommand){
        if (message.payload()=="0") emit setLoop("None");
        else emit setLoop("Playlist");
    }
    else if (message.topic()==mediaMixCommand){
     if (message.payload()=="0") emit setShuffle(false);
     else emit setShuffle(true);
    }



}
示例#2
0
void MainWindow::onMQTT_Received(const QMQTT::Message &message)
{
    if(message.topic()==DEV1S){
        ui->d1v->display(message.payload().toInt());
    }
    qDebug() << QString::fromUtf8(message.payload());
}
示例#3
0
TEST_F(MessageTest, assignmentOperator_Test)
{
    QMQTT::Message originalMessage(5, "topic", "payload", 5, true, true);
    QMQTT::Message copy;

    copy = originalMessage;

    EXPECT_EQ(5, copy.id());
    EXPECT_EQ(5, copy.qos());
    EXPECT_TRUE(copy.retain());
    EXPECT_TRUE(copy.dup());
    EXPECT_EQ(QString("topic"), copy.topic());
    EXPECT_EQ(QByteArray("payload"), copy.payload());
}
示例#4
0
void MainWindow::onMQTT_Received(const QMQTT::Message &message)
{
    log(tr("message recevied from %1: qos=%2").arg(message.topic()).arg(message.qos()));
    log(message.payload());
}
示例#5
0
void MainWindow::onMQTT_Published(QMQTT::Message &message)
{
    log(tr("message published to %1").arg(message.topic()));
    log(message.payload());
}