File: DeviceInfo.php

package info (click to toggle)
horde3 3.3.8%2Bdebian0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 34,220 kB
  • ctags: 28,224
  • sloc: php: 115,191; xml: 4,247; sql: 2,417; sh: 147; makefile: 140
file content (376 lines) | stat: -rw-r--r-- 8,388 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<?php
/**
 * SyncML_DeviceInfo represents a device information set according to the
 * SyncML specification.
 *
 * A DeviceInfo object is created by SyncML_Command_Put from an appropriate
 * XML message. SyncML_Command_Put directly populates the members variables.
 *
 * The current implementation should handle all DevInf 1.1 DTD elements
 * except <DSMem> entries.
 *
 * $Horde: framework/SyncML/SyncML/DeviceInfo.php,v 1.2.2.13 2009/01/06 15:23:37 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.
 *
 * @author  Karsten Fourmont <karsten@horde.org>
 * @author  Jan Schneider <jan@horde.org>
 * @package SyncML
 */
class SyncML_DeviceInfo {

    /**
     * The major and minor version identifier of the Device Information DTD.
     *
     * @var string
     */
    var $VerDTD;

    /**
     * The name of the manufacturer of the device.
     *
     * @var string
     */
    var $Man;

    /**
     * The model name or model number of the device.
     *
     * @var string
     */
    var $Mod;

    /**
     * The OEM (Original Equipment Manufacturer) of the device.
     *
     * @var string
     */
    var $OEM;

    /**
     * The firmware version of the device.
     *
     * @var string
     */
    var $FwV;

    /**
     * The software version of the device.
     *
     * @var string
     */
    var $SwV;

    /**
     * The hardware version of the device.
     *
     * @var string
     */
    var $HwV;

    /**
     * The (globally unique) identifier of the source synchronization device.
     *
     * @var string
     */
    var $DevID;

    /**
     * The type of the source synchronization device.
     *
     * @var string
     */
    var $DevTyp;

    /**
     * Array of SyncML_DataStore objects.
     *
     * @var array
     */
    var $DataStores = array();

    /**
     * Multidimensional array that specifies the content type capabilities of
     * the device.
     *
     * Example: array('text/x-vcard' => array('FN' => SyncML_Property))
     *
     * @var array
     */
    var $CTCaps;

    /**
     * The non-standard, experimental extensions supported by the device.
     *
     * A hash with <XNam> elements as keys and arrays of <XVal> elements as
     * values.
     * Example: array('X-Foo-Bar' => array(1, 'foo'))
     *
     * @var array
     */
    var $Exts;

    /**
     * Whether the device supports UTC based time.
     *
     * @var boolean
     */
    var $UTC;

    /**
     * Whether the device supports handling of large objects.
     *
     * @var boolean
     */
    var $SupportLargeObjs;

    /**
     * Whether the device supports number of changes.
     *
     * @var boolean
     */
    var $SupportNumberOfChanges;

    /**
     * Returns a SyncML_DataStore object for a certain source URI.
     *
     * @param string $source URI  A source URI.
     *
     * @return SyncML_DataStore  A data store object or null if none found for
     *                           the source URI.
     */
    function getDataStore($sourceURI)
    {
        foreach ($this->DataStores as $dataStore) {
            if ($dataStore->SourceRef == $sourceURI) {
                return $dataStore;
            }
        }
        return null;
    }

}

/**
 * The SyncML_DataStore class describes one of the possible datastores
 * (i.e. databases) of the device.
 *
 * Most important attributes are the preferred MIME Types for sending and
 * receiving data for this datastore: $Tx_Pref and $Rx_Pref.
 *
 * @package SyncML
 */
class SyncML_DataStore {

    /**
     * The local URI of the datastore.
     *
     * @var string
     */
    var $SourceRef;

    /**
     * The display name of the datastore
     *
     * @var string
     */
    var $DisplayName;

    /**
     * The maximum size of a global unique identifier for the datastore in
     * bytes.
     *
     * @var integer
     */
    var $MaxGUIDSize;

    /**
     * The preferred types and versions of a content type received by the
     * device.
     *
     * The content types (CTType) are the keys, the versions (VerCT) are the
     * values.
     *
     * @var array
     */
    var $Rx_Pref = array();

    /**
     * The supported types and versions of a content type received by the
     * device.
     *
     * The content types (CTType) are the keys, the versions (VerCT) are the
     * values.
     *
     * @var array
     */
    var $Rx = array();

    /**
     * The preferred types and versions of a content type transmitted by the
     * device.
     *
     * The content types (CTType) are the keys, the versions (VerCT) are the
     * values.
     *
     * @var array
     */
    var $Tx_Pref = array();

    /**
     * The supported types and versions of a content type transmitted by the
     * device.
     *
     * The content types (CTType) are the keys, the versions (VerCT) are the
     * values.
     *
     * @var array
     */
    var $Tx = array();

    /**
     * The maximum memory and item identifier for the datastore.
     *
     * Not implemented yet.
     */
    var $DSMem;

    /**
     * The synchronization capabilities of the datastore.
     *
     * The synchronization types (SyncType) are stored in the keys of the
     * hash.
     *
     * @var array
     */
    var $SyncCap = array();

    /**
     * Returns the preferred content type the client wants to receive.
     *
     * @return string  The device's preferred content type or null if not
     *                 specified (which is not allowed).
     */
    function getPreferredRXContentType()
    {
        reset($this->Rx_Pref);
        return key($this->Rx_Pref);
    }

    /**
     * Returns the version of the preferred content type the client wants to
     * receive.
     *
     * @return string  The device's preferred content type version or null if
     *                 not specified (which is not allowed).
     */
    function getPreferredRXContentTypeVersion()
    {
        return reset($this->Rx_Pref);
    }

}

/**
 * The SyncML_Property class is used to define a single property of a data
 * item supported by the device.
 *
 * The allowed contents of a property can be defined by an enumeration of
 * valid values (ValEnum) or by a DataType/Size combination, or not at all.
 *
 * @package SyncML
 */
class SyncML_Property {

    /**
     * The supported enumerated values of the content type property.
     *
     * The supported values stored in the keys of the hash, e.g. 'PUBLIC' and
     * 'PRIVATE' for a text/calendar 'CLASS' property.
     *
     * @var array
     */
    var $ValEnum;

    /**
     * The datatype of the content type property, e.g. 'chr', 'int', 'bool',
     * etc.
     *
     * @var string
     */
    var $DataType;

    /**
     * The size of the content type property in bytes.
     *
     * @var integer
     */
    var $Size;

    /**
     * The display name of the content type property.
     *
     * @var string
     */
    var $DisplayName;

    /**
     * The supported parameters of the content type property.
     *
     * The parameter name (<ParamName>, e.g. 'WORK' for the text/x-vcard 'TEL'
     * property) are the keys, SyncML_PropertyParameter objects are the
     * values.
     *
     * @var array
     */
    var $Params;

}

/**
 * The SyncML_PropertyParameter class is used to define a single parameter of
 * a property of a data item supported by the device.
 *
 * The contents of a property parameter can be defined by an enumeration of
 * valid values (ValEnum) or by a DataType/Size combination, or not at all.
 *
 * @package SyncML
 */
class SyncML_PropertyParameter {

    /**
     * The supported enumerated values of the content type property.
     *
     * The supported values stored in the keys of the hash, e.g. 'PUBLIC' and
     * 'PIVATE' for a text/calendar 'CLASS' property.
     *
     * @var array
     */
    var $ValEnum;

    /**
     * The datatype of the content type property, e.g. 'chr', 'int', 'bool',
     * etc.
     *
     * @var string
     */
    var $DataType;

    /**
     * The size of the content type property in bytes.
     *
     * @var integer
     */
    var $Size;

    /**
     * The display name of the content type property.
     *
     * @var string
     */
    var $DisplayName;

}