summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resources/webidl2/test/widlproc/examples/bondi.widl
blob: 200b95fe9c1e123c1b7b375f48ca28fc53a46525 (plain)
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
/*
 * Licensed to OMTP Ltd. (OMTP) under one or more contributor license agreements. 
 * See the NOTICE file distributed with this work for additional information regarding 
 * copyright ownership. 
 * 
 * The Reference Implementation (save for such parts of the reference implementation made 
 * available under separate terms and conditions) is made available under the terms of the 
 * Apache License, version 2.0, subject to the condition that any "Works" and "Derivative 
 * Works" used or distributed for commercial purposes must be and remain compliant with the
 * BONDI specification as promulgated by OMTP in each release. Your implementation of the 
 * Reference Implementation (whether object or source) must maintain these conditions, and 
 * you must notify any recipient of this condition in a conspicuous way.
 * 
 * You may not use this BONDI Reference Implementation except in compliance with the License. 
 * 
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 or at 
 * http://bondi.omtp.org/BONDI-LICENSE-2.0 
 */

/**
 * \brief Common BONDI functionality.
 *
 * These definitions can be used in all other BONDI modules as dependencies.
  * \version 1.1
 */
module bondi {

	/**
	 * \brief Array of DOMStrings.
	 */
	typedef sequence<DOMString> StringArray;

	/**
	 * \brief Array of 8-bit unsigned integer values.
	 */
	typedef sequence<octet>     ByteArray;

	/**
	 * \brief Array of 16-bit signed integer values.
	 */
	typedef sequence<short>     ShortArray;

	/**
	 * \brief Array of 32-bit signed integer values.
	 */
	typedef sequence<long>      LongArray;

	/**
	 * \brief Array of floating point values.
	 */
	typedef sequence<float>     FloatArray;

	/**
	 * \brief Generic Map object.
	 */
	typedef Object              Map;

	/**
	 * \brief Generic success callback interface.
	 */
	[Callback=FunctionOnly, NoInterfaceObject] interface SuccessCallback {
	   /**
	    * \brief Method invoked when the asynchronous call completes successfully
	    */
		void onSuccess();
	};


	/**
	 * \brief Success callback interface for requestFeature invocations
	 */
    [Callback=FunctionOnly, NoInterfaceObject] interface RequestFeatureSuccessCallback {
       /**
	    * \brief Method invoked upon a succesful requestFeature invocation
	    *
	    * \param ob Object implementing the JavaScript API associated with the requested Feature.
	    */
        void onSuccess(in Object ob);
     };


	/**
	 * \brief Generic error callback interface.
	 */
	[Callback=FunctionOnly, NoInterfaceObject] interface ErrorCallback {
	   /**
	    * \brief Method invoked when an error occurs
	    *
	    * \param error The error that is raised.
	    */
		void onError(in GenericError error);
	};

	/**
	 * \brief Generic error interface.
	 *
	 * 
	 */


	interface GenericError {

		/**
		 * \brief 16-bit error code.
		 */
		readonly attribute unsigned short code;
	};
		
	/**
	 * \brief DeviceApiError error interface.
	 *
	 * The error codes must be in the range 10000-19999.
	 */

	interface DeviceAPIError : GenericError {

		/**
		 * \brief Unknown error.
		 */
		const unsigned short UNKNOWN_ERROR           = 10000;

		/**
		 * \brief Invalid value was specified as input parameter.
		 */
		const unsigned short INVALID_ARGUMENT_ERROR  = 10001;

		/**
		 * \brief The searched value or object was not found.
		 */
		const unsigned short NOT_FOUND_ERROR         = 10002;

		/**
		 * \brief Operation is pending.
		 */
		const unsigned short PENDING_OPERATION_ERROR = 10003;

		/**
		 * \brief Input/Output error.
		 */
		const unsigned short IO_ERROR                = 10004;

		/**
		 * \brief Not supported error.
		 */
		const unsigned short NOT_SUPPORTED_ERROR     = 10005;
	};

	/**
	 * \brief Security error interface.
	 *
	 * The error codes must be in the range 20000-29999
	 */
	interface SecurityError : GenericError {
		const unsigned short PERMISSION_DENIED_ERROR = 20000;
	};

	/**
	 * \brief PendingOperation.
	 *
	 * Interface that is returned by asynchronous operations in order to
	 * provide a cancellation operation.
	 */
	interface PendingOperation {
		/**
		 * \brief Call to cancel the underlying asynchronous operation.
		 *
		 * This call is always successful, i.e. the pending operation i.e.
		 * either cancelled or one of the callback is called.
		 *
		 * \return <em>false</em> if the cancellation did not succeed
		 * either because the pending operation finished already or because
		 * the cancellation cannot succeed due to technical limitations in
		 * the underlying implementation. Consquently the pending operation 
		 * completes and depending on the success or failure the appropriate
		 * callbacks will be called.
		 * <em>true</em> if the cancellation did succeed. No callbacks will
		 * be called by the cancelled pending operation.
		 */
		boolean cancel();
	};

	/**
	 * \brief BONDI root API.
	 * bondi root property exists in the global object
	 * \def-api-feature http://bondi.omtp.org/api/bondi.requestfeature
	 */
	interface Bondi {
		/**
		 * \brief Requests a feature.
		 *
		 * This function requests a named feature
		 * asynchronously and returns a pending operation object.
		 * If it succeeds it calls the successCallback and passes in
		 * the object of the requested feature. If it fails it calls
		 * the errorCallback passing in a DeviceAPIError which provides 
		 * an error message and error code indicating the nature of the error.
		 *
		 * If the requested feature binds itself to a root namespace
		 * ( for example, "bondi.pim.contact") this will happen prior to the
		 * successCallback being invoked.
		 *
		 * \param successCallback  the success callback function
		 * \param errorCallback    the error callback function
		 * \param name             the feature name IRI
		 *
		 * \return PendingOperation enabling the requester to cancel this request.
		 *
		 * The errorCallback will receive one of the following errors:
		 * \throw DeviceAPIError INVALID_ARGUMENT_ERROR if a malformed
		 * argument has been supplied or a required argument has been omitted.
		 * \throw DeviceAPIError NOT_FOUND_ERROR if the requested feature could not be found.
		 * \throw SecurityError PERMISSION_DENIED_ERROR if the
		 * requested feature is not permitted to load/bind or that
		 * access to a required device capability has been denied.
		 * \throw DeviceAPIError UNKNOWN_ERROR if an error occurred and a pending
		 * operation object can't be returned.
		 */
		PendingOperation requestFeature(in RequestFeatureSuccessCallback successCallback,
		                                in ErrorCallback   errorCallback,
		                                in DOMString       name)
			raises(DeviceAPIError, SecurityError);
	};
	interface BondiObject {
		readonly attribute Bondi bondi; 
	};
	Window implements bondiObject;
};