ALNotificationManager

NAOqi Core - Overview | API | NotificationInfo


What it does

The ALNotificationManager module provides methods to manage notifications on the robot.

What is a notification

A notification is a short message sent to the end-user by the robot system or by an application.
For further details, see: ALValue NotificationInfo.

How it works

When an application sends a notification:

  • It is appended to the list of pending notifications.
  • The End user is informed that there is a pending notification and can ask the robot to read it. For further details, see: Event and state notifications.

The notification is removed from the list of pending notifications either when:

  • it is read or
  • it is removed by the application, for example if it is not valid anymore.

For further details about the objects supporting ALNotificationManager, see: NotificationInfo.

Getting Started

Add a notification

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)

Print all NotificationInfos

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"