当前位置: 首页>>代码示例>>C++>>正文


C++ JoynrMessage::getType方法代码示例

本文整理汇总了C++中JoynrMessage::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ JoynrMessage::getType方法的具体用法?C++ JoynrMessage::getType怎么用?C++ JoynrMessage::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JoynrMessage的用法示例。


在下文中一共展示了JoynrMessage::getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processReceivedJsonObjects

void LongPollingMessageReceiver::processReceivedJsonObjects(const std::string& jsonObject)
{
    JoynrMessage* msg = JsonSerializer::deserialize<JoynrMessage>(jsonObject);
    if (msg == nullptr) {
        JOYNR_LOG_ERROR(logger, "Unable to deserialize message. Raw message: {}", jsonObject);
        return;
    }
    if (msg->getType().empty()) {
        JOYNR_LOG_ERROR(logger, "received empty message - dropping Messages");
        return;
    }
    if (!msg->containsHeaderExpiryDate()) {
        JOYNR_LOG_ERROR(logger,
                        "received message [msgId=[{}] without decay time - dropping message",
                        msg->getHeaderMessageId());
    }

    if (msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST ||
        msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST ||
        msg->getType() == JoynrMessage::VALUE_MESSAGE_TYPE_BROADCAST_SUBSCRIPTION_REQUEST) {
        // TODO ca: check if replyTo header info is available?
        std::string replyChannelId = msg->getHeaderReplyChannelId();
        std::shared_ptr<system::RoutingTypes::ChannelAddress> address(
                new system::RoutingTypes::ChannelAddress(replyChannelId));
        messageRouter->addNextHop(msg->getHeaderFrom(), address);
    }

    // messageRouter.route passes the message reference to the MessageRunnable, which copies it.
    // TODO would be nicer if the pointer would be passed to messageRouter, on to MessageRunnable,
    // and runnable should delete it.
    messageRouter->route(*msg);
    delete msg;
}
开发者ID:icyerasor,项目名称:joynr,代码行数:33,代码来源:LongPollingMessageReceiver.cpp

示例2: checkParticipantIDs

TEST_F(JoynrMessageFactoryTest, createPublication){
    JoynrMessage joynrMessage = messageFactory.createSubscriptionPublication(
                senderID,
                receiverID,
                qos,
                subscriptionPublication
    );
    checkParticipantIDs(joynrMessage);
    checkSubscriptionPublication(joynrMessage);
    EXPECT_QSTREQ(JoynrMessage::VALUE_MESSAGE_TYPE_PUBLICATION, joynrMessage.getType());
}
开发者ID:alienscience,项目名称:joynr,代码行数:11,代码来源:JoynrMessageFactoryTest.cpp

示例3: subscriptionId

TEST_F(JoynrMessageFactoryTest, createSubscriptionStop){
    QString subscriptionId("TEST-SubscriptionId");
    SubscriptionStop subscriptionStop;
    subscriptionStop.setSubscriptionId(subscriptionId);
    JoynrMessage joynrMessage = messageFactory.createSubscriptionStop(
                senderID,
                receiverID,
                qos,
                subscriptionStop
    );
    checkParticipantIDs(joynrMessage);
    EXPECT_QSTREQ(JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_STOP, joynrMessage.getType());
}
开发者ID:alienscience,项目名称:joynr,代码行数:13,代码来源:JoynrMessageFactoryTest.cpp

示例4: onTextMessageReceived

void WebSocketLibJoynrMessagingSkeleton::onTextMessageReceived(const std::string& message)
{
    // deserialize message and transmit
    JoynrMessage* joynrMsg = JsonSerializer::deserialize<JoynrMessage>(message);
    if (joynrMsg == nullptr || joynrMsg->getType().empty()) {
        JOYNR_LOG_ERROR(logger, "Unable to deserialize joynr message object from: {}", message);
        return;
    }
    JOYNR_LOG_TRACE(logger, "<<< INCOMING <<< {}", message);
    // message router copies joynr message when scheduling thread that handles
    // message delivery
    transmit(*joynrMsg);
    delete joynrMsg;
}
开发者ID:icyerasor,项目名称:joynr,代码行数:14,代码来源:WebSocketLibJoynrMessagingSkeleton.cpp

示例5: OnChangeSubscriptionQos

TEST_F(JoynrMessageFactoryTest, createSubscriptionRequest){
    auto subscriptionQos = QSharedPointer<SubscriptionQos>(new OnChangeSubscriptionQos());
    SubscriptionRequest subscriptionRequest;
    subscriptionRequest.setSubscriptionId(QString("subscriptionId"));
    subscriptionRequest.setAttributeName(QString("attributeName"));
    subscriptionRequest.setQos(subscriptionQos);
    JoynrMessage joynrMessage = messageFactory.createSubscriptionRequest(
                senderID,
                receiverID,
                qos,
                subscriptionRequest
    );
    checkParticipantIDs(joynrMessage);
    EXPECT_QSTREQ(JoynrMessage::VALUE_MESSAGE_TYPE_SUBSCRIPTION_REQUEST, joynrMessage.getType());
}
开发者ID:alienscience,项目名称:joynr,代码行数:15,代码来源:JoynrMessageFactoryTest.cpp

示例6: QString

TEST_F(JoynrMessageFactoryTest, createRequest){
    JoynrMessage joynrMessage = messageFactory.createRequest(
                senderID,
                receiverID,
                qos,
                request
    );
    //warning if prepareRequest needs to long this assert will fail as it compares absolute timestamps
    QDateTime expectedExpiryDate = QDateTime::currentDateTime().addMSecs(qos.getTtl());
    QDateTime expiryDate = joynrMessage.getHeaderExpiryDate();
    EXPECT_NEAR(expectedExpiryDate.toMSecsSinceEpoch(), expiryDate.toMSecsSinceEpoch(), 100.);
    LOG_DEBUG(logger,
              QString("expiryDate: %1 [%2]")
              .arg(expiryDate.toString())
              .arg(expiryDate.toMSecsSinceEpoch()));
    LOG_DEBUG(logger,
              QString("expectedExpiryDate: %1 [%2]")
              .arg(expectedExpiryDate.toString())
              .arg(expectedExpiryDate.toMSecsSinceEpoch()));

    checkParticipantIDs(joynrMessage);
    checkRequest(joynrMessage);
    EXPECT_QSTREQ(JoynrMessage::VALUE_MESSAGE_TYPE_REQUEST, joynrMessage.getType());
}
开发者ID:alienscience,项目名称:joynr,代码行数:24,代码来源:JoynrMessageFactoryTest.cpp


注:本文中的JoynrMessage::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。