Activity sharing: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
[[Image:shared activites.png|right]]
[[Image:shared activites.png|right]]


==Telepathy==
== Telepathy ==


[http://telepathy.freedesktop.org/ Telepathy] is a system describing a generic interface for multi-user chat (MUC), instant messaging (IM) and voice/video applications. It is the underlying infrastructure used by Sugar for collaboration.
[http://telepathy.freedesktop.org/ Telepathy] is a system describing a generic interface for multi-user chat (MUC), instant messaging (IM) and voice/video applications. It is the underlying infrastructure used by Sugar for collaboration.


== Presence Service ==
==PresenceService==
The [[Presence Service]] is a part of Sugar that tracks other buddies and
The [[Presence Service]] is a part of Sugar that tracks other buddies and
activities on the network. It is designed to have a D-Bus interface that is to
activities on the network. It is designed to have a D-Bus interface that is to
be used by activities. To make life easier, there is a class that
be used by activities. To make life easier, there is a class that takes care of
takes care of talking to the D-Bus presence service
talking to the D-Bus presence service
(sugar.presence.PresenceService). Most activities can use this class for all
(<tt>sugar.presence.PresenceService</tt>). Most activities can use this class
their Presence Service needs.
for all their Presence Service needs.


The presence service uses two Telepathy Connection Managers:
The Presence Service uses two Telepathy connection managers:


* '''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.
* '''Gabble''', that provides server-based Jabber/XMPP functionality. It talks
* to a [[Jabber server]] (e.g. <tt>olpc.collabora.co.uk</tt>) and sets up
* different chat rooms through which activities talk to each other.


* '''Salut''', a link-local Connection Manager using reliable multicast over the local network
* '''Salut''', a link-local Connection Manager using reliable multicast over the local network


Only one connection manager is used at a time. The [[Presence Service]] will
The [[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).
use Gabble when it has Internet access (a valid IPv4 address) and has connected
to a [[Jabber server]], otherwise Salut.

== Tubes ==


==Tubes==
[[Tubes]] offer a mechanism to provide data sharing over XMPP. There are currently two types of tubes:
[[Tubes]] offer a mechanism to provide data sharing over XMPP. There are currently two types of tubes:


Line 36: Line 41:
:provide a socket-like connection set up via XMPP, for data streaming like HTTP, between two participants.
:provide a socket-like connection set up via XMPP, for data streaming like HTTP, between two participants.


==Using tubes in Sugar activities==
== Using tubes in Sugar activities ==
The [[Presence Service]] creates Connection Manager objects (Gabble and/or Salut). It gets a Connection object (to the [[Jabber server]] in the case of Gabble). PS creates or gets a Tubes channel. For Python Activities, Sugar creates or joins a D-Bus tube automatically.
The [[Presence Service]] creates connection manager objects (Gabble and/or
Salut). It gets a Connection object (to the [[Jabber server]] in the case of
Gabble). PS creates or gets a Tubes channel. For Python Activities, Sugar
creates or joins a D-Bus tube automatically.


The initiator of the activity should then call Tubes.OfferDBusTube to offer a Tube with a specific service name. When a buddy joins an activity, he will try to figure out which Tubes are available by calling Tubes.ListTubes() on the tubes channel (which he doesn't have to create anymore). Both OfferDBusTube and ListTubes result in a callback when the Tube becomes really available. Only then a working Tube is handed to the (shared) activity and it is possible to export objects on that bus and subscribe to signals etc.
The initiator of the activity should then call Tubes.OfferDBusTube to offer a Tube with a specific service name. When a buddy joins an activity, he will try to figure out which Tubes are available by calling Tubes.ListTubes() on the tubes channel (which he doesn't have to create anymore). Both OfferDBusTube and ListTubes result in a callback when the Tube becomes really available. Only then a working Tube is handed to the (shared) activity and it is possible to export objects on that bus and subscribe to signals etc.
Line 43: Line 51:
See [[Tubes Tutorial]] for more on using Tubes.
See [[Tubes Tutorial]] for more on using Tubes.


==Who's who?==
== Who's who? ==
Buddies/nodes within an activity are currently identified with different handles by different components. The following handles can be distinguished:
Buddies/nodes within an activity are currently identified with different handles by different components. The following handles can be distinguished:
*Dbus name. If you have a Dbus related function with the “sender” argument specified, this is what you'll get. To buddy object:
*Dbus name. If you have a Dbus related function with the “sender” argument specified, this is what you'll get. To buddy object:

Revision as of 20:40, 24 March 2008

Overview

Collaboration in Sugar activities works using a set of services that run on the laptop, and APIs in the Sugar Python modules that wrap those services. The main services are the Telepathy connection managers and the presence service that coordinates them.

Shared activites.png

Telepathy

Telepathy is a system describing a generic interface for multi-user chat (MUC), instant messaging (IM) and voice/video applications. It is the underlying infrastructure used by Sugar for collaboration.

Presence Service

The Presence Service is a part of Sugar that tracks other buddies and activities on the network. It is designed to have a D-Bus interface that is to be used by activities. To make life easier, there is a class that takes care of talking to the D-Bus presence service (sugar.presence.PresenceService). Most activities can use this class for all their Presence Service needs.

The Presence Service uses two Telepathy connection managers:

  • 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.
  • Salut, a link-local Connection Manager using reliable multicast over the local network

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.

Tubes

Tubes offer a mechanism to provide data sharing over XMPP. There are currently two types of tubes:

  • D-Bus Tubes
provide a D-Bus bus service that is shared between the participants in a shared activity, providing signals to all participants, and methods called on a particular participant.
  • Stream Tubes
provide a socket-like connection set up via XMPP, for data streaming like HTTP, between two participants.

Using tubes in Sugar activities

The Presence Service creates connection manager objects (Gabble and/or Salut). It gets a Connection object (to the Jabber server in the case of Gabble). PS creates or gets a Tubes channel. For Python Activities, Sugar creates or joins a D-Bus tube automatically.

The initiator of the activity should then call Tubes.OfferDBusTube to offer a Tube with a specific service name. When a buddy joins an activity, he will try to figure out which Tubes are available by calling Tubes.ListTubes() on the tubes channel (which he doesn't have to create anymore). Both OfferDBusTube and ListTubes result in a callback when the Tube becomes really available. Only then a working Tube is handed to the (shared) activity and it is possible to export objects on that bus and subscribe to signals etc.

See Tubes Tutorial for more on using Tubes.

Who's who?

Buddies/nodes within an activity are currently identified with different handles by different components. The following handles can be distinguished:

  • Dbus name. If you have a Dbus related function with the “sender” argument specified, this is what you'll get. To buddy object:
   sugar.presence.PresenceService.get_buddy(buddy's public key)
  • Telepathy handle. To buddy object:
   sugar.presence.PresenceService.get_buddy_by_telepathy_handle(tp_conn, tp_conn_path, handle)