Presence Service: Difference between revisions
No edit summary |
|||
(16 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
== Overview == |
== Overview == |
||
The '''Presence Service''' is a D-Bus service on the XO that coordinates [[ |
The '''Presence Service''' is a D-Bus service on the XO that coordinates [[activity sharing]]. It uses [[Telepathy]] to access the network. It provides information about other people on the network and what activities they are participating in. It is responsible for initiating Telepathy connections when the XO is turned on, reconnecting Telepathy connections when they are disconnected, and registering the laptop with the Jabber server. |
||
Sugar provides a wrapper interface to the D-Bus API in the Python module <tt>sugar.presence</tt>. |
Sugar provides a wrapper interface to the D-Bus API in the Python module <tt>sugar.presence</tt>. |
||
Line 7: | Line 7: | ||
Sugar's “neighborhood view” (or “mesh view”) uses the Presence Service to show who is online (“present”). This performs a function similar to that of a buddy list in a conventional instant messaging application. |
Sugar's “neighborhood view” (or “mesh view”) uses the Presence Service to show who is online (“present”). This performs a function similar to that of a buddy list in a conventional instant messaging application. |
||
See [[ |
See [[Activity sharing]] for an overview of collaboration, or [[Collaboration Tutorial]] for how to add collaboration to an activity. |
||
== Presence stack == |
== Presence stack == |
||
Line 65: | Line 65: | ||
[[category:Collaboration]] |
[[category:Collaboration]] |
||
[[category:Developers]] |
[[category:Developers]] |
||
== Howto == |
|||
=== See if Presence Service is running === |
|||
Use the ''olpc-netstatus'' command in a terminal to see if PS is running. If you see a line that looks like this: |
|||
<code> |
|||
Telepathy: salut |
|||
</code> |
|||
...then Telepathy is up. (Note: you may see "gabble" instead of "salut"; that's okay too.) |
|||
=== View Presence Service logs === |
|||
* First, [[Telepathy debugging|enable logging]]. |
|||
* Your log is viewable at /home/olpc/.sugar/default/logs/presenceservice.log |
|||
== Bugs == |
|||
* [http://dev.laptop.org/query?status=assigned&status=new&status=reopened&group=milestone&component=presence-service All Presence Service bugs] |
|||
== Release process == |
== Release process == |
||
* Update NEWS |
|||
* Bump version in configure.ac |
* Bump version in configure.ac |
||
* git commit configure.ac -m "version $VERSION" |
* git commit NEWS configure.ac -m "version $VERSION" |
||
* git tag "$VERSION" |
* git tag "v$VERSION" |
||
* git push --tags |
|||
* |
* make distcheck |
||
* Upload the tarball to dev.laptop.org:/var/www/sugar/sources/sugar-presence-service |
* Upload the tarball to dev.laptop.org:/var/www/sugar/sources/sugar-presence-service ( https://dev.laptop.org/pub/sugar/sources/sugar-presence-service/ ) |
||
⚫ | |||
* Send an announce mail to <s>devel-announce@lists.sugarlabs.org</s> sugar@lists.laptop.org. Include a reference to the source code tarball and an high level, user oriented list of changes. (see http://wiki.sugarlabs.org/go/ReleaseTeam#Module_release) |
|||
⚫ |
Latest revision as of 22:05, 19 September 2008
Overview
The Presence Service is a D-Bus service on the XO that coordinates activity sharing. It uses Telepathy to access the network. It provides information about other people on the network and what activities they are participating in. It is responsible for initiating Telepathy connections when the XO is turned on, reconnecting Telepathy connections when they are disconnected, and registering the laptop with the Jabber server.
Sugar provides a wrapper interface to the D-Bus API in the Python module sugar.presence.
Sugar's “neighborhood view” (or “mesh view”) uses the Presence Service to show who is online (“present”). This performs a function similar to that of a buddy list in a conventional instant messaging application.
See Activity sharing for an overview of collaboration, or Collaboration Tutorial for how to add collaboration to an activity.
Presence stack
Python activities (and Sugar) make use of the sugar.presence module to interact with Presence Service. sugar.presence provides an API for accessing Presence Service over the D-Bus session bus.
Presence Service in turn interacts with Gabble and Salut over the session bus, and once everything is set up (or in the case of non-Python activities) the activity can use Telepathy directly (for example, to use Tubes).
Connection types
Presence Service supports two Telepathy backends (connection managers):
- Telepathy Gabble, that provides server-based Jabber/XMPP functionality. It talks to a Jabber server (e.g. olpc.collabora.co.uk) and sets up different chat rooms through which activities talk to each other.
- Telepathy Salut, a link-local Connection Manager using reliable multicast over the local network
Although Telepathy hides the differences between the protocols, the Presence Services varies its behaviour a little according to which connection it is using. To achieve this, it internally uses a plugin structure, where each type of connection used has an associated plugin.
Only one connection manager is used at a time. The Presence Service will use Gabble when it has Internet access (a valid IPv4 address) and has connected to a Jabber server, otherwise Salut.
Active connection
Though Presence Service is designed to run both connection managers simultaneously, at this stage only one is in effect at a time, since there is no UI support for showing which activities are shared on which connection.
Presence Service will use Gabble when it has Internet access (a valid IPv4 address) and has connected to a Jabber server, otherwise Salut (but not both at the same time). Here is the sequence of events:
- Both plugins are started when Presence Service starts, unless PRESENCE_SERVICE_DEBUG=disable-gabble or disable-salut are set.
- Salut succeeds faster than Gabble, so link local buddies are shown first.
- PS's server plugin watches Network Manager signals on the D-Bus system bus.
- When NM indicates that we have a valid IPv4 address, we run the _init_connection method of the ServerPlugin instance.
- Gabble is automatically run by the session bus (dbus-daemon) via service activation, the first time the Presence Service uses it, if it isn't already running.
- If the Gabble connection fails, we schedule a timer (starting at 5 seconds with exponential backoff to a maximum of 5 minutes) and retry running _init_connection when the timer runs out.
- (classes TelepathyPlugin and ServerPlugin, methods _init_connection, _reconnect_cb, _could_connect, _handle_connection_status_change.)
- If the server plugin has connected to a jabber server, PS stops the link local plugin (salut). Link local buddies disappear.
- If NM loses the IP address, the server plugin stops itself.
- When the server plugin stops, PS starts the link local plugin.
API
Python code can use the sugar.presence library to talk to Presence Service. Non-python code can use the API that Presence Service provides over the D-Bus session bus.
See Low-level Activity API#Presence for the basic operations, and Presence Service DBus API for a more comprehensive, but out of date, API listing.
Source
Browse: http://dev.laptop.org/git?p=projects/presence-service;a=summary
Clone:
git clone git://dev.laptop.org/projects/presence-service
Howto
See if Presence Service is running
Use the olpc-netstatus command in a terminal to see if PS is running. If you see a line that looks like this:
Telepathy: salut
...then Telepathy is up. (Note: you may see "gabble" instead of "salut"; that's okay too.)
View Presence Service logs
- First, enable logging.
- Your log is viewable at /home/olpc/.sugar/default/logs/presenceservice.log
Bugs
Release process
- Update NEWS
- Bump version in configure.ac
- git commit NEWS configure.ac -m "version $VERSION"
- git tag "v$VERSION"
- git push --tags
- make distcheck
- Upload the tarball to dev.laptop.org:/var/www/sugar/sources/sugar-presence-service ( https://dev.laptop.org/pub/sugar/sources/sugar-presence-service/ )
- Send an announce mail to
devel-announce@lists.sugarlabs.orgsugar@lists.laptop.org. Include a reference to the source code tarball and an high level, user oriented list of changes. (see http://wiki.sugarlabs.org/go/ReleaseTeam#Module_release) - Update sugar-presence-service rpm package for Fedora on the devel and F-9
OLPC-3branches as explained on https://fedoraproject.org/wiki/PackageMaintainers/UpdatingPackageHowTo - note that Dennis Gilmore must then tag the packages into dist-olpc3 to get into joyride.