本文整理汇总了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;
}
示例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());
}
示例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());
}
示例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;
}
示例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());
}
示例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());
}