本文整理汇总了C++中Notification::getAppName方法的典型用法代码示例。如果您正苦于以下问题:C++ Notification::getAppName方法的具体用法?C++ Notification::getAppName怎么用?C++ Notification::getAppName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::getAppName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Receive
void NotificationReceiverTestImpl::Receive(Notification const& notification) {
qcc::String appName = notification.getAppName();
// If applications list is empty or the name exists in the filter list then print the notification
if ((m_Applications.size() == 0) || (find(m_Applications.begin(), m_Applications.end(), appName) != m_Applications.end())) {
std::cout << "******************** Begin New Message Received ********************" << std::endl;
std::cout << "Message Id: " << notification.getMessageId() << std::endl;
std::cout << "Device Id: " << notification.getDeviceId() << std::endl;
std::cout << "Device Name: " << notification.getDeviceName() << std::endl;
std::cout << "App Id: " << notification.getAppId() << std::endl;
std::cout << "App Name: " << notification.getAppName() << std::endl;
std::cout << "Sender BusName: " << notification.getSenderBusName() << std::endl;
std::cout << "Message Type " << notification.getMessageType() << " " << MessageTypeUtil::getMessageTypeString(notification.getMessageType()).c_str() << std::endl;
std::cout << "Notification version: " << notification.getVersion() << std::endl;
// get vector of text messages and iterate through it
std::vector<NotificationText> vecMessages = notification.getText();
for (std::vector<NotificationText>::const_iterator vecMessage_it = vecMessages.begin(); vecMessage_it != vecMessages.end(); ++vecMessage_it) {
std::cout << "Language: " << vecMessage_it->getLanguage().c_str() << " Message: " << vecMessage_it->getText().c_str() << std::endl;
}
// Print out any other parameters sent in
std::cout << "Other parameters included:" << std::endl;
std::map<qcc::String, qcc::String> customAttributes = notification.getCustomAttributes();
for (std::map<qcc::String, qcc::String>::const_iterator customAttributes_it = customAttributes.begin(); customAttributes_it != customAttributes.end(); ++customAttributes_it) {
std::cout << "Custom Attribute Key: " << customAttributes_it->first.c_str() << " Custom Attribute Value: " << customAttributes_it->second.c_str() << std::endl;
}
if (notification.getRichIconUrl()) {
std::cout << "Rich Content Icon Url: " << notification.getRichIconUrl() << std::endl;
}
// get vector of audio content and iterate through it
std::vector<RichAudioUrl> richAudioUrl = notification.getRichAudioUrl();
if (!richAudioUrl.empty()) {
std::cout << "******************** Begin Rich Audio Content ********************" << std::endl;
for (std::vector<RichAudioUrl>::const_iterator vecAudio_it = richAudioUrl.begin(); vecAudio_it != richAudioUrl.end(); ++vecAudio_it) {
std::cout << "Language: " << vecAudio_it->getLanguage().c_str() << " Audio Url: " << vecAudio_it->getUrl().c_str() << std::endl;
}
std::cout << "******************** End Rich Audio Content ********************" << std::endl;
}
if (notification.getRichIconObjectPath()) {
std::cout << "Rich Content Icon Object Path: " << notification.getRichIconObjectPath() << std::endl;
}
if (notification.getRichAudioObjectPath()) {
std::cout << "Rich Content Audio Object Path: " << notification.getRichAudioObjectPath() << std::endl;
}
if (notification.getControlPanelServiceObjectPath()) {
std::cout << "ControlPanelService object path: " << notification.getControlPanelServiceObjectPath() << std::endl;
}
if (notification.getOriginalSender()) {
std::cout << "OriginalSender: " << notification.getOriginalSender() << std::endl;
}
std::cout << "******************** End New Message Received ********************" << std::endl << std::endl;
Notification nonConstNotification(notification);
if (m_WaitForExternalNotificationAction) {
#ifdef _WIN32
EnterCriticalSection(&m_Lock);
SleepConditionVariableCS(&m_Condition, &m_Lock, INFINITE);
#else
pthread_mutex_lock(&m_Lock);
pthread_cond_wait(&m_Condition, &m_Lock);
#endif
} else {
std::cout << "Notification action (0-Nothing 1-Dismiss):" << std::endl;
int32_t notificationAction(ACTION_NOTHING);
int retScan = scanf("%d", ¬ificationAction);
if (retScan != EOF) {
m_NotificationAction = static_cast<NotificationAction>(notificationAction);
}
}
switch (GetNotificationAction()) {
case ACTION_NOTHING:
std::cout << "Nothing planed to do with the notification message id:" << nonConstNotification.getMessageId() << std::endl;
break;
case ACTION_DISMISS:
{
std::cout << "going to call dismiss for message id:" << nonConstNotification.getMessageId() << std::endl;
nonConstNotification.dismiss();
}
break;
default:
std::cout << "Got non valid action to do:" << GetNotificationAction() << std::endl;
break;
}
//.........这里部分代码省略.........