本文整理汇总了C++中JoynrMessage::setPayload方法的典型用法代码示例。如果您正苦于以下问题:C++ JoynrMessage::setPayload方法的具体用法?C++ JoynrMessage::setPayload怎么用?C++ JoynrMessage::setPayload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JoynrMessage
的用法示例。
在下文中一共展示了JoynrMessage::setPayload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ccMessagingAddress
TEST_F(LibJoynrDbusCommunicationTests, transmit_message) {
QString ccMessagingAddress("local:joynr.messaging:cc.message6");
// register skeletons
MockMessaging* msgMock = new MockMessaging();
EXPECT_CALL(*msgMock, transmit(A<JoynrMessage&>())).Times(1);
auto msgSkeleton = new IDbusSkeletonWrapper<DbusMessagingSkeleton, IMessaging>(*msgMock, ccMessagingAddress);
// get stub
DbusMessagingStubAdapter* msgStub = new DbusMessagingStubAdapter(ccMessagingAddress);
ASSERT_TRUE(msgStub->isProxyAvailable());
// create message
JoynrMessage msg;
msg.setType(JoynrMessage::VALUE_MESSAGE_TYPE_ONE_WAY);
msg.setHeaderTo(QString("local"));
msg.setPayload("This is a test");
// create messaging qos
msgStub->transmit(msg);
// delete skeleton
delete msgSkeleton;
// error on transmission
msgStub->transmit(msg);
// stub not availabe
ASSERT_FALSE(msgStub->isProxyAvailable());
delete msgStub;
delete msgMock;
}
示例2: initMsg
void JoynrMessageFactory::initMsg(JoynrMessage& msg,
const std::string& senderParticipantId,
const std::string& receiverParticipantId,
const std::int64_t ttl,
const std::string& payload) const
{
msg.setHeaderCreatorUserId(securityManager->getCurrentProcessUserId());
msg.setHeaderFrom(senderParticipantId);
msg.setHeaderTo(receiverParticipantId);
// calculate expiry date
JoynrTimePoint expiryDate = DispatcherUtils::convertTtlToAbsoluteTime(ttl);
msg.setHeaderExpiryDate(expiryDate);
// add content type and class
msg.setHeaderContentType(JoynrMessage::VALUE_CONTENT_TYPE_APPLICATION_JSON);
// set payload
msg.setPayload(payload);
}