ALNotificationManager API

NAOqi Core - Overview | API | NotificationInfo


Namespace : AL


#include <alproxies/alnotificationmanagerproxy.h>

Method Group list

As any module, this module inherits methods from ALModule API. It also has the following specific methods:

class ALNotificationManagerProxy

Event list

int ALNotificationManagerProxy::add(const AL::ALValue& notification)

Adds a new Notification. As soon as it is added, the event notificationAdded() is raised.

Parameters:
  • notification – The notification contained in an ALValue (see NotificationInfo).
Returns:

The notification identifier.

add-notif.py


# -*- encoding: UTF-8 -*-
#!/usr/bin/env python

from naoqi import ALProxy

ROBOT_IP = "127.0.0.1"

alnotificationmanager = ALProxy("ALNotificationManager", ROBOT_IP, 9559)

notificationId = alnotificationmanager.add({"message": "Hello World!", "severity": "info", "removeOnRead": True})

print "Notification ID: " + str(notificationId)

void ALNotificationManagerProxy::remove(const int& notificationId)

Removes a Notification. As soon as it is removed, the event notificationRemoved() is raised.

Parameters:
  • notificationId – Identifier of the notification to remove.

remove-notif.py


# -*- encoding: UTF-8 -*- 
#!/usr/bin/env python

from naoqi import ALProxy

ROBOT_IP = "127.0.0.1"

alnotificationmanager = ALProxy("ALNotificationManager", ROBOT_IP, 9559)

# add new notification
notificationId = alnotificationmanager.add({"message": "Hello World!", "severity": "info", "removeOnRead": True})

print "Notification ID: " + str(notificationId)

# delete the notification
alnotificationmanager.remove(notificationId)

AL::ALValue ALNotificationManagerProxy::notification(const int& notificationId)

Returns the NotificationInfo corresponding to the given notification identifier. The notification is represented as an ALValue (see NotificationInfo).

Parameters:
  • notificationId – Identifier of the notification.
Returns:

The notificationInfo of the given notification identifier.

Throw :

An ALError, if the identifier doesn’t exist.

AL::ALValue ALNotificationManagerProxy::notifications()

Returns the list of pending NotificationInfos.

Returns: An array of NotificationInfos contained in an ALValue (see NotificationInfo).

print-notif.py


# -*- encoding: UTF-8 -*- 
#!/usr/bin/env python

from naoqi import ALProxy

ROBOT_IP = "127.0.0.1"

alnotificationmanager = ALProxy("ALNotificationManager", ROBOT_IP, 9559)
notifications = alnotificationmanager.notifications()

for notification in notifications:
    notifDict = dict(notification)
    print "Notification ID: " + str(notifDict["id"])
    print "\tMessage: " + notifDict["message"]
    print "\tSeverity: " + notifDict["severity"]
    print "\tRemove On Read: " + str(notifDict["removeOnRead"])
    print "-----------\n"

ALNotificationManagerProxy Events

Event: "notificationAdded"
callback(std::string eventName, int notificationId, std::string subscriberIdentifier)

Raised when a new notification has been added.

Parameters:
  • eventName (std::string) – “notificationAdded”
  • notificationId – The identifier of the added notification.
  • subscriberIdentifier (std::string) –
Event: "notificationRemoved"
callback(std::string eventName, int notificationId, std::string subscriberIdentifier)

Raised when a notification has been removed. It can be discarded either if it is read or not valid anymore.

Parameters:
  • eventName (std::string) – “notificationRemoved”
  • notificationId – The identifier of the removed notification.
  • subscriberIdentifier (std::string) –