File: DeviceInfo.php

package info (click to toggle)
horde3 3.1.3-4etch7
  • links: PTS
  • area: main
  • in suites: etch
  • size: 22,876 kB
  • ctags: 18,071
  • sloc: php: 75,151; xml: 2,979; sql: 1,069; makefile: 79; sh: 64
file content (236 lines) | stat: -rw-r--r-- 4,798 bytes parent folder | download | duplicates (2)
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
<?php
/**
 * SyncML_DeviceInfo represents a device information set according to the
 * SyncML spec.
 *
 * See http://www.syncml.org/docs/syncml_devinf_v11_20020215.pdf
 *
 * A DeviceInfo object is created by Command/Put::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
 * expcept DSMem entries.
 *
 * 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/DeviceInfo.php,v 1.2.2.6 2006/05/05 21:14:45 karsten Exp $
 *
 * @author  Karsten Fourmont <karsten@horde.org>
 * @package SyncML
 */
class SyncML_DeviceInfo {

    var $_VerDTD;
    var $_Man;
    var $_Mod;
    var $_OEM;
    var $_FwV;
    var $_SwV;
    var $_HwV;
    var $_DevID;
    var $_DevTyp;

    /**
     * Array of SyncML_DataStore objects.
     */
    var $_DataStore;

    /**
     * Array: CTType => array: PropertyName => SyncML_Property object.
     */
    var $_CTCap;

    /**
     * Array XNam => array of Xval entries.
     */
    var $_Ext;

    /**
     * @var boolean
     */
    var $_UTC;

    /**
     * @var boolean
     */
    var $_SupportLargeObjs;

    /**
     * @var boolean
     */
    var $_SupportNumberOfChanges;


    /**
     * Returns the DevInf data for a datastore identified by $sourceURI
     * (_SourceRef parameter).  Returns a SyncML_DataStore object or null if
     * no such datastore exists.
     */ 
    function getDataStore($sourceURI)
    {

        if (is_array($this->_DataStore)) {
            foreach ($this->_DataStore as $v) {
                if ($v->_SourceRef == $sourceURI) {
                    return $v;
                }
            }
        }
        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 $_SourceRef;

    /**
     * Optional.
     */
    var $_DisplayName;

    /**
     * Optional.
     */
    var $_MaxGUIDSize;

    /**
     * One element array of CTType => VerCT
     */
    var $_Rx_Pref;

    /**
     * Array of CTType => VerCT
     */
    var $_Rx;

    /**
     * One element array of CTType => VerCT
     */
    var $_Tx_Pref;

    /**
     * Array of CTType => VerCT
     */
    var $_Tx;

    /**
     * Optional.
     */
    var $_DSMem;

    /**
     * Array SyncType => true
     */
    var $_SyncCap;

    /**
     * Returns the preferred contentype the client wants to receive (RX). Or
     * NULL if not specified (which is not allowed by protocol).
     */
    function getPreferredRXContentType()
    {
        if (is_array($this->_Rx_Pref)) {
            $r = array_keys($this->_Rx_Pref);
            return $r[0];
        }
        return null;
    }

    /**
     * Returns the version of the preferred contentype the client wants to
     * receive (RX). Or NULL if not specified (which is not allowed by
     * protocol).
     */
    function getPreferredRXContentTypeVersion()
    {
        if (is_array($this->_Rx_Pref)) {
            $r = array_values($this->_Rx_Pref);
            return $r[0];
        }
        return NULL;
    }
}

/**
 * The class SyncML_Property is used to define a single property of a vcard
 * element.  The 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 {

    /**
     * Array of valid values => true
     */
    var $_ValEnum;

    /**
     * If not ValEnum.
     */
    var $_DataType;

    /**
     * If not ValEnum, optional.
     */
    var $_Size;

    /**
     * Optional.
     */
    var $_DisplayName;

    /**
     * Array of ParamName => SyncML_PropertyParameter
     */
    var $_params;

}

/**
 * The class SyncML_PropertyParameter is used to define a single parameter of
 * a property of a vcard element.  The contents of a PropertyParameter 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 {

    /**
     * If provided: array of ValEnum => true
     */
    var $_ValEnum;

    /**
     * If not ValEnum.
     */
    var $_DataType;

    /**
     * If not ValEnum, optional.
     */
    var $_Size;

    /**
     * Optional.
     */
    var $_DisplayName;

}