[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/SyncML/ -> Device.php (sommaire)

(pas de description)

Poids: 368 lignes (14 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

SyncML_Device:: (10 méthodes):
  factory()
  singleton()
  sourceURI()
  deviceInfo()
  getPreferredContentType()
  getPreferredContentTypeClient()
  convertClient2Server()
  convertServer2Client()
  handleTasksInCalendar()
  needsCategoryMapping()


Classe: SyncML_Device  - X-Ref

The SyncML_Device:: class provides functionality that is
potentially (client) device dependant.

So if a sync client needs any kind of special data of the data sent
to it or received from it, this is done here. There are two source
of information to identify an device: The first (and better) one is
the DevInf device info sent by the device upon a get request. If
DevInf is not supported or sent by the client, the SourceURI of the
device may be sufficent to identify it.

Information about a few devices already working with SyncML::

P800/P900/P910:
---------------
Charset:
This device is able to handle UTF-8 and sends its XML packages in UTF8.
However even though the XML itself is UTF-8, it expects the enclosed
vcard-data to be ISO-8859-1 unless explicitly stated otherwise (using the
CHARSET option, which is deprecated for VCARD 3.0)

Encoding:
String values are encoded "QUOTED-PRINTABLE"

Other:
This devices handles tasks and events in one database.

Copyright 2005-2006 Karsten Fourmont <karsten@horde.org>

See the enclosed file COPYING for license information (LGPL). If you did not
receive this file, see http://www.fsf.org/copyleft/lgpl.html.

$Horde: framework/SyncML/SyncML/Device.php,v 1.7.2.8 2006/05/03 21:42:54 jan Exp $

factory()   X-Ref
Pas de description

singleton()   X-Ref
Pas de description

sourceURI()   X-Ref
Returns the SourceURI from state.


deviceInfo()   X-Ref
Returns the DevInf class from state.


getPreferredContentType($type)   X-Ref
When a client sends data during a sync but does not provide
information about the contenttype with this individual item,
this function returns the contenttype the item is supposed to be in.

As this is only used to parse to the horde's importdata api functions,
some simple guesses for the contenttype are completely sufficient:
Horde does not care whether data is text/x-vcalendar or text/calendar.

getPreferredContentTypeClient($serverSyncURI, $sourceSyncURI)   X-Ref
Returns the preferrred contenttype of the client for the given
sync data type (contacts/tasks/notes/calendar).

The result is passed as an option to the Horde API export functions.
Please note that this is not the contentType ultimately passed to the
client but rather the contentType presented to the Horde API export
functions. For example the contact api supports a contenttype
text/x-vcard;version=2.1 to create a vcard in vcard 2.1 format.

After the data is retrieved from horde, convertServer2Client can do
some post-processing and set the correct contentType acceptable for
the client if necessary.

The default implementation tries to extract the contenttype from the
presented device info. If this does not work, some default are used.

If the client does not provice proper DevInf data, this function may
have to be overwritten to return the correct values.

ServerSyncURI: The server database of the sync:
contacts|notes|calendar|tasks
sourceSyncURI: The URI for the client database. This is needed as
the DevInf is arranged by sourceSyncURIs

convertClient2Server($content, $contentType)   X-Ref
Convert the content received from the client for the horde backend.

Currently strips uid (primary key) information as client and
server might use different ones.

Charset conversions might be added here too.

param: string $content       The content to convert
param: string $contentType   The contentType of the content
return: array                array($newcontent, $newcontentType):

convertServer2Client($content, $contentType)   X-Ref
Converts the content from the backend to a format suitable for the
client device.

Strips the uid (primary key) information as client and server might use
different ones.

Charset conversions might be added here too.

param: string $content       The content to convert
param: string $contentType   The contentType of content as returned from
return: array                array($newcontent, $newcontentType):

handleTasksInCalendar()   X-Ref
Some devices like the Sony Ericsson P800/P900/P910 handle
vtodos (tasks) and vevents in the same "calendar" sync.  This
requires special actions on our side as we store this in
different databases (nag and kronolith).  This function
determines whether the client does it like that.  Currently
this is done by checking the DevInf information. For different
clients there may be different ways to find out how the client
likes its tasks.


needsCategoryMapping()   X-Ref
Some devices need a mapping of client vs. server categorie names.
The backend provides a mechanism for this mapping. It is used
when this needsCategoryMapping returns true.
For special cases the mapping may also be implemented directly in
convertClient2Server and convertServer2Client. In this case
needsCategoryMapping may return false.




Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7