Class SyncML_Device

Description

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

If a sync client needs any kind of special conversion of the data sent to it or received from it, this is done here. There are two sources of information to identify an device: The first (and better) one is the DevInf device info sent by the device during a request. If DevInf is not supported or sent by the client, the Source/LocURI of the device request might be sufficent to identify it.

$Horde: framework/SyncML/SyncML/Device.php,v 1.7.2.17 2010-10-26 10:13:49 jan Exp $

Copyright 2005-2009 The Horde Project (http://www.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.

Located in /SyncML/SyncML/Device.php (line 23)


	
			
Direct descendents
Class Description
 class SyncML_Device_P800 P800/P900/P910: --------------- Charset: This device is able to handle UTF-8 and sends its XML packages in UTF8.
 class SyncML_Device_Sync4JMozilla The SyncML_Device_Sync4JMozilla:: class provides functionality that is specific to the Sync4JMozilla Plugin. See http://sourceforge.net/projects/sync4jmozilla/
 class SyncML_Device_Synthesis The SyncML_Device_Synthesis:: class provides functionality that is specific to the Synthesis.ch SyncML clients.
 class SyncML_Device_Nokia The SyncML_Device_Nokia:: class provides functionality that is specific to the Nokia SyncML clients.
 class SyncML_Device_sync4j Sync4j (www.sync4j.org)
Variable Summary
Method Summary
 array convertClient2Server (string $content, string $contentType)
 array convertServer2Client (string $content, string $contentType, string $database)
 string convertUTC2LocalTime (string $utc)
 SyncML_Device factory (string $driver)
 string getPreferredContentType (string $database)
 void getPreferredContentTypeClient (string $serverSyncURI, string $sourceSyncURI)
 boolean useCdataTag ()
 boolean useLocalTime ()
Variables
string $requestedContentType (line 31)

The original preferred content type of the client, if provided through DevInf.

Methods
convertClient2Server (line 165)

Converts the content received from the client for the backend.

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

Charset conversions might be added here too.

  • return: Two-element array with the converted content and the (possibly changed) new content type.
  • todo: remove UID stripping or move it anywhere else.
array convertClient2Server (string $content, string $contentType)
  • string $content: The content to convert.
  • string $contentType: The content type of the content.

Redefined in descendants as:
convertServer2Client (line 196)

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.

  • return: Three-element array with the converted content, the (possibly changed) new content type, and encoding type (like b64 as used by Funambol).
array convertServer2Client (string $content, string $contentType, string $database)
  • string $content: The content to convert
  • string $contentType: The content type of content as returned from the backend
  • string $database: The server database URI.

Redefined in descendants as:
convertUTC2LocalTime (line 283)

Converts an UTC timestamp like "20061222T110000Z" into a local timestamp like "20061222T130000" using the server timezone.

  • return: The datetime string converted to the local timezone.
string convertUTC2LocalTime (string $utc)
  • string $utc: A datetime string in UTC.
factory (line 42)

Attempts to return a concrete SyncML_Device instance based on $driver.

  • return: The newly created concrete SyncML_Device instance, or false on error.
SyncML_Device factory (string $driver)
  • string $driver: The type of concrete SyncML_Device subclass to return.
getPreferredContentType (line 78)

Returns the guessed content type for a database URI.

When a client sends data during a sync but does not provide information about the MIME content type with this individual item, this function returns the content type the item is supposed to be in.

  • return: A MIME type that might match the database URI.
string getPreferredContentType (string $database)
  • string $database: A database URI.
getPreferredContentTypeClient (line 120)

Returns the preferrred MIME content type of the client for the given sync data type (contacts/tasks/notes/calendar).

The result is passed as an option to the backend export functions. This is not the content type ultimately passed to the client but rather the content type presented to the backend export functions.

After the data is retrieved from the backend, convertServer2Client() can do some post-processing and set the correct content type acceptable for the client if necessary.

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

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

void getPreferredContentTypeClient (string $serverSyncURI, string $sourceSyncURI)
  • string $serverSyncURI: The URI for the server database: contacts, notes, calendar or tasks.
  • string $sourceSyncURI: The URI for the client database. This is needed as the DevInf is grouped by sourceSyncURIs.
handleTasksInCalendar (line 231)

Returns whether the device handles tasks and events in a single "calendar" sync.

This requires special actions on our side as we store this in different backend databases.

  • return: True if tasks and events are processed in a single request.
boolean handleTasksInCalendar ()

Redefined in descendants as:
omitIndividualSyncStatus (line 242)

Returns whether to send individual status response for each Add, Delete and Replace.

  • return: False if individual status responses should be send.
boolean omitIndividualSyncStatus ()

Redefined in descendants as:
useCdataTag (line 258)

Returns whether the payload data should be enclosed in a [CDATA[ section when sending via XML.

The synchronized data may contain XML special characters like &, < or >. Clients might choke when sending these embedded in XML. The data should be enclosed in [CDATA[ in these cases. This applies only to XML, not to WBXML devices.

  • return: True if the data should be enclosed in [CDATA[.
boolean useCdataTag ()

Redefined in descendants as:
useLocalTime (line 270)

Returns whether the device accepts datetimes only in local time format (DTSTART:20061222T130000) instead of the more robust UTC time (DTSTART:20061222T110000Z).

  • return: True if the client doesn't accept UTC datetimes.
boolean useLocalTime ()

Redefined in descendants as:

Documentation generated on Sun, 30 Jan 2011 05:16:46 +0000 by phpDocumentor 1.4.3