001 package com.skype.api;
002
003 import com.skype.ipc.SidRoot;
004 import com.skype.ipc.SidObject;
005 import com.skype.ipc.EnumConverting;
006 import com.skype.ipc.PropertyEnumConverting;
007 import java.io.IOException;
008 import com.skype.api.ContactGroup;
009 import com.skype.api.Contact;
010 import com.skype.api.Conversation;
011 import com.skype.api.Message;
012 import com.skype.api.Video;
013 import com.skype.api.Sms;
014 import com.skype.ipc.Decoding;
015 import com.skype.api.Participant;
016
017 public class Skype extends SidRoot {
018 public enum IdentityType implements EnumConverting {
019 UNRECOGNIZED (0),
020 SKYPE (1),
021 SKYPE_MYSELF (2),
022 SKYPE_UNDISCLOSED(3),
023 PSTN (4),
024 PSTN_EMERGENCY (5),
025 PSTN_FREE (6),
026 PSTN_UNDISCLOSED (7),
027 CONFERENCE (8),
028 EXTERNAL (9);
029 private final int key;
030 IdentityType(int key) {
031 this.key = key;
032 };
033 public int getId() { return key; }
034 public EnumConverting getDefault() { return UNRECOGNIZED; }
035 public EnumConverting convert(int from) { return IdentityType.get(from); }
036 public EnumConverting[] getArray(final int size) { return new IdentityType[size]; }
037 public static IdentityType get(int from) {
038 switch (from) {
039 case 0: return UNRECOGNIZED;
040 case 1: return SKYPE;
041 case 2: return SKYPE_MYSELF;
042 case 3: return SKYPE_UNDISCLOSED;
043 case 4: return PSTN;
044 case 5: return PSTN_EMERGENCY;
045 case 6: return PSTN_FREE;
046 case 7: return PSTN_UNDISCLOSED;
047 case 8: return CONFERENCE;
048 case 9: return EXTERNAL;
049 }
050 return UNRECOGNIZED;
051 }
052 public static final int UNRECOGNIZED_VALUE = 0;
053 public static final int SKYPE_VALUE = 1;
054 public static final int SKYPE_MYSELF_VALUE = 2;
055 public static final int SKYPE_UNDISCLOSED_VALUE = 3;
056 public static final int PSTN_VALUE = 4;
057 public static final int PSTN_EMERGENCY_VALUE = 5;
058 public static final int PSTN_FREE_VALUE = 6;
059 public static final int PSTN_UNDISCLOSED_VALUE = 7;
060 public static final int CONFERENCE_VALUE = 8;
061 public static final int EXTERNAL_VALUE = 9;
062 }
063 public enum NormalizeResult implements EnumConverting {
064 IDENTITY_OK (0),
065 IDENTITY_EMPTY (1),
066 IDENTITY_TOO_LONG (2),
067 IDENTITY_CONTAINS_INVALID_CHAR(3),
068 PSTN_NUMBER_TOO_SHORT (4),
069 /** identity looks like pstn number but does not start with +/00/011 */
070 PSTN_NUMBER_HAS_INVALID_PREFIX(5),
071 SKYPENAME_STARTS_WITH_NONALPHA(6),
072 /** returned only when isNewSkypeName */
073 SKYPENAME_SHORTER_THAN_6_CHARS(7);
074 private final int key;
075 NormalizeResult(int key) {
076 this.key = key;
077 };
078 public int getId() { return key; }
079 public EnumConverting getDefault() { return IDENTITY_OK; }
080 public EnumConverting convert(int from) { return NormalizeResult.get(from); }
081 public EnumConverting[] getArray(final int size) { return new NormalizeResult[size]; }
082 public static NormalizeResult get(int from) {
083 switch (from) {
084 case 0: return IDENTITY_OK;
085 case 1: return IDENTITY_EMPTY;
086 case 2: return IDENTITY_TOO_LONG;
087 case 3: return IDENTITY_CONTAINS_INVALID_CHAR;
088 case 4: return PSTN_NUMBER_TOO_SHORT;
089 case 5: return PSTN_NUMBER_HAS_INVALID_PREFIX;
090 case 6: return SKYPENAME_STARTS_WITH_NONALPHA;
091 case 7: return SKYPENAME_SHORTER_THAN_6_CHARS;
092 }
093 return IDENTITY_OK;
094 }
095 public static final int IDENTITY_OK_VALUE = 0;
096 public static final int IDENTITY_EMPTY_VALUE = 1;
097 public static final int IDENTITY_TOO_LONG_VALUE = 2;
098 public static final int IDENTITY_CONTAINS_INVALID_CHAR_VALUE = 3;
099 public static final int PSTN_NUMBER_TOO_SHORT_VALUE = 4;
100 public static final int PSTN_NUMBER_HAS_INVALID_PREFIX_VALUE = 5;
101 public static final int SKYPENAME_STARTS_WITH_NONALPHA_VALUE = 6;
102 public static final int SKYPENAME_SHORTER_THAN_6_CHARS_VALUE = 7;
103 }
104 /** sync failure reasons when starting a transfer */
105 public enum TransferSendfileError implements EnumConverting {
106 TRANSFER_OPEN_SUCCESS (0),
107 TRANSFER_BAD_FILENAME (1),
108 TRANSFER_OPEN_FAILED (2),
109 TRANSFER_TOO_MANY_PARALLEL(3);
110 private final int key;
111 TransferSendfileError(int key) {
112 this.key = key;
113 };
114 public int getId() { return key; }
115 public EnumConverting getDefault() { return TRANSFER_OPEN_SUCCESS; }
116 public EnumConverting convert(int from) { return TransferSendfileError.get(from); }
117 public EnumConverting[] getArray(final int size) { return new TransferSendfileError[size]; }
118 public static TransferSendfileError get(int from) {
119 switch (from) {
120 case 0: return TRANSFER_OPEN_SUCCESS;
121 case 1: return TRANSFER_BAD_FILENAME;
122 case 2: return TRANSFER_OPEN_FAILED;
123 case 3: return TRANSFER_TOO_MANY_PARALLEL;
124 }
125 return TRANSFER_OPEN_SUCCESS;
126 }
127 public static final int TRANSFER_OPEN_SUCCESS_VALUE = 0;
128 public static final int TRANSFER_BAD_FILENAME_VALUE = 1;
129 public static final int TRANSFER_OPEN_FAILED_VALUE = 2;
130 public static final int TRANSFER_TOO_MANY_PARALLEL_VALUE = 3;
131 }
132 public enum LeaveReason implements EnumConverting {
133 LEAVE_REASON_NONE (0),
134 /** automatic, user cannot chat (only some older versions might set this) */
135 RETIRED_USER_INCAPABLE (2),
136 /** automatic */
137 RETIRED_ADDER_MUST_BE_FRIEND (3),
138 /** automatic */
139 RETIRED_ADDER_MUST_BE_AUTHORIZED (4),
140 /** manual reason (afaik no UI uses this) */
141 RETIRED_DECLINE_ADD (5),
142 /** manual reason */
143 RETIRED_UNSUBSCRIBE (6),
144 LIVE_NO_ANSWER (100),
145 /** live: User hung up */
146 LIVE_MANUAL (101),
147 LIVE_BUSY (102),
148 LIVE_CONNECTION_DROPPED (103),
149 LIVE_NO_SKYPEOUT_SUBSCRIPTION (104),
150 LIVE_INSUFFICIENT_FUNDS (105),
151 LIVE_INTERNET_CONNECTION_LOST (106),
152 LIVE_SKYPEOUT_ACCOUNT_BLOCKED (107),
153 LIVE_PSTN_COULD_NOT_CONNECT_TO_SKYPE_PROXY(108),
154 LIVE_PSTN_INVALID_NUMBER (109),
155 LIVE_PSTN_NUMBER_FORBIDDEN (110),
156 LIVE_PSTN_CALL_TIMED_OUT (111),
157 LIVE_PSTN_BUSY (112),
158 LIVE_PSTN_CALL_TERMINATED (113),
159 LIVE_PSTN_NETWORK_ERROR (114),
160 LIVE_NUMBER_UNAVAILABLE (115),
161 LIVE_PSTN_CALL_REJECTED (116),
162 LIVE_PSTN_MISC_ERROR (117),
163 LIVE_INTERNAL_ERROR (118),
164 LIVE_UNABLE_TO_CONNECT (119),
165 /** live: Voicemail recording failed */
166 LIVE_RECORDING_FAILED (120),
167 /** live: Voicemail playback failed */
168 LIVE_PLAYBACK_ERROR (121),
169 LIVE_LEGACY_ERROR (122),
170 LIVE_BLOCKED_BY_PRIVACY_SETTINGS (123),
171 /** live: Fallback error */
172 LIVE_ERROR (124),
173 LIVE_TRANSFER_FAILED (125),
174 LIVE_TRANSFER_INSUFFICIENT_FUNDS (126),
175 LIVE_BLOCKED_BY_US (127),
176 LIVE_EMERGENCY_CALL_DENIED (128);
177 private final int key;
178 LeaveReason(int key) {
179 this.key = key;
180 };
181 public int getId() { return key; }
182 public EnumConverting getDefault() { return LEAVE_REASON_NONE; }
183 public EnumConverting convert(int from) { return LeaveReason.get(from); }
184 public EnumConverting[] getArray(final int size) { return new LeaveReason[size]; }
185 public static LeaveReason get(int from) {
186 switch (from) {
187 case 0: return LEAVE_REASON_NONE;
188 case 2: return RETIRED_USER_INCAPABLE;
189 case 3: return RETIRED_ADDER_MUST_BE_FRIEND;
190 case 4: return RETIRED_ADDER_MUST_BE_AUTHORIZED;
191 case 5: return RETIRED_DECLINE_ADD;
192 case 6: return RETIRED_UNSUBSCRIBE;
193 case 100: return LIVE_NO_ANSWER;
194 case 101: return LIVE_MANUAL;
195 case 102: return LIVE_BUSY;
196 case 103: return LIVE_CONNECTION_DROPPED;
197 case 104: return LIVE_NO_SKYPEOUT_SUBSCRIPTION;
198 case 105: return LIVE_INSUFFICIENT_FUNDS;
199 case 106: return LIVE_INTERNET_CONNECTION_LOST;
200 case 107: return LIVE_SKYPEOUT_ACCOUNT_BLOCKED;
201 case 108: return LIVE_PSTN_COULD_NOT_CONNECT_TO_SKYPE_PROXY;
202 case 109: return LIVE_PSTN_INVALID_NUMBER;
203 case 110: return LIVE_PSTN_NUMBER_FORBIDDEN;
204 case 111: return LIVE_PSTN_CALL_TIMED_OUT;
205 case 112: return LIVE_PSTN_BUSY;
206 case 113: return LIVE_PSTN_CALL_TERMINATED;
207 case 114: return LIVE_PSTN_NETWORK_ERROR;
208 case 115: return LIVE_NUMBER_UNAVAILABLE;
209 case 116: return LIVE_PSTN_CALL_REJECTED;
210 case 117: return LIVE_PSTN_MISC_ERROR; case 118: return LIVE_INTERNAL_ERROR;
211 case 119: return LIVE_UNABLE_TO_CONNECT;
212 case 120: return LIVE_RECORDING_FAILED;
213 case 121: return LIVE_PLAYBACK_ERROR;
214 case 122: return LIVE_LEGACY_ERROR;
215 case 123: return LIVE_BLOCKED_BY_PRIVACY_SETTINGS;
216 case 124: return LIVE_ERROR;
217 case 125: return LIVE_TRANSFER_FAILED;
218 case 126: return LIVE_TRANSFER_INSUFFICIENT_FUNDS;
219 case 127: return LIVE_BLOCKED_BY_US;
220 case 128: return LIVE_EMERGENCY_CALL_DENIED;
221 }
222 return LEAVE_REASON_NONE;
223 }
224 public static final int LEAVE_REASON_NONE_VALUE = 0;
225 public static final int RETIRED_USER_INCAPABLE_VALUE = 2;
226 public static final int RETIRED_ADDER_MUST_BE_FRIEND_VALUE = 3;
227 public static final int RETIRED_ADDER_MUST_BE_AUTHORIZED_VALUE = 4;
228 public static final int RETIRED_DECLINE_ADD_VALUE = 5;
229 public static final int RETIRED_UNSUBSCRIBE_VALUE = 6;
230 public static final int LIVE_NO_ANSWER_VALUE = 100;
231 public static final int LIVE_MANUAL_VALUE = 101;
232 public static final int LIVE_BUSY_VALUE = 102;
233 public static final int LIVE_CONNECTION_DROPPED_VALUE = 103;
234 public static final int LIVE_NO_SKYPEOUT_SUBSCRIPTION_VALUE = 104;
235 public static final int LIVE_INSUFFICIENT_FUNDS_VALUE = 105;
236 public static final int LIVE_INTERNET_CONNECTION_LOST_VALUE = 106;
237 public static final int LIVE_SKYPEOUT_ACCOUNT_BLOCKED_VALUE = 107;
238 public static final int LIVE_PSTN_COULD_NOT_CONNECT_TO_SKYPE_PROXY_VALUE = 108;
239 public static final int LIVE_PSTN_INVALID_NUMBER_VALUE = 109;
240 public static final int LIVE_PSTN_NUMBER_FORBIDDEN_VALUE = 110;
241 public static final int LIVE_PSTN_CALL_TIMED_OUT_VALUE = 111;
242 public static final int LIVE_PSTN_BUSY_VALUE = 112;
243 public static final int LIVE_PSTN_CALL_TERMINATED_VALUE = 113;
244 public static final int LIVE_PSTN_NETWORK_ERROR_VALUE = 114;
245 public static final int LIVE_NUMBER_UNAVAILABLE_VALUE = 115;
246 public static final int LIVE_PSTN_CALL_REJECTED_VALUE = 116;
247 public static final int LIVE_PSTN_MISC_ERROR_VALUE = 117;
248 public static final int LIVE_INTERNAL_ERROR_VALUE = 118;
249 public static final int LIVE_UNABLE_TO_CONNECT_VALUE = 119;
250 public static final int LIVE_RECORDING_FAILED_VALUE = 120;
251 public static final int LIVE_PLAYBACK_ERROR_VALUE = 121;
252 public static final int LIVE_LEGACY_ERROR_VALUE = 122;
253 public static final int LIVE_BLOCKED_BY_PRIVACY_SETTINGS_VALUE = 123;
254 public static final int LIVE_ERROR_VALUE = 124;
255 public static final int LIVE_TRANSFER_FAILED_VALUE = 125;
256 public static final int LIVE_TRANSFER_INSUFFICIENT_FUNDS_VALUE = 126;
257 public static final int LIVE_BLOCKED_BY_US_VALUE = 127;
258 public static final int LIVE_EMERGENCY_CALL_DENIED_VALUE = 128;
259 }
260 public enum QualityTestType implements EnumConverting {
261 QTT_AUDIO_IN (0),
262 QTT_AUDIO_OUT(1),
263 QTT_VIDEO_OUT(2),
264 QTT_CPU (3),
265 QTT_NETWORK (4),
266 QTT_VIDEO_IN (5);
267 private final int key;
268 QualityTestType(int key) {
269 this.key = key;
270 };
271 public int getId() { return key; }
272 public EnumConverting getDefault() { return QTT_AUDIO_IN; }
273 public EnumConverting convert(int from) { return QualityTestType.get(from); }
274 public EnumConverting[] getArray(final int size) { return new QualityTestType[size]; }
275 public static QualityTestType get(int from) {
276 switch (from) {
277 case 0: return QTT_AUDIO_IN;
278 case 1: return QTT_AUDIO_OUT;
279 case 2: return QTT_VIDEO_OUT;
280 case 3: return QTT_CPU;
281 case 4: return QTT_NETWORK;
282 case 5: return QTT_VIDEO_IN;
283 }
284 return QTT_AUDIO_IN;
285 }
286 public static final int QTT_AUDIO_IN_VALUE = 0;
287 public static final int QTT_AUDIO_OUT_VALUE = 1;
288 public static final int QTT_VIDEO_OUT_VALUE = 2;
289 public static final int QTT_CPU_VALUE = 3;
290 public static final int QTT_NETWORK_VALUE = 4;
291 public static final int QTT_VIDEO_IN_VALUE = 5;
292 }
293 public enum QualityTestResult implements EnumConverting {
294 QTR_UNDEFINED(0),
295 QTR_CRITICAL (1),
296 QTR_POOR (2),
297 QTR_AVERAGE (3),
298 QTR_GOOD (4),
299 QTR_EXCELLENT(5);
300 private final int key;
301 QualityTestResult(int key) {
302 this.key = key;
303 };
304 public int getId() { return key; }
305 public EnumConverting getDefault() { return QTR_UNDEFINED; }
306 public EnumConverting convert(int from) { return QualityTestResult.get(from); }
307 public EnumConverting[] getArray(final int size) { return new QualityTestResult[size]; }
308 public static QualityTestResult get(int from) {
309 switch (from) {
310 case 0: return QTR_UNDEFINED;
311 case 1: return QTR_CRITICAL;
312 case 2: return QTR_POOR;
313 case 3: return QTR_AVERAGE;
314 case 4: return QTR_GOOD;
315 case 5: return QTR_EXCELLENT;
316 }
317 return QTR_UNDEFINED;
318 }
319 public static final int QTR_UNDEFINED_VALUE = 0;
320 public static final int QTR_CRITICAL_VALUE = 1;
321 public static final int QTR_POOR_VALUE = 2;
322 public static final int QTR_AVERAGE_VALUE = 3;
323 public static final int QTR_GOOD_VALUE = 4;
324 public static final int QTR_EXCELLENT_VALUE = 5;
325 }
326 public enum PrepareSoundResult implements EnumConverting {
327 PREPARESOUND_SUCCESS (0),
328 PREPARESOUND_MISC_ERROR (1),
329 PREPARESOUND_FILE_NOT_FOUND (2),
330 PREPARESOUND_FILE_TOO_BIG (3),
331 PREPARESOUND_FILE_READ_ERROR (4),
332 PREPARESOUND_UNSUPPORTED_FILE_FORMAT(5),
333 PREPARESOUND_PLAYBACK_NOT_SUPPORTED (6);
334 private final int key;
335 PrepareSoundResult(int key) {
336 this.key = key;
337 };
338 public int getId() { return key; }
339 public EnumConverting getDefault() { return PREPARESOUND_SUCCESS; }
340 public EnumConverting convert(int from) { return PrepareSoundResult.get(from); }
341 public EnumConverting[] getArray(final int size) { return new PrepareSoundResult[size]; }
342 public static PrepareSoundResult get(int from) {
343 switch (from) {
344 case 0: return PREPARESOUND_SUCCESS;
345 case 1: return PREPARESOUND_MISC_ERROR;
346 case 2: return PREPARESOUND_FILE_NOT_FOUND;
347 case 3: return PREPARESOUND_FILE_TOO_BIG;
348 case 4: return PREPARESOUND_FILE_READ_ERROR;
349 case 5: return PREPARESOUND_UNSUPPORTED_FILE_FORMAT;
350 case 6: return PREPARESOUND_PLAYBACK_NOT_SUPPORTED;
351 }
352 return PREPARESOUND_SUCCESS;
353 }
354 public static final int PREPARESOUND_SUCCESS_VALUE = 0;
355 public static final int PREPARESOUND_MISC_ERROR_VALUE = 1;
356 public static final int PREPARESOUND_FILE_NOT_FOUND_VALUE = 2;
357 public static final int PREPARESOUND_FILE_TOO_BIG_VALUE = 3;
358 public static final int PREPARESOUND_FILE_READ_ERROR_VALUE = 4;
359 public static final int PREPARESOUND_UNSUPPORTED_FILE_FORMAT_VALUE = 5;
360 public static final int PREPARESOUND_PLAYBACK_NOT_SUPPORTED_VALUE = 6;
361 }
362 public enum AudioDeviceCapabilities implements EnumConverting {
363 HAS_VIDEO_CAPTURE (1),
364 HAS_USB_INTERFACE (2),
365 POSSIBLY_HEADSET (4),
366 HAS_AUDIO_CAPTURE (8),
367 HAS_AUDIO_RENDERING (16),
368 HAS_LOWBANDWIDTH_CAPTURE(32),
369 IS_WEBCAM (64),
370 IS_HEADSET (128),
371 POSSIBLY_WEBCAM (256),
372 HAS_VIDEO_RENDERING (2048),
373 HAS_BLUETOOTH_INTERFACE (4096);
374 private final int key;
375 AudioDeviceCapabilities(int key) {
376 this.key = key;
377 };
378 public int getId() { return key; }
379 public EnumConverting getDefault() { return HAS_VIDEO_CAPTURE; }
380 public EnumConverting convert(int from) { return AudioDeviceCapabilities.get(from); }
381 public EnumConverting[] getArray(final int size) { return new AudioDeviceCapabilities[size]; }
382 public static AudioDeviceCapabilities get(int from) {
383 switch (from) { case 1: return HAS_VIDEO_CAPTURE;
384 case 2: return HAS_USB_INTERFACE;
385 case 4: return POSSIBLY_HEADSET;
386 case 8: return HAS_AUDIO_CAPTURE;
387 case 16: return HAS_AUDIO_RENDERING;
388 case 32: return HAS_LOWBANDWIDTH_CAPTURE;
389 case 64: return IS_WEBCAM;
390 case 128: return IS_HEADSET;
391 case 256: return POSSIBLY_WEBCAM;
392 case 2048: return HAS_VIDEO_RENDERING;
393 case 4096: return HAS_BLUETOOTH_INTERFACE;
394 }
395 return HAS_VIDEO_CAPTURE;
396 }
397 public static final int HAS_VIDEO_CAPTURE_VALUE = 1;
398 public static final int HAS_USB_INTERFACE_VALUE = 2;
399 public static final int POSSIBLY_HEADSET_VALUE = 4;
400 public static final int HAS_AUDIO_CAPTURE_VALUE = 8;
401 public static final int HAS_AUDIO_RENDERING_VALUE = 16;
402 public static final int HAS_LOWBANDWIDTH_CAPTURE_VALUE = 32;
403 public static final int IS_WEBCAM_VALUE = 64;
404 public static final int IS_HEADSET_VALUE = 128;
405 public static final int POSSIBLY_WEBCAM_VALUE = 256;
406 public static final int HAS_VIDEO_RENDERING_VALUE = 2048;
407 public static final int HAS_BLUETOOTH_INTERFACE_VALUE = 4096;
408 }
409 public enum OperatingMedia implements EnumConverting {
410 OM_UNKNOWN (0),
411 OM_FREE (1),
412 OM_FREE_WIRELESS(2),
413 OM_3G (3),
414 OM_4G (4);
415 private final int key;
416 OperatingMedia(int key) {
417 this.key = key;
418 };
419 public int getId() { return key; }
420 public EnumConverting getDefault() { return OM_UNKNOWN; }
421 public EnumConverting convert(int from) { return OperatingMedia.get(from); }
422 public EnumConverting[] getArray(final int size) { return new OperatingMedia[size]; }
423 public static OperatingMedia get(int from) {
424 switch (from) {
425 case 0: return OM_UNKNOWN;
426 case 1: return OM_FREE;
427 case 2: return OM_FREE_WIRELESS;
428 case 3: return OM_3G;
429 case 4: return OM_4G;
430 }
431 return OM_UNKNOWN;
432 }
433 public static final int OM_UNKNOWN_VALUE = 0;
434 public static final int OM_FREE_VALUE = 1;
435 public static final int OM_FREE_WIRELESS_VALUE = 2;
436 public static final int OM_3G_VALUE = 3;
437 public static final int OM_4G_VALUE = 4;
438 }
439 /** A value of this type can be returned by one of the following methods (of Skype class): ValidateAvatar, ValidateProfileString, ValidatePassword. */
440 public enum Validateresult implements EnumConverting {
441 /** Given property could not be validated. The length of the field was within limits and the value is assumed to be Ok. Your client should treat this value as equivalent to VALIDATED_OK. */
442 NOT_VALIDATED (0),
443 /** Avatar or profile string validation succeeded. */
444 VALIDATED_OK (1),
445 /** Password is too short. */
446 TOO_SHORT (2),
447 /** The value exceeds max size limit for the given property. */
448 TOO_LONG (3),
449 /** Value contains illegal characters. */
450 CONTAINS_INVALID_CHAR (4),
451 /** Value contains whitespace. */
452 CONTAINS_SPACE (5),
453 /** Password cannot be the same as skypename. */
454 SAME_AS_USERNAME (6),
455 /** Value has invalid format. */
456 INVALID_FORMAT (7),
457 /** Value contains invalid word. */
458 CONTAINS_INVALID_WORD (8),
459 /** Password is too simple. */
460 TOO_SIMPLE (9),
461 /** Value starts with an invalid character. */
462 STARTS_WITH_INVALID_CHAR(10);
463 private final int key;
464 Validateresult(int key) {
465 this.key = key;
466 };
467 public int getId() { return key; }
468 public EnumConverting getDefault() { return NOT_VALIDATED; }
469 public EnumConverting convert(int from) { return Validateresult.get(from); }
470 public EnumConverting[] getArray(final int size) { return new Validateresult[size]; }
471 public static Validateresult get(int from) {
472 switch (from) {
473 case 0: return NOT_VALIDATED;
474 case 1: return VALIDATED_OK;
475 case 2: return TOO_SHORT;
476 case 3: return TOO_LONG;
477 case 4: return CONTAINS_INVALID_CHAR;
478 case 5: return CONTAINS_SPACE;
479 case 6: return SAME_AS_USERNAME;
480 case 7: return INVALID_FORMAT;
481 case 8: return CONTAINS_INVALID_WORD;
482 case 9: return TOO_SIMPLE;
483 case 10: return STARTS_WITH_INVALID_CHAR;
484 }
485 return NOT_VALIDATED;
486 }
487 public static final int NOT_VALIDATED_VALUE = 0;
488 public static final int VALIDATED_OK_VALUE = 1;
489 public static final int TOO_SHORT_VALUE = 2;
490 public static final int TOO_LONG_VALUE = 3;
491 public static final int CONTAINS_INVALID_CHAR_VALUE = 4;
492 public static final int CONTAINS_SPACE_VALUE = 5;
493 public static final int SAME_AS_USERNAME_VALUE = 6;
494 public static final int INVALID_FORMAT_VALUE = 7;
495 public static final int CONTAINS_INVALID_WORD_VALUE = 8;
496 public static final int TOO_SIMPLE_VALUE = 9;
497 public static final int STARTS_WITH_INVALID_CHAR_VALUE = 10;
498 }
499 public enum ProxyType implements EnumConverting {
500 HTTPS_PROXY(0),
501 SOCKS_PROXY(1);
502 private final int key;
503 ProxyType(int key) {
504 this.key = key;
505 };
506 public int getId() { return key; }
507 public EnumConverting getDefault() { return HTTPS_PROXY; }
508 public EnumConverting convert(int from) { return ProxyType.get(from); }
509 public EnumConverting[] getArray(final int size) { return new ProxyType[size]; }
510 public static ProxyType get(int from) {
511 switch (from) {
512 case 0: return HTTPS_PROXY;
513 case 1: return SOCKS_PROXY;
514 }
515 return HTTPS_PROXY;
516 }
517 public static final int HTTPS_PROXY_VALUE = 0;
518 public static final int SOCKS_PROXY_VALUE = 1;
519 }
520 public enum App2AppStreams implements EnumConverting {
521 ALL_STREAMS (0),
522 SENDING_STREAMS (1),
523 RECEIVED_STREAMS(2);
524 private final int key;
525 App2AppStreams(int key) {
526 this.key = key;
527 };
528 public int getId() { return key; }
529 public EnumConverting getDefault() { return ALL_STREAMS; }
530 public EnumConverting convert(int from) { return App2AppStreams.get(from); }
531 public EnumConverting[] getArray(final int size) { return new App2AppStreams[size]; }
532 public static App2AppStreams get(int from) {
533 switch (from) {
534 case 0: return ALL_STREAMS;
535 case 1: return SENDING_STREAMS;
536 case 2: return RECEIVED_STREAMS;
537 }
538 return ALL_STREAMS;
539 }
540 public static final int ALL_STREAMS_VALUE = 0;
541 public static final int SENDING_STREAMS_VALUE = 1;
542 public static final int RECEIVED_STREAMS_VALUE = 2;
543 }
544 /** Setupkey SETUPKEY_DB_STORAGE_QUOTA_KB type:int default value:"0" <br>Use this key to limit the size of the main.db file. Value is in KB. Quota are disabled by default. <br><br><b>NB!</b> This setup key only limits the size of the main database files. It <b>does not include size of sqlite temporary files</b>, such as rollback journals. Sometimes even if this quota is set, the total size of db files on storage can grow more than than the set limit, for short period of time. <br><br>Because of this, as a rule of thumb, you should set this setup key to approximately <b>half</b> of actual available storage space. <br><br>If the storage limit is exceeded (or the database file just runs out of available storage), the currently logged in account will be forcibily logged out, with P_LOGOUT_REASON set to DB_IO_ERROR. <br><br>This setup key is machine-specific and affects all local accounts. <br> */
545 public static final String DB_STORAGE_QUOTA_KB = "*Lib/DbManager/StorageQuotaKb";
546
547 /** Setupkey SETUPKEY_DISABLED_CODECS type:string <br>Space-separated array of disabled codecs <br>This setup key is machine-specific and affects all local accounts. <br> */
548 public static final String DISABLED_CODECS = "*Lib/Audio/DisableCodecs";
549
550 /** Setupkey SETUPKEY_DISABLE_AEC type:boolean <br>Disables Skype echo canceller <br>This setup key is machine-specific and affects all local accounts. <br> */
551 public static final String DISABLE_AEC = "*Lib/Audio/DisableAEC";
552
553 /** Setupkey SETUPKEY_DISABLE_NOISE_SUPPRESSOR type:boolean <br>Disables Skype noise suppressor <br>This setup key is machine-specific and affects all local accounts. <br> */
554 public static final String DISABLE_NOISE_SUPPRESSOR = "*Lib/Audio/DisableNS";
555
556 /** Setupkey SETUPKEY_DISABLE_AGC type:boolean Disables Skype automatic gain controller <br>This setup key is machine-specific and affects all local accounts. <br> */ public static final String DISABLE_AGC = "*Lib/Audio/DisableAGC";
557
558 /** Setupkey SETUPKEY_DISABLE_DIGITAL_NEAR_END_AGC type:boolean <br>Disables Skype digital near-end gain controller <br>This setup key is machine-specific and affects all local accounts. <br> */
559 public static final String DISABLE_DIGITAL_NEAR_END_AGC = "*Lib/Audio/DisableDigitalNearEndAGC";
560
561 /** Setupkey SETUPKEY_DISABLE_DIGITAL_FAR_END_AGC type:boolean <br>Disables Skype digital far-end gain controller <br>This setup key is machine-specific and affects all local accounts. <br> */
562 public static final String DISABLE_DIGITAL_FAR_END_AGC = "*Lib/Audio/DisableDigitalFarEndAGC";
563
564 /** Setupkey SETUPKEY_BEAMFORMER_MIC_SPACING type:string <br>Space-separated array of 1 (in case of 2 microphones) or 2 (in case of 4 microphones) integers. SAL beamforming currently only supports 2 and 4-microphone configurations. The values represent the spacing between microphones (in millimeters). <br>In case of 2-microphone setup, Only the first value is used. <br><br>In case of 4-microphone setup, The first value is the distance between inner pair of microphones. The second value is the distance between inner pair of microphones and the outer pair. Like this: <br><br>Let the microphones be on straight line, A B C D. <br>Microphones B and C form the inner pair, while A and D form the outer pair. <br>The first value in the setup string would be distance between B and C. <br>The second value would be distance between A and B (which is the same as distance between C and D). <br><br>With 4-mic setup, you will need to use two channels. The inner pair should go to one channel (left) and the outer pair should go to another (right). <br><br>This setup key is machine-specific and affects all local accounts. <br> */
565 public static final String BEAMFORMER_MIC_SPACING = "*Lib/Audio/BeamformerMicSpacing";
566
567 /** Setupkey SETUPKEY_DISABLE_AUDIO_DEVICE_PROBING type:boolean <br>Disables audio devices probing <br>This setup key is machine-specific and affects all local accounts. <br> */
568 public static final String DISABLE_AUDIO_DEVICE_PROBING = "*Lib/QualityMonitor/DisableAudioDeviceProbing";
569
570 /** Setupkey SETUPKEY_FT_AUTOACCEPT type:int <br>Controls file transfer auto-accept. <br> - 0 - off <br> - 1 - on <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
571 public static final String FT_AUTOACCEPT = "Lib/FileTransfer/AutoAccept";
572
573 /** Setupkey SETUPKEY_FT_SAVEPATH type:string <br>Full local path to save incoming file transfers (used for AutoAccept feature) <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
574 public static final String FT_SAVEPATH = "Lib/FileTransfer/SavePath";
575
576 /** Setupkey SETUPKEY_FT_INCOMING_LIMIT type:uint <br>Number of simultaneous incoming file transfers (per user). Value 0 means no limitation. <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
577 public static final String FT_INCOMING_LIMIT = "Lib/FileTransfer/IncomingLimit";
578
579 /** Setupkey SETUPKEY_IDLE_TIME_FOR_AWAY type:int <br>Number of seconds since the last keyboard or mouse activity, after which the online status of currently logged in account should be set to AWAY. See Account.SetAvailability method for more information. <br>This is account-specific setup key. It can only be used while an account is logged in. <br> */
580 public static final String IDLE_TIME_FOR_AWAY = "Lib/Account/IdleTimeForAway";
581
582 /** Setupkey SETUPKEY_IDLE_TIME_FOR_NA type:int <br>The Contact.AVAILABILITY.NOT_AVAILABLE online status has been deprecated. This setup key is no longer in use. <br> */
583 public static final String IDLE_TIME_FOR_NA = "Lib/Account/IdleTimeForNA";
584
585 /** Setupkey SETUPKEY_PORT type:int <br>Suggested port number (lib will *try* to use that) <br>This setup key is machine-specific and affects all local accounts. <br> */
586 public static final String PORT = "*Lib/Connection/Port";
587
588 /** Setupkey SETUPKEY_HTTPS_PROXY_ENABLE type:int <br>Set to 0 for automatic proxy detect, 1 to use proxy config below <br>This setup key is machine-specific and affects all local accounts. <br> */
589 public static final String HTTPS_PROXY_ENABLE = "*Lib/Connection/HttpsProxy/Enable";
590
591 /** Setupkey SETUPKEY_HTTPS_PROXY_ADDR type:string <br>name:port of HTTP proxy server <br>This setup key is machine-specific and affects all local accounts. <br> */
592 public static final String HTTPS_PROXY_ADDR = "*Lib/Connection/HttpsProxy/Addr";
593
594 /** Setupkey SETUPKEY_HTTPS_PROXY_USER type:string <br>HTTPS proxy server username <br>This setup key is machine-specific and affects all local accounts. <br> */
595 public static final String HTTPS_PROXY_USER = "*Lib/Connection/HttpsProxy/User";
596
597 /** Setupkey SETUPKEY_HTTPS_PROXY_PWD type:string <br>HTTPS proxy server password (base64 encoded) <br>This setup key is machine-specific and affects all local accounts. <br> */
598 public static final String HTTPS_PROXY_PWD = "*Lib/Connection/HttpsProxy/Pwd";
599
600 /** Setupkey SETUPKEY_SOCKS_PROXY_ENABLE type:int <br>Set to non-zero to enable socks proxy support <br>This setup key is machine-specific and affects all local accounts. <br> */
601 public static final String SOCKS_PROXY_ENABLE = "*Lib/Connection/SocksProxy/Enable";
602
603 /** Setupkey SETUPKEY_SOCKS_PROXY_ADDR type:string <br>name:port of SOCKS proxy server <br>This setup key is machine-specific and affects all local accounts. <br> */
604 public static final String SOCKS_PROXY_ADDR = "*Lib/Connection/SocksProxy/Addr";
605
606 /** Setupkey SETUPKEY_SOCKS_PROXY_USER type:string <br>SOCKS proxy server username <br>This setup key is machine-specific and affects all local accounts. <br> */
607 public static final String SOCKS_PROXY_USER = "*Lib/Connection/SocksProxy/User";
608
609 /** Setupkey SETUPKEY_SOCKS_PROXY_PWD type:string <br>SOCKS proxy server password (base64 encoded) <br>This setup key is machine-specific and affects all local accounts. <br> */
610 public static final String SOCKS_PROXY_PWD = "*Lib/Connection/SocksProxy/Pwd";
611
612 /** Setupkey SETUPKEY_LOCALADDRESS type:string <br>local interface to listen to <br>This setup key is machine-specific and affects all local accounts. <br> */
613 public static final String LOCALADDRESS = "*Lib/Connection/LocalAddress";
614
615 /** Setupkey SETUPKEY_DISABLE_PORT80 type:int <br>1 disables listening of alternative ports (80, 443) <br>This setup key is machine-specific and affects all local accounts. <br> */
616 public static final String DISABLE_PORT80 = "*Lib/Connection/DisablePort80";
617
618 /** Setupkey SETUPKEY_DISABLE_UDP type:int <br>1 disables UDP port binding. should be set before connect <br>This setup key is machine-specific and affects all local accounts. <br> */
619 public static final String DISABLE_UDP = "*Lib/Connection/DisableUDP";
620
621 private final static byte[] start_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 145,(byte) 1};
622 /**
623 * start
624 * @return started
625 */
626 public boolean start() {
627 try {
628 return sidDoRequest(start_req)
629 .endRequest().getBoolParm(1, true);
630 } catch(IOException e) {
631 sidOnFatalError(e);
632 return false
633 ;}
634 }
635 private final static byte[] getVersionString_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 28};
636 /** returns the runtime version as a string * @return version
637 */
638 public String getVersionString() {
639 try {
640 return sidDoRequest(getVersionString_req)
641 .endRequest().getStringParm(1, true);
642 } catch(IOException e) {
643 sidOnFatalError(e);
644 return ""
645 ;}
646 }
647 private final static byte[] getUnixTimestamp_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 134,(byte) 1};
648 /** Returns the time as used in SkypeKit, in the form of a Unix timestamp (number of seconds since 1.1.1970). If the local system time is incorrect my more than one year, the time provided by the Skype network will be provided, which is correct. Therefore this function can be used to adjust the system time if set incorrectly (e.g. if set to 1.1.1970). * @return timestamp
649 */
650 public int getUnixTimestamp() {
651 try {
652 return sidDoRequest(getUnixTimestamp_req)
653 .endRequest().getUintParm(1, true); } catch(IOException e) {
654 sidOnFatalError(e);
655 return 0
656 ;}
657 }
658 private final static byte[] getHardwiredContactGroup_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 1};
659 /** Takes TYPE argument (TYPE comes from ContactGroup class) and returns reference to the corresponding hardwired contact group. For example (C++): skype->GetHardwiredContactGroup(ContactGroup.ONLINE_BUDDIES, GroupRef) would return the list of all contacts that are currently online. * @param type
660 * @return contactGroup
661 */
662 public ContactGroup getHardwiredContactGroup(ContactGroup.Type type) {
663 try {
664 return (ContactGroup) sidDoRequest(getHardwiredContactGroup_req)
665 .addEnumParm(1, type)
666 .endRequest().getObjectParm(1, 10, true);
667 } catch(IOException e) {
668 sidOnFatalError(e);
669 return null
670 ;}
671 }
672 private final static byte[] getCustomContactGroups_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 2};
673 /** Returns a list of custom contact group references, i.e. all contact groups that are not hardwired. * @return groups
674 */
675 public ContactGroup[] getCustomContactGroups() {
676 try {
677 return (ContactGroup[]) sidDoRequest(getCustomContactGroups_req)
678 .endRequest().getObjectListParm(1, 10, true);
679 } catch(IOException e) {
680 sidOnFatalError(e);
681 return null
682 ;}
683 }
684 private final static byte[] createCustomContactGroup_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 3};
685 /**
686 * Creates a new empty contact group object and returns a reference to it. The group will then show up in the custom group list that you can get with Skype class GetCustomContactGroups method. Existing contacts can be added to the new group with ContactGroup class AddContact method and a custom name can be given to it with GiveDisplayName method.
687 * Note that no check is made for existing of displaynames with the same name - if you wish to force uniqueness in custom group names you will have to check that yourself before creating the group.
688 * @return group
689 */
690 public ContactGroup createCustomContactGroup() {
691 try {
692 return (ContactGroup) sidDoRequest(createCustomContactGroup_req)
693 .endRequest().getObjectParm(1, 10, true);
694 } catch(IOException e) {
695 sidOnFatalError(e);
696 return null
697 ;}
698 }
699 private final static byte[] getContactType_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 5};
700 /** analyzes the identity for contact type * @param identity
701 * @return type
702 */
703 public Contact.Type getContactType(String identity) {
704 try {
705 return (Contact.Type) sidDoRequest(getContactType_req)
706 .addStringParm(1, identity)
707 .endRequest().getEnumParm(1, Contact.Type.get(0), true);
708 } catch(IOException e) {
709 sidOnFatalError(e);
710 return Contact.Type.get(0)
711 ;}
712 }
713 private final static byte[] getContact_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 6};
714 /** Returns a Contact object reference. If a matching contact is not found in the existing contact list, a new Contact object will be created. Note that if you pass in a phone number in the identity argument, the type for the newly created Contact will be automatically set to Contact.PSTN (Contact.SKYPE otherwise). * @param identity Either skypename or a phone number
715 * @return contact Returns a contact object.
716 */
717 public Contact getContact(String identity) {
718 try {
719 return (Contact) sidDoRequest(getContact_req)
720 .addStringParm(1, identity)
721 .endRequest().getObjectParm(2, 2, true);
722 } catch(IOException e) {
723 sidOnFatalError(e);
724 return null
725 ;}
726 }
727 private final static byte[] findContactByPstnNumber_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 8};
728 public class FindContactByPstnNumberResponse {
729 public boolean found;
730 public Contact contact;
731 public int foundInKey;
732 };
733
734 /**
735 * findContactByPstnNumber
736 * @param number
737 * @return FindContactByPstnNumberResponse
738 * <br> - found
739 * <br> - contact
740 * <br> - foundInKey type is actually PROPKEY
741 */
742 public FindContactByPstnNumberResponse findContactByPstnNumber(String number) {
743 try {
744 Decoding decoder = sidDoRequest(findContactByPstnNumber_req)
745 .addStringParm(1, number)
746 .endRequest();
747 FindContactByPstnNumberResponse result = new FindContactByPstnNumberResponse();
748 result.found = decoder.getBoolParm(1, false);
749 result.contact = (Contact) decoder.getObjectParm(2, 2, false);
750 result.foundInKey = decoder.getUintParm(3, true);
751 return result;
752 } catch(IOException e) {
753 sidOnFatalError(e);
754 return null
755 ;}
756 }
757 private final static byte[] getIdentityType_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 19};
758 /** This takes skypename or a phone number string as argument and returns corresponding identity type (SKYPE, SKYPE_MYSELF, PSTN, etc.) * @param identity
759 * @return type
760 */
761 public IdentityType getIdentityType(String identity) {
762 try {
763 return (IdentityType) sidDoRequest(getIdentityType_req)
764 .addStringParm(1, identity)
765 .endRequest().getEnumParm(1, IdentityType.get(0), true);
766 } catch(IOException e) {
767 sidOnFatalError(e);
768 return IdentityType.get(0)
769 ;}
770 }
771 private final static byte[] identitiesMatch_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 88};
772 /** compares two identities to see if they match * @param identityA
773 * @param identityB
774 * @return result
775 */
776 public boolean identitiesMatch(String identityA, String identityB) {
777 try {
778 return sidDoRequest(identitiesMatch_req)
779 .addStringParm(1, identityA)
780 .addStringParm(2, identityB)
781 .endRequest().getBoolParm(1, true);
782 } catch(IOException e) {
783 sidOnFatalError(e);
784 return false
785 ;}
786 }
787 private final static byte[] normalizeIdentity_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 9};
788 public class NormalizeIdentityResponse {
789 public NormalizeResult result;
790 public String normalized;
791 };
792
793 /** This method is deprecated. Use ValidateProfileString method instead. * @param original
794 * @param isNewSkypeName
795 * @return NormalizeIdentityResponse
796 * <br> - result
797 * <br> - normalized
798 */
799 public NormalizeIdentityResponse normalizeIdentity(String original, boolean isNewSkypeName) {
800 try {
801 Decoding decoder = sidDoRequest(normalizeIdentity_req)
802 .addStringParm(1, original)
803 .addBoolParm(2, isNewSkypeName)
804 .endRequest();
805 NormalizeIdentityResponse result = new NormalizeIdentityResponse();
806 result.result = (NormalizeResult) decoder.getEnumParm(1, NormalizeResult.get(0), false);
807 result.normalized = decoder.getStringParm(2, true);
808 return result;
809 } catch(IOException e) {
810 sidOnFatalError(e);
811 return null
812 ;}
813 }
814 private final static byte[] normalizePstnWithCountry_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 205,(byte) 1};
815 public class NormalizePstnWithCountryResponse {
816 public NormalizeResult result;
817 public String normalized;
818 };
819
820 /** NormalizePSTNWithCountry checks if the phone number starts with + if it doesn't, it prefixes the output with +XXX (where XXX is the country code). It also converts letters to numbers based on the standard phone keypad, so that the phone number string 212CALLME1 with country code 372 (Estonia) would be normalized to +3722122255631. If the method cannot normalize the phone number (because it's too long, too short, etc.), it returns an error code in &result. * @param original
821 * @param countryPrefix
822 * @return NormalizePstnWithCountryResponse
823 * <br> - result
824 * <br> - normalized
825 */
826 public NormalizePstnWithCountryResponse normalizePstnWithCountry(String original, int countryPrefix) {
827 try {
828 Decoding decoder = sidDoRequest(normalizePstnWithCountry_req)
829 .addStringParm(1, original)
830 .addUintParm(2, countryPrefix)
831 .endRequest();
832 NormalizePstnWithCountryResponse result = new NormalizePstnWithCountryResponse();
833 result.result = (NormalizeResult) decoder.getEnumParm(1, NormalizeResult.get(0), false);
834 result.normalized = decoder.getStringParm(2, true);
835 return result;
836 } catch(IOException e) {
837 sidOnFatalError(e);
838 return null
839 ;}
840 }
841 private final static byte[] getOptimalAgeRanges_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 77};
842 /** list of (min,max) pairs * @return rangeList
843 */
844 public int[] getOptimalAgeRanges() {
845 try {
846 return sidDoRequest(getOptimalAgeRanges_req)
847 .endRequest().getUintListParm(1, true);
848 } catch(IOException e) {
849 sidOnFatalError(e);
850 return null
851 ;}
852 }
853 private final static byte[] createContactSearch_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 10}; /** Creates a blank contact search object, in which you can add your custom search terms. For more information how asynchronous contact search works, see ContactSearch class details. * @return search Returns blank ContactSearch object.
854 */
855 public ContactSearch createContactSearch() {
856 try {
857 return (ContactSearch) sidDoRequest(createContactSearch_req)
858 .endRequest().getObjectParm(1, 1, true);
859 } catch(IOException e) {
860 sidOnFatalError(e);
861 return null
862 ;}
863 }
864 private final static byte[] createBasicContactSearch_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 11};
865 /** searches skypenames, aliases, fullnames, emails. false if not valid * @param text
866 * @return search
867 */
868 public ContactSearch createBasicContactSearch(String text) {
869 try {
870 return (ContactSearch) sidDoRequest(createBasicContactSearch_req)
871 .addStringParm(1, text)
872 .endRequest().getObjectParm(1, 1, true);
873 } catch(IOException e) {
874 sidOnFatalError(e);
875 return null
876 ;}
877 }
878 private final static byte[] createIdentitySearch_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 12};
879 /** searches skypenames and aliases. returns 0 or 1 results. false if not valid * @param identity
880 * @return search
881 */
882 public ContactSearch createIdentitySearch(String identity) {
883 try {
884 return (ContactSearch) sidDoRequest(createIdentitySearch_req)
885 .addStringParm(1, identity)
886 .endRequest().getObjectParm(1, 1, true);
887 } catch(IOException e) {
888 sidOnFatalError(e);
889 return null
890 ;}
891 }
892 private final static byte[] createConference_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 13};
893 /** Creates a new empty conversation object and returns a reference to it. * @return conference
894 */
895 public Conversation createConference() {
896 try {
897 return (Conversation) sidDoRequest(createConference_req)
898 .endRequest().getObjectParm(1, 18, true);
899 } catch(IOException e) {
900 sidOnFatalError(e);
901 return null
902 ;}
903 }
904 private final static byte[] getConversationByIdentity_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 15};
905 /** Returns reference tp conversation object by conversation ID string (equivalent of old chat ID). NB! ID here is that of conversation, rather than skypename of dialog partner. If you want to retrieve a conversation object with any particular person, then Skype class GetConversationByParticipants method is what you are looking for. * @param convoIdentity
906 * @return conversation
907 */
908 public Conversation getConversationByIdentity(String convoIdentity) {
909 try {
910 return (Conversation) sidDoRequest(getConversationByIdentity_req)
911 .addStringParm(1, convoIdentity)
912 .endRequest().getObjectParm(1, 18, true);
913 } catch(IOException e) {
914 sidOnFatalError(e);
915 return null
916 ;}
917 }
918 private final static byte[] getConversationByParticipants_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 16};
919 /** myself not included * @param participantIdentities
920 * @param createIfNonExisting
921 * @param ignoreBookmarkedOrNamed
922 * @return conversation
923 */
924 public Conversation getConversationByParticipants(String[] participantIdentities, boolean createIfNonExisting, boolean ignoreBookmarkedOrNamed) {
925 try {
926 return (Conversation) sidDoRequest(getConversationByParticipants_req)
927 .addStringListParm(1, participantIdentities)
928 .addBoolParm(2, createIfNonExisting)
929 .addBoolParm(3, ignoreBookmarkedOrNamed)
930 .endRequest().getObjectParm(1, 18, true);
931 } catch(IOException e) {
932 sidOnFatalError(e);
933 return null
934 ;}
935 }
936 private final static byte[] getConversationByBlob_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 17};
937 /** Retrieves a Conversation object by Public Conversation BLOB. Public conversation blobs are globally unique conversation IDs that provide a method for joining conversation without explicitly being added to the conversation by someone already in it. Programmatically, a Conversation BLOB can be retrieved with Conversation.GetJoinBlob method. In Skype desktop clients, the BLOB can be retrieved by typing "/get uri" in a conversation. The conversation can then be joined by people who have somehow received that BLOB. * @param joinBlob The BLOB string.
938 * @param alsoJoin If set to true, automatically joins current user into the Conversation.
939 * @return conversation Returns Conversation object if successful.
940 */
941 public Conversation getConversationByBlob(String joinBlob, boolean alsoJoin) {
942 try {
943 return (Conversation) sidDoRequest(getConversationByBlob_req)
944 .addStringParm(1, joinBlob)
945 .addBoolParm(2, alsoJoin, true)
946 .endRequest().getObjectParm(1, 18, true);
947 } catch(IOException e) {
948 sidOnFatalError(e);
949 return null
950 ;}
951 }
952 private final static byte[] getConversationList_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 18};
953 /** Returns a list of Conversation objects by Conversation.LIST_TYPE filter. * @param type Filter.
954 * @return conversations List of conversations matching the filter.
955 */
956 public Conversation[] getConversationList(Conversation.ListType type) {
957 try {
958 return (Conversation[]) sidDoRequest(getConversationList_req)
959 .addEnumParm(1, type)
960 .endRequest().getObjectListParm(1, 18, true);
961 } catch(IOException e) {
962 sidOnFatalError(e);
963 return null
964 ;}
965 }
966 private final static byte[] getMessageByGuid_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 21};
967 /** Retrieves a Message object by the P_GUID property (globally unique ID, same for all the participants of the conversation, in which this message occured). * @param guid Globally unique ID of the message.
968 * @return message Returns a Message object if a match was found.
969 */
970 public Message getMessageByGuid(byte[] guid) {
971 try {
972 return (Message) sidDoRequest(getMessageByGuid_req)
973 .addBinaryParm(1, guid)
974 .endRequest().getObjectParm(1, 9, true);
975 } catch(IOException e) {
976 sidOnFatalError(e);
977 return null
978 ;}
979 }
980 private final static byte[] getMessageListByType_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 136,(byte) 1};
981 /** Returns all messages of the given type * @param type Type of messages requested. For POSTED_TEXT or POSTED_EMOTE, returns a list with both types
982 * @param latestPerConvOnly Whether to return only the most recent message per conversation
983 * @param fromTimestampInc Starting timestamp for reqested range, inclusive
984 * @param toTimestampExc Ending timestamp for requested range, exclusive
985 * @return messages
986 */
987 public Message[] getMessageListByType(Message.Type type, boolean latestPerConvOnly, int fromTimestampInc, int toTimestampExc) {
988 try {
989 return (Message[]) sidDoRequest(getMessageListByType_req)
990 .addEnumParm(1, type)
991 .addBoolParm(2, latestPerConvOnly)
992 .addUintParm(3, fromTimestampInc)
993 .addUintParm(4, toTimestampExc, Integer.MIN_VALUE)
994 .endRequest().getObjectListParm(1, 9, true);
995 } catch(IOException e) {
996 sidOnFatalError(e);
997 return null
998 ;}
999 }
1000 private final static byte[] getAvailableVideoDevices_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 80};
1001 public class GetAvailableVideoDevicesResponse {
1002 public String[] deviceNames;
1003 public String[] devicePaths;
1004 public int count;
1005 };
1006
1007 /** This method returns a table in form of two string lists of equal length and an uint argument that returns the count of items i both lists. The first list contains video recording device handles and the second list descriptive names of those devices. NB! This method requires videortphost to be running, otherwise it will return empty lists. * @return GetAvailableVideoDevicesResponse
1008 * <br> - deviceNames
1009 * <br> - devicePaths
1010 * <br> - count
1011 */
1012 public GetAvailableVideoDevicesResponse getAvailableVideoDevices() {
1013 try {
1014 Decoding decoder = sidDoRequest(getAvailableVideoDevices_req)
1015 .endRequest();
1016 GetAvailableVideoDevicesResponse result = new GetAvailableVideoDevicesResponse();
1017 result.deviceNames = decoder.getStringListParm(1, false);
1018 result.devicePaths = decoder.getStringListParm(2, false);
1019 result.count = decoder.getUintParm(3, true);
1020 return result;
1021 } catch(IOException e) {
1022 sidOnFatalError(e);
1023 return null
1024 ;}
1025 }
1026 private final static byte[] hasVideoDeviceCapability_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 33};
1027 /** Queries whether the given video device has a specific Video.VIDEO_DEVICE_CAPABILITY. Use Skype.GetAvailableVideoDevices method to retrieve sstring lists with available deviceName and devicePath values. * @param deviceName Human readable device name. * @param devicePath Device ID.
1028 * @param cap Any of the Video.VIDEO_DEVICE_CAPABILITY values.
1029 * @return result
1030 */
1031 public boolean hasVideoDeviceCapability(String deviceName, String devicePath, Video.VideoDeviceCapability cap) {
1032 try {
1033 return sidDoRequest(hasVideoDeviceCapability_req)
1034 .addStringParm(1, deviceName)
1035 .addStringParm(2, devicePath)
1036 .addEnumParm(3, cap)
1037 .endRequest().getBoolParm(1, true);
1038 } catch(IOException e) {
1039 sidOnFatalError(e);
1040 return false
1041 ;}
1042 }
1043 private final static byte[] displayVideoDeviceTuningDialog_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 34};
1044 /**
1045 * displayVideoDeviceTuningDialog
1046 * @param deviceName
1047 * @param devicePath
1048 */
1049 public void displayVideoDeviceTuningDialog(String deviceName, String devicePath) {
1050 try {
1051 sidDoRequest(displayVideoDeviceTuningDialog_req)
1052 .addStringParm(1, deviceName)
1053 .addStringParm(2, devicePath)
1054 .endOneWay();
1055 } catch(IOException e) {
1056 sidOnFatalError(e);
1057 }
1058 }
1059 private final static byte[] getPreviewVideo_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 35};
1060 /** Warning: Will be deprecated soon * @param type
1061 * @param deviceName name and path to be used only with media type VIDEO
1062 * @param devicePath
1063 * @return video
1064 */
1065 public Video getPreviewVideo(Video.MediaType type, String deviceName, String devicePath) {
1066 try {
1067 return (Video) sidDoRequest(getPreviewVideo_req)
1068 .addEnumParm(1, type)
1069 .addStringParm(2, deviceName)
1070 .addStringParm(3, devicePath)
1071 .endRequest().getObjectParm(1, 11, true);
1072 } catch(IOException e) {
1073 sidOnFatalError(e);
1074 return null
1075 ;}
1076 }
1077 private final static byte[] videoCommand_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 59};
1078 /** Avaible to Video Engines using the Video RTP API * @param command
1079 * @return response
1080 */
1081 public String videoCommand(String command) {
1082 try {
1083 return sidDoRequest(videoCommand_req)
1084 .addStringParm(1, command)
1085 .endRequest().getStringParm(1, true);
1086 } catch(IOException e) {
1087 sidOnFatalError(e);
1088 return ""
1089 ;}
1090 }
1091 private final static byte[] startMonitoringQuality_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 140,(byte) 1};
1092 /**
1093 * startMonitoringQuality
1094 * @param withUser if empty, network test results would reflect status of local node only
1095 * @param excludeNetworkTest
1096 */
1097 public void startMonitoringQuality(String withUser, boolean excludeNetworkTest) {
1098 try {
1099 sidDoRequest(startMonitoringQuality_req)
1100 .addStringParm(1, withUser)
1101 .addBoolParm(2, excludeNetworkTest)
1102 .endOneWay();
1103 } catch(IOException e) {
1104 sidOnFatalError(e);
1105 }
1106 }
1107 private final static byte[] stopMonitoringQuality_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 141,(byte) 1};
1108 /**
1109 * stopMonitoringQuality
1110 * @param withUser
1111 * @param justStop
1112 * @return result
1113 */
1114 public QualityTestResult stopMonitoringQuality(String withUser, boolean justStop) {
1115 try {
1116 return (QualityTestResult) sidDoRequest(stopMonitoringQuality_req)
1117 .addStringParm(1, withUser)
1118 .addBoolParm(2, justStop)
1119 .endRequest().getEnumParm(1, QualityTestResult.get(0), true);
1120 } catch(IOException e) {
1121 sidOnFatalError(e);
1122 return QualityTestResult.get(0)
1123 ;}
1124 }
1125 private final static byte[] getGreeting_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 45};
1126 /**
1127 * getGreeting
1128 * @param skypeName
1129 * @return greeting
1130 */
1131 public Voicemail getGreeting(String skypeName) {
1132 try {
1133 return (Voicemail) sidDoRequest(getGreeting_req)
1134 .addStringParm(1, skypeName)
1135 .endRequest().getObjectParm(1, 7, true);
1136 } catch(IOException e) {
1137 sidOnFatalError(e);
1138 return null
1139 ;}
1140 }
1141 private final static byte[] playStart_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 48};
1142 /** Takes audio data that comes from the sound argument and mixes it into playback or notification device, depending on the value passed in the useCallOutDevice argument. The sound argument contains the audio data in in follwing format: first 4 bytes of the binary contain the sample rate, followed by 16 bit (mono) samples. The soundid argument is an arbitrary ID that you can pass in and then later use as an argument for Skype class PlayStop method. To mix the audio into playback device stream, set useCallOutDevice to true, to mic it into notification stream, set useCallOutDevice to false. * @param soundid
1143 * @param sound
1144 * @param loop
1145 * @param useCallOutDevice
1146 */
1147 public void playStart(int soundid, byte[] sound, boolean loop, boolean useCallOutDevice) {
1148 try {
1149 sidDoRequest(playStart_req)
1150 .addUintParm(1, soundid)
1151 .addBinaryParm(2, sound)
1152 .addBoolParm(3, loop)
1153 .addBoolParm(4, useCallOutDevice)
1154 .endOneWay();
1155 } catch(IOException e) {
1156 sidOnFatalError(e);
1157 }
1158 }
1159 private final static byte[] playStartFromFile_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 212,(byte) 1};
1160 /**
1161 * playStartFromFile
1162 * @param soundid
1163 * @param datafile
1164 * @param loop
1165 * @param useCallOutDevice
1166 * @return result
1167 */
1168 public PrepareSoundResult playStartFromFile(int soundid, String datafile, boolean loop, boolean useCallOutDevice) {
1169 try {
1170 return (PrepareSoundResult) sidDoRequest(playStartFromFile_req)
1171 .addUintParm(1, soundid)
1172 .addFilenameParm(2, datafile)
1173 .addBoolParm(3, loop)
1174 .addBoolParm(4, useCallOutDevice)
1175 .endRequest().getEnumParm(1, PrepareSoundResult.get(0), true);
1176 } catch(IOException e) {
1177 sidOnFatalError(e);
1178 return PrepareSoundResult.get(0)
1179 ;}
1180 }
1181 private final static byte[] playStop_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 49};
1182 /** Stops playback of the soundfile. The argument is the same ID you passed in the Skype class StartPlayback method. * @param soundid
1183 */
1184 public void playStop(int soundid) {
1185 try {
1186 sidDoRequest(playStop_req)
1187 .addUintParm(1, soundid)
1188 .endOneWay();
1189 } catch(IOException e) {
1190 sidOnFatalError(e);
1191 }
1192 }
1193 private final static byte[] startRecordingTest_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 50};
1194 /**
1195 * startRecordingTest
1196 * @param recordAndPlaybackData
1197 */
1198 public void startRecordingTest(boolean recordAndPlaybackData) {
1199 try {
1200 sidDoRequest(startRecordingTest_req)
1201 .addBoolParm(1, recordAndPlaybackData)
1202 .endOneWay();
1203 } catch(IOException e) {
1204 sidOnFatalError(e);
1205 }
1206 }
1207 private final static byte[] stopRecordingTest_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 51};
1208 /**
1209 * stopRecordingTest
1210 */
1211 public void stopRecordingTest() {
1212 try {
1213 sidDoRequest(stopRecordingTest_req)
1214 .endOneWay();
1215 } catch(IOException e) {
1216 sidOnFatalError(e);
1217 }
1218 }
1219 private final static byte[] getAvailableOutputDevices_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 53};
1220 public class GetAvailableOutputDevicesResponse {
1221 public String[] handleList;
1222 public String[] nameList;
1223 public String[] productIdList;
1224 };
1225
1226 /** This method returns a table in form of three string lists of equal lengths. The first list contains audio output device handles ('hw:0,0', 'hw:0,1', etc.) The second list contains descriptive names of those devices (Ensoniq AudioPCI etc.) The third list contains device product IDs. Note that the values in these lists depend on which audio engine you are running (SAL, PCM, RTP). * @return GetAvailableOutputDevicesResponse
1227 * <br> - handleList
1228 * <br> - nameList
1229 * <br> - productIdList
1230 */
1231 public GetAvailableOutputDevicesResponse getAvailableOutputDevices() {
1232 try {
1233 Decoding decoder = sidDoRequest(getAvailableOutputDevices_req)
1234 .endRequest();
1235 GetAvailableOutputDevicesResponse result = new GetAvailableOutputDevicesResponse();
1236 result.handleList = decoder.getStringListParm(1, false);
1237 result.nameList = decoder.getStringListParm(2, false);
1238 result.productIdList = decoder.getStringListParm(3, true);
1239 return result;
1240 } catch(IOException e) {
1241 sidOnFatalError(e);
1242 return null
1243 ;}
1244 }
1245 private final static byte[] getAvailableRecordingDevices_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 54};
1246 public class GetAvailableRecordingDevicesResponse {
1247 public String[] handleList;
1248 public String[] nameList;
1249 public String[] productIdList;
1250 };
1251
1252 /** This method returns a table in form of three string lists of equal length. The first list contains audio recording device handles ('hw:0,0', 'hw:0,1', etc.) The second list contains descriptive names of those devices (Ensoniq AudioPCI etc.) The third list contains device product IDs. Note that the values in these lists depend on which audio engine you are running (SAL, PCM, RTP). * @return GetAvailableRecordingDevicesResponse * <br> - handleList
1253 * <br> - nameList
1254 * <br> - productIdList
1255 */
1256 public GetAvailableRecordingDevicesResponse getAvailableRecordingDevices() {
1257 try {
1258 Decoding decoder = sidDoRequest(getAvailableRecordingDevices_req)
1259 .endRequest();
1260 GetAvailableRecordingDevicesResponse result = new GetAvailableRecordingDevicesResponse();
1261 result.handleList = decoder.getStringListParm(1, false);
1262 result.nameList = decoder.getStringListParm(2, false);
1263 result.productIdList = decoder.getStringListParm(3, true);
1264 return result;
1265 } catch(IOException e) {
1266 sidOnFatalError(e);
1267 return null
1268 ;}
1269 }
1270 private final static byte[] selectSoundDevices_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 55};
1271 /** Sets audio devices given in arguments as active audio devices. This command selects all three devices - microphone, playback and the notification channel. Valid input values for this method come from the first string list you get back from Skype class GetAvailableOutputDevices (handleList). * @param callInDevice
1272 * @param callOutDevice
1273 * @param waveOutDevice
1274 */
1275 public void selectSoundDevices(String callInDevice, String callOutDevice, String waveOutDevice) {
1276 try {
1277 sidDoRequest(selectSoundDevices_req)
1278 .addStringParm(1, callInDevice)
1279 .addStringParm(2, callOutDevice)
1280 .addStringParm(3, waveOutDevice)
1281 .endOneWay();
1282 } catch(IOException e) {
1283 sidOnFatalError(e);
1284 }
1285 }
1286 private final static byte[] getAudioDeviceCapabilities_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 56};
1287 public class GetAudioDeviceCapabilitiesResponse {
1288 public String interfaceString;
1289 public int capabilities;
1290 };
1291
1292 /** The uint argument returns AUDIODEVICE_CAPABILITIES (declared in Skype class) * @param deviceHandle
1293 * @return GetAudioDeviceCapabilitiesResponse
1294 * <br> - interfaceString
1295 * <br> - capabilities bit set of AUDIODEVICE_CAPABILITIES
1296 */
1297 public GetAudioDeviceCapabilitiesResponse getAudioDeviceCapabilities(String deviceHandle) {
1298 try {
1299 Decoding decoder = sidDoRequest(getAudioDeviceCapabilities_req)
1300 .addStringParm(1, deviceHandle)
1301 .endRequest();
1302 GetAudioDeviceCapabilitiesResponse result = new GetAudioDeviceCapabilitiesResponse();
1303 result.interfaceString = decoder.getStringParm(1, false);
1304 result.capabilities = decoder.getUintParm(2, true);
1305 return result;
1306 } catch(IOException e) {
1307 sidOnFatalError(e);
1308 return null
1309 ;}
1310 }
1311 private final static byte[] getNrgLevels_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 57};
1312 public class GetNrgLevelsResponse {
1313 public int micLevel;
1314 public int speakerLevel;
1315 };
1316
1317 /** Returns current audio stream volume for both playback and microphone streams. Useful for displaying visual audio indicators in you UI. See also Skype class OnNrgLevelsChange callback that gets fired each time the these values are changed. * @return GetNrgLevelsResponse
1318 * <br> - micLevel
1319 * <br> - speakerLevel
1320 */
1321 public GetNrgLevelsResponse getNrgLevels() {
1322 try {
1323 Decoding decoder = sidDoRequest(getNrgLevels_req)
1324 .endRequest();
1325 GetNrgLevelsResponse result = new GetNrgLevelsResponse();
1326 result.micLevel = decoder.getUintParm(1, false);
1327 result.speakerLevel = decoder.getUintParm(2, true);
1328 return result;
1329 } catch(IOException e) {
1330 sidOnFatalError(e);
1331 return null
1332 ;}
1333 }
1334 private final static byte[] voiceCommand_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 58};
1335 /** NB! This command only works if its implemented in external audiohost (RTP or PCM host). The command can be is used for passing custom commands from client UI to the audio implementation. * @param command
1336 * @return response
1337 */
1338 public String voiceCommand(String command) {
1339 try {
1340 return sidDoRequest(voiceCommand_req)
1341 .addStringParm(1, command)
1342 .endRequest().getStringParm(1, true);
1343 } catch(IOException e) {
1344 sidOnFatalError(e);
1345 return ""
1346 ;}
1347 }
1348 private final static byte[] getSpeakerVolume_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 60};
1349 /** Returns value of audio playback volume setting (0..100). * @return volume
1350 */
1351 public int getSpeakerVolume() {
1352 try {
1353 return sidDoRequest(getSpeakerVolume_req)
1354 .endRequest().getUintParm(1, true);
1355 } catch(IOException e) {
1356 sidOnFatalError(e);
1357 return 0
1358 ;}
1359 }
1360 private final static byte[] setSpeakerVolume_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 61};
1361 /** This method is for setting speaker volume. It will set the level for Skype digital gain control. Skype audio library will not control gain of audio device itself. * @param volume
1362 */
1363 public void setSpeakerVolume(int volume) {
1364 try {
1365 sidDoRequest(setSpeakerVolume_req)
1366 .addUintParm(1, volume)
1367 .endOneWay();
1368 } catch(IOException e) {
1369 sidOnFatalError(e);
1370 }
1371 }
1372 private final static byte[] getMicVolume_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 62};
1373 /** Returns value of microphone volume setting (0..100). It will return the analog gain of audio device set by Skype AGC. For real-time microphone volume, use GetNrgLevels method or OnNrgLevelsChange callback (both are methods of Skype class). * @return micVolume
1374 */
1375 public int getMicVolume() {
1376 try {
1377 return sidDoRequest(getMicVolume_req)
1378 .endRequest().getUintParm(1, true);
1379 } catch(IOException e) {
1380 sidOnFatalError(e);
1381 return 0
1382 ;}
1383 }
1384 private final static byte[] setMicVolume_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 63};
1385 /** This method is for setting the microphone volume level. This does not work when Skype AGC (Automatic Gain Control) is enabled, which it is by default. It is currently impossible to disable AGC, so for now this method is here for purpose of future compatibility. * @param volume
1386 */
1387 public void setMicVolume(int volume) {
1388 try {
1389 sidDoRequest(setMicVolume_req)
1390 .addUintParm(1, volume)
1391 .endOneWay();
1392 } catch(IOException e) {
1393 sidOnFatalError(e);
1394 }
1395 }
1396 private final static byte[] isSpeakerMuted_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 64};
1397 /** Returns true in &muted argument if the currently selected playback device is muted. * @return muted
1398 */
1399 public boolean isSpeakerMuted() {
1400 try {
1401 return sidDoRequest(isSpeakerMuted_req)
1402 .endRequest().getBoolParm(1, true);
1403 } catch(IOException e) {
1404 sidOnFatalError(e);
1405 return false
1406 ;}
1407 }
1408 private final static byte[] isMicrophoneMuted_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 65};
1409 /** Returns true in &muted argument if the currently selected microphone is muted. * @return muted
1410 */
1411 public boolean isMicrophoneMuted() {
1412 try {
1413 return sidDoRequest(isMicrophoneMuted_req)
1414 .endRequest().getBoolParm(1, true);
1415 } catch(IOException e) {
1416 sidOnFatalError(e);
1417 return false
1418 ;}
1419 }
1420 private final static byte[] muteSpeakers_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 66};
1421 /** Sets currently selected playback device mute status according to argument. * @param mute
1422 */
1423 public void muteSpeakers(boolean mute) {
1424 try {
1425 sidDoRequest(muteSpeakers_req)
1426 .addBoolParm(1, mute)
1427 .endOneWay();
1428 } catch(IOException e) {
1429 sidOnFatalError(e);
1430 }
1431 }
1432 private final static byte[] muteMicrophone_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 67};
1433 /** Sets currently selected microphone mute status according to argument. * @param mute
1434 */
1435 public void muteMicrophone(boolean mute) {
1436 try {
1437 sidDoRequest(muteMicrophone_req)
1438 .addBoolParm(1, mute)
1439 .endOneWay();
1440 } catch(IOException e) {
1441 sidOnFatalError(e);
1442 }
1443 }
1444 private final static byte[] setOperatingMedia_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 255,(byte) 1};
1445 /**
1446 * setOperatingMedia
1447 * @param media
1448 * @param maxUplinkBps
1449 * @param maxDownlinkBps
1450 */
1451 public void setOperatingMedia(OperatingMedia media, int maxUplinkBps, int maxDownlinkBps) {
1452 try {
1453 sidDoRequest(setOperatingMedia_req)
1454 .addEnumParm(1, media)
1455 .addUintParm(2, maxUplinkBps)
1456 .addUintParm(3, maxDownlinkBps)
1457 .endOneWay();
1458 } catch(IOException e) {
1459 sidOnFatalError(e);
1460 }
1461 }
1462 private final static byte[] requestConfirmationCode_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 29};
1463 /** creates and sends a CONFIRMATION_CODE_REQUEST message this sends a confirmation code to the number provided * @param type
1464 * @param number
1465 * @return sms
1466 */
1467 public Sms requestConfirmationCode(Sms.ConfirmType type, String number) { try {
1468 return (Sms) sidDoRequest(requestConfirmationCode_req)
1469 .addEnumParm(1, type)
1470 .addStringParm(2, number)
1471 .endRequest().getObjectParm(1, 12, true);
1472 } catch(IOException e) {
1473 sidOnFatalError(e);
1474 return null
1475 ;}
1476 }
1477 private final static byte[] submitConfirmationCode_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 30};
1478 /** creates and sends a CONFIRMATION_CODE_SUBMIT message this authorizes the number with the server for the purpose given in RequestConfirmationCode * @param number
1479 * @param code
1480 * @return sms
1481 */
1482 public Sms submitConfirmationCode(String number, String code) {
1483 try {
1484 return (Sms) sidDoRequest(submitConfirmationCode_req)
1485 .addStringParm(1, number)
1486 .addStringParm(2, code)
1487 .endRequest().getObjectParm(1, 12, true);
1488 } catch(IOException e) {
1489 sidOnFatalError(e);
1490 return null
1491 ;}
1492 }
1493 private final static byte[] createOutgoingSms_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 70};
1494 /** creates an OUTGOING/COMPOSING SMS message * @return sms
1495 */
1496 public Sms createOutgoingSms() {
1497 try {
1498 return (Sms) sidDoRequest(createOutgoingSms_req)
1499 .endRequest().getObjectParm(1, 12, true);
1500 } catch(IOException e) {
1501 sidOnFatalError(e);
1502 return null
1503 ;}
1504 }
1505 private final static byte[] getAccount_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 115};
1506 /** Retrieves an Account object by Skype name (identity). This should normally be one of the first method calls after Skype object initialization. Nearly all the other methods require successful account login in order to work properly. The list of accounts that have been used on the local machine/database can be retrieved with Skype.GetExistingAccounts method. If a matching identity is not found, a new Account object is created. This object can then be used to populate requred fields and then use Account.Register method for new account creation. This method returns false on error. * @param identity Account skypename.
1507 * @return account Returns account object if successful.
1508 */
1509 public Account getAccount(String identity) {
1510 try {
1511 return (Account) flushCache(sidDoRequest(getAccount_req)
1512 .addStringParm(1, identity)
1513 .endRequest().getObjectParm(1, 5, true));
1514 } catch(IOException e) {
1515 sidOnFatalError(e);
1516 return null
1517 ;}
1518 }
1519 private final static byte[] getExistingAccounts_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 113};
1520 /** Returns a list of possible profiles used before on this machine * @return accountNameList
1521 */
1522 public String[] getExistingAccounts() {
1523 try {
1524 return sidDoRequest(getExistingAccounts_req)
1525 .endRequest().getStringListParm(1, true);
1526 } catch(IOException e) {
1527 sidOnFatalError(e);
1528 return null
1529 ;}
1530 }
1531 private final static byte[] getDefaultAccountName_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 114};
1532 /** return most recently used account that has pwd saved. empty string if none * @return account
1533 */
1534 public String getDefaultAccountName() {
1535 try {
1536 return sidDoRequest(getDefaultAccountName_req)
1537 .endRequest().getStringParm(1, true);
1538 } catch(IOException e) {
1539 sidOnFatalError(e);
1540 return ""
1541 ;}
1542 }
1543 private final static byte[] getSuggestedSkypename_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 116};
1544 /** suggest a nice skypename to go with given fullname * @param fullname
1545 * @return suggestedName
1546 */
1547 public String getSuggestedSkypename(String fullname) {
1548 try {
1549 return sidDoRequest(getSuggestedSkypename_req)
1550 .addStringParm(1, fullname)
1551 .endRequest().getStringParm(1, true);
1552 } catch(IOException e) {
1553 sidOnFatalError(e);
1554 return ""
1555 ;}
1556 }
1557 private final static byte[] validateAvatar_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 119};
1558 public class ValidateAvatarResponse {
1559 public Validateresult result;
1560 public int freeBytesLeft;
1561 };
1562
1563 /**
1564 * validateAvatar
1565 * @param value
1566 * @return ValidateAvatarResponse
1567 * <br> - result
1568 * <br> - freeBytesLeft
1569 */
1570 public ValidateAvatarResponse validateAvatar(byte[] value) {
1571 try {
1572 Decoding decoder = sidDoRequest(validateAvatar_req)
1573 .addBinaryParm(1, value)
1574 .endRequest();
1575 ValidateAvatarResponse result = new ValidateAvatarResponse();
1576 result.result = (Validateresult) decoder.getEnumParm(1, Validateresult.get(0), false);
1577 result.freeBytesLeft = decoder.getIntParm(2, true);
1578 return result;
1579 } catch(IOException e) {
1580 sidOnFatalError(e);
1581 return null
1582 ;}
1583 }
1584 private final static byte[] validateProfileString_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 102};
1585 public class ValidateProfileStringResponse {
1586 public Validateresult result;
1587 public int freeBytesLeft;
1588 };
1589
1590 /** This method should be used for validating skypenames before registering new accounts, if the propKey is set to SKYPENAME (Contact class) and forRegistration argument is set to true. If the forRegistration argument is false, only string length check is applied. It is also useful to probe, what the size limits are, for each string property (e.g. 300 characters for moodmessage) * @param propKey
1591 * @param strValue
1592 * @param forRegistration
1593 * @return ValidateProfileStringResponse
1594 * <br> - result
1595 * <br> - freeBytesLeft
1596 */
1597 public ValidateProfileStringResponse validateProfileString(int propKey, String strValue, boolean forRegistration) {
1598 try {
1599 Decoding decoder = sidDoRequest(validateProfileString_req)
1600 .addEnumParm(1, propKey)
1601 .addStringParm(2, strValue)
1602 .addBoolParm(3, forRegistration)
1603 .endRequest();
1604 ValidateProfileStringResponse result = new ValidateProfileStringResponse();
1605 result.result = (Validateresult) decoder.getEnumParm(1, Validateresult.get(0), false);
1606 result.freeBytesLeft = decoder.getIntParm(2, true);
1607 return result;
1608 } catch(IOException e) {
1609 sidOnFatalError(e);
1610 return null
1611 ;}
1612 }
1613 private final static byte[] validatePassword_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 71};
1614 /** This method is for pre-validating account passwords before account creation or password change. The result will return either VALIDATED_OK or one of many possible reasons the password is unacceptable (too short, too simple, etc.) * @param username
1615 * @param password
1616 * @return result
1617 */
1618 public Validateresult validatePassword(String username, String password) {
1619 try {
1620 return (Validateresult) sidDoRequest(validatePassword_req)
1621 .addStringParm(1, username)
1622 .addStringParm(2, password)
1623 .endRequest().getEnumParm(1, Validateresult.get(0), true);
1624 } catch(IOException e) {
1625 sidOnFatalError(e);
1626 return Validateresult.get(0)
1627 ;}
1628 }
1629 private final static byte[] getUsedPort_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 130,(byte) 1};
1630 /** port that lib ended up listening. usually equal to SETUPKEY_PORT. 0 if none used (disconnected or binding failed) * @return port
1631 */
1632 public int getUsedPort() {
1633 try {
1634 return sidDoRequest(getUsedPort_req)
1635 .endRequest().getUintParm(1, true);
1636 } catch(IOException e) {
1637 sidOnFatalError(e);
1638 return 0
1639 ;}
1640 }
1641 private final static byte[] getStr_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 120};
1642 /** This is used for retrieving local setup keys of type string. For more information, see Defines section in the skype-embedded_2.h * @param key
1643 * @return value
1644 */
1645 public String getStr(String key) {
1646 try {
1647 return sidDoRequest(getStr_req)
1648 .addStringParm(1, key)
1649 .endRequest().getStringParm(1, true);
1650 } catch(IOException e) {
1651 sidOnFatalError(e);
1652 return ""
1653 ;}
1654 }
1655 private final static byte[] getInt_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 121};
1656 /** This is used for retrieving local setup keys of type int. For more information, see Defines section in the skype-embedded_2.h * @param key
1657 * @return value
1658 */
1659 public int getInt(String key) {
1660 try {
1661 return sidDoRequest(getInt_req)
1662 .addStringParm(1, key)
1663 .endRequest().getIntParm(1, true);
1664 } catch(IOException e) {
1665 sidOnFatalError(e);
1666 return 0
1667 ;}
1668 }
1669 private final static byte[] getBin_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 122};
1670 /** This is used for retrieving local setup keys of type binary. For more information, see Defines section in the skype-embedded_2.h * @param key
1671 * @return value
1672 */
1673 public byte[] getBin(String key) {
1674 try {
1675 return sidDoRequest(getBin_req)
1676 .addStringParm(1, key) .endRequest().getBinaryParm(1, true);
1677 } catch(IOException e) {
1678 sidOnFatalError(e);
1679 return null
1680 ;}
1681 }
1682 private final static byte[] setStr_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 123};
1683 /** This is used for setting local setup keys of type string. For more information, see Defines section in the skype-embedded_2.h * @param key
1684 * @param value
1685 */
1686 public void setStr(String key, String value) {
1687 try {
1688 sidDoRequest(setStr_req)
1689 .addStringParm(1, key)
1690 .addStringParm(2, value)
1691 .endOneWay();
1692 } catch(IOException e) {
1693 sidOnFatalError(e);
1694 }
1695 }
1696 private final static byte[] setInt_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 124};
1697 /** This is used for setting local setup keys of type int. For more information, see Defines section in the skype-embedded_2.h * @param key
1698 * @param value
1699 */
1700 public void setInt(String key, int value) {
1701 try {
1702 sidDoRequest(setInt_req)
1703 .addStringParm(1, key)
1704 .addIntParm(2, value)
1705 .endOneWay();
1706 } catch(IOException e) {
1707 sidOnFatalError(e);
1708 }
1709 }
1710 private final static byte[] setBin_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 125};
1711 /** This is used for setting local setup keys of type binary. For more information, see Defines section in the skype-embedded_2.h * @param key
1712 * @param value
1713 */
1714 public void setBin(String key, byte[] value) {
1715 try {
1716 sidDoRequest(setBin_req)
1717 .addStringParm(1, key)
1718 .addBinaryParm(2, value)
1719 .endOneWay();
1720 } catch(IOException e) {
1721 sidOnFatalError(e);
1722 }
1723 }
1724 private final static byte[] isDefined_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 126};
1725 /** Returns true if the given setup key is defined in local setup. For more information, see Defines section in the skype-embedded_2.h * @param key
1726 * @return value
1727 */
1728 public boolean isDefined(String key) {
1729 try {
1730 return sidDoRequest(isDefined_req)
1731 .addStringParm(1, key)
1732 .endRequest().getBoolParm(1, true);
1733 } catch(IOException e) {
1734 sidOnFatalError(e);
1735 return false
1736 ;}
1737 }
1738 private final static byte[] delete_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 127};
1739 /**
1740 * delete
1741 * @param key
1742 */
1743 public void delete(String key) {
1744 try {
1745 sidDoRequest(delete_req)
1746 .addStringParm(1, key)
1747 .endOneWay();
1748 } catch(IOException e) {
1749 sidOnFatalError(e);
1750 }
1751 }
1752 private final static byte[] getSubKeys_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 128,(byte) 1};
1753 /**
1754 * getSubKeys
1755 * @param key
1756 * @return value
1757 */
1758 public String[] getSubKeys(String key) {
1759 try {
1760 return sidDoRequest(getSubKeys_req)
1761 .addStringParm(1, key)
1762 .endRequest().getStringListParm(1, true);
1763 } catch(IOException e) {
1764 sidOnFatalError(e);
1765 return null
1766 ;}
1767 }
1768 private final static byte[] getIsoLanguageInfo_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 207,(byte) 1};
1769 public class GetIsoLanguageInfoResponse {
1770 public String[] languageCodeList;
1771 public String[] languageNameList;
1772 };
1773
1774 /** Returns two string lists. First of them will contain list of two-letter language codes (ISO 639-1) The second list contains names of corresponding languages. * @return GetIsoLanguageInfoResponse
1775 * <br> - languageCodeList
1776 * <br> - languageNameList assumes UI has set correct language
1777 */
1778 public GetIsoLanguageInfoResponse getIsoLanguageInfo() {
1779 try {
1780 Decoding decoder = sidDoRequest(getIsoLanguageInfo_req)
1781 .endRequest();
1782 GetIsoLanguageInfoResponse result = new GetIsoLanguageInfoResponse();
1783 result.languageCodeList = decoder.getStringListParm(1, false);
1784 result.languageNameList = decoder.getStringListParm(2, true);
1785 return result;
1786 } catch(IOException e) {
1787 sidOnFatalError(e);
1788 return null
1789 ;}
1790 }
1791 private final static byte[] getIsoCountryInfo_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 208,(byte) 1};
1792 public class GetIsoCountryInfoResponse {
1793 public String[] countryCodeList;
1794 public String[] countryNameList;
1795 public int[] countryPrefixList;
1796 public String[] countryDialExampleList;
1797 };
1798
1799 /** Returns three string lists and one int array, containing 2-letter country code, country name, dialing prefix and example dial string (not available for all items). This method does currently return 0 for South Georgia and the South Sandwich Islands. * @return GetIsoCountryInfoResponse
1800 * <br> - countryCodeList
1801 * <br> - countryNameList assumes UI has set correct language
1802 * <br> - countryPrefixList
1803 * <br> - countryDialExampleList
1804 */
1805 public GetIsoCountryInfoResponse getIsoCountryInfo() {
1806 try {
1807 Decoding decoder = sidDoRequest(getIsoCountryInfo_req)
1808 .endRequest();
1809 GetIsoCountryInfoResponse result = new GetIsoCountryInfoResponse();
1810 result.countryCodeList = decoder.getStringListParm(1, false);
1811 result.countryNameList = decoder.getStringListParm(2, false);
1812 result.countryPrefixList = decoder.getUintListParm(3, false);
1813 result.countryDialExampleList = decoder.getStringListParm(4, true);
1814 return result;
1815 } catch(IOException e) {
1816 sidOnFatalError(e);
1817 return null
1818 ;}
1819 }
1820 private final static byte[] getIsoCountryCodeByPhoneNo_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 211,(byte) 1};
1821 /** Returns 2-letter country code based on PSTN number. The input argument has to be without + in from of it - '37212345678' will return 'ee' while '+37212345678' will return an empty string. * @param number
1822 * @return countryCode
1823 */
1824 public String getIsoCountryCodeByPhoneNo(String number) {
1825 try {
1826 return sidDoRequest(getIsoCountryCodeByPhoneNo_req)
1827 .addStringParm(1, number)
1828 .endRequest().getStringParm(1, true);
1829 } catch(IOException e) {
1830 sidOnFatalError(e);
1831 return ""
1832 ;}
1833 }
1834 private final static byte[] app2AppCreate_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 215,(byte) 1};
1835 /**
1836 * App2AppCreate method constructs a local instance of an App2App application. App2App applications are not abstracted in the SkypeKit API as a separate class. Rather, they can be created with App2AppCreate, supplying their name as ID, and then connected to remote parties using App2AppConnect method.
1837 *
1838 * App2App portion of the SkypeKit API enables you to implement arbitrary data exchange protocols between Skype clients. Basically, if you are ever tempted to use conversation chat messages for something other than actual human-readable chat - you should consider using your own custom App2App protocol instead.
1839 *
1840 * The downside of App2App is that all the participants need to be running a client that supports the same App2App application. Although, it is possible to have one side using a custom SkypeKit client and another side using Skype desktop client - App2App is supported in both, in case of desktop client via Public API - you are still limited to remote side running something that can recognize your protocol and react to connection attempts from your side.
1841 *
1842 * To establish connection between each other, all participants need to create their local instances of the application (with the same ID, and then connect to each other. More than one App2App applications can be active in a local client at the same time. Also, more than two clients can be connected with the same application.
1843 *
1844 * Once connection is established, you can choose between two communication methods - datagrams and stream read/write methods. Overall, there are not much principal difference between the two. Datagram packet size is limited to 1500 bytes and stream packet size to 32 KB of payload data. Implementation-wise, datagrams are probably somewhat easier to deal with.
1845 * @param appname Application ID. This ID is used by the rest of the App2App commands to differentiate between applications, should there be more than one app2app applications running on the local system.
1846 * @return result Returns true if the app creation was successful. Returns false when an application with the same name already exists in the local system.
1847 */
1848 public boolean app2AppCreate(String appname) {
1849 try {
1850 return sidDoRequest(app2AppCreate_req)
1851 .addStringParm(1, appname)
1852 .endRequest().getBoolParm(1, true);
1853 } catch(IOException e) {
1854 sidOnFatalError(e);
1855 return false
1856 ;}
1857 }
1858 private final static byte[] app2AppDelete_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 216,(byte) 1};
1859 /** Disconnects and deletes the App2App application. * @param appname application ID. * @return result Returns true if the deletion was successful (application with such ID actually existed)
1860 */
1861 public boolean app2AppDelete(String appname) {
1862 try {
1863 return sidDoRequest(app2AppDelete_req)
1864 .addStringParm(1, appname)
1865 .endRequest().getBoolParm(1, true);
1866 } catch(IOException e) {
1867 sidOnFatalError(e);
1868 return false
1869 ;}
1870 }
1871 private final static byte[] app2AppConnect_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 217,(byte) 1};
1872 /** The App2AppConnect connect result does not mean the connection was immediately established. It will return Ok even if the remote party was offline. The actual connection will be established when both parties have fired App2AppConnect with the same application name, at eachother. At that point, OnApp2AppStreamListChange event will fire for both local and remote party (with listType argument set to ALL_STREAMS) and you can start exchanging data, using either App2App datagrams or App2AppRead App2AppWrite methods. * @param appname Application ID. This needs to match with application ID connecting from the remote side.
1873 * @param skypename Skype Name of the remote party.
1874 * @return result NB! This argument will return true even if the remote party has not yet connected (or is not even online yet) - it merely indicates that the connect command was successfuly processed in runtime. The actual connection success will be indicated when the OnApp2AppStreamListChange event fires, i.e. when App2App stream will be established between connecting parties.
1875 */
1876 public boolean app2AppConnect(String appname, String skypename) {
1877 try {
1878 return sidDoRequest(app2AppConnect_req)
1879 .addStringParm(1, appname)
1880 .addStringParm(2, skypename)
1881 .endRequest().getBoolParm(1, true);
1882 } catch(IOException e) {
1883 sidOnFatalError(e);
1884 return false
1885 ;}
1886 }
1887 private final static byte[] app2AppDisconnect_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 218,(byte) 1};
1888 /** Disconnects an App2App stream. This is different from App2AppDelete command in that it enables you to disconnect remote parties selectively - in case there are more than two participants in the App2App stream pool. * @param appname application ID
1889 * @param stream stream ID.
1890 * @return result returns true when the stream disconnect was successful.
1891 */
1892 public boolean app2AppDisconnect(String appname, String stream) {
1893 try {
1894 return sidDoRequest(app2AppDisconnect_req)
1895 .addStringParm(1, appname)
1896 .addStringParm(2, stream)
1897 .endRequest().getBoolParm(1, true);
1898 } catch(IOException e) {
1899 sidOnFatalError(e);
1900 return false
1901 ;}
1902 }
1903 private final static byte[] app2AppWrite_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 219,(byte) 1};
1904 /** Sends a stream packet to the remote party specified in the stream argument. The max size of stream write packet is 32KB. After calling this method, OnApp2AppStreamListChange will fire for both parties. In local ssytem with listType set to SENDING_STREAMS and on remote system with listType set to RECEIVED_STREAMS. This event can be used to read received packets out of the stream. * @param appname application ID
1905 * @param stream stream ID
1906 * @param data packet payload
1907 * @return result returns true if the call was successful. Note that this does indicate the packet was actually received by remote party.
1908 */
1909 public boolean app2AppWrite(String appname, String stream, byte[] data) {
1910 try {
1911 return sidDoRequest(app2AppWrite_req)
1912 .addStringParm(1, appname)
1913 .addStringParm(2, stream)
1914 .addBinaryParm(3, data)
1915 .endRequest().getBoolParm(1, true);
1916 } catch(IOException e) {
1917 sidOnFatalError(e);
1918 return false
1919 ;}
1920 }
1921 private final static byte[] app2AppDatagram_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 220,(byte) 1};
1922 /** Sends a datagram to the remote party specified in the stream argument. The max size of datagram payload is 1500 bytes. * @param appname application ID - from App2AppCreate
1923 * @param stream stream ID - either from App2AppGetStreamsList or from OnApp2AppStreamListChange
1924 * @param data datagram payload (max 1500 bytes)
1925 * @return result returns true on method success. Note that this does mean the remote party has actually received your datagram - that sort of feedback, should you want it, is up to you to implement in your custom protocol.
1926 */
1927 public boolean app2AppDatagram(String appname, String stream, byte[] data) {
1928 try {
1929 return sidDoRequest(app2AppDatagram_req)
1930 .addStringParm(1, appname)
1931 .addStringParm(2, stream)
1932 .addBinaryParm(3, data)
1933 .endRequest().getBoolParm(1, true);
1934 } catch(IOException e) {
1935 sidOnFatalError(e);
1936 return false
1937 ;}
1938 }
1939 private final static byte[] app2AppRead_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 221,(byte) 1};
1940 public class App2AppReadResponse {
1941 public boolean result;
1942 public byte[] data;
1943 };
1944
1945 /** Reads data from the specified stream. This method should be called from the OnApp2AppStreamListChange event callback, when this callback gets fired with listType argument set to RECEIVED_STREAMS. * @param appname application ID
1946 * @param stream stream ID
1947 * @return App2AppReadResponse
1948 * <br> - result returns true on method success. Note that this does mean the remote party has actually received your packet - that sort of feedback, should you want it, is up to you to implement in your custom protocol.
1949 * <br> - data stream packet payload
1950 */
1951 public App2AppReadResponse app2AppRead(String appname, String stream) {
1952 try {
1953 Decoding decoder = sidDoRequest(app2AppRead_req)
1954 .addStringParm(1, appname)
1955 .addStringParm(2, stream)
1956 .endRequest();
1957 App2AppReadResponse result = new App2AppReadResponse();
1958 result.result = decoder.getBoolParm(1, false);
1959 result.data = decoder.getBinaryParm(2, true);
1960 return result;
1961 } catch(IOException e) {
1962 sidOnFatalError(e);
1963 return null
1964 ;}
1965 }
1966 private final static byte[] app2AppGetConnectableUsers_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 222,(byte) 1};
1967 public class App2AppGetConnectableUsersResponse {
1968 public boolean result;
1969 public String[] users;
1970 };
1971
1972 /** App2AppGetConnectableUsers returns a list of currently online contacts. It does not return a list of contacts who have an app2app application running. There is currently no way of querying whether an application has been launched on the remote side - other than trying to connect to the remote side and waiting for timeout. NB! if you use App2AppGetConnectableUsers immediately after login - then the online presence of your contact list has not yet updated itself - so this method will most likely return either an empty list or a list with echo123 in it. * @param appname application ID
1973 * @return App2AppGetConnectableUsersResponse
1974 * <br> - result returns true on method success
1975 * <br> - users stringlist with Skype Names of connectable users
1976 */
1977 public App2AppGetConnectableUsersResponse app2AppGetConnectableUsers(String appname) {
1978 try {
1979 Decoding decoder = sidDoRequest(app2AppGetConnectableUsers_req)
1980 .addStringParm(1, appname)
1981 .endRequest();
1982 App2AppGetConnectableUsersResponse result = new App2AppGetConnectableUsersResponse();
1983 result.result = decoder.getBoolParm(1, false);
1984 result.users = decoder.getStringListParm(2, true);
1985 return result;
1986 } catch(IOException e) {
1987 sidOnFatalError(e);
1988 return null
1989 ;}
1990 }
1991 private final static byte[] app2AppGetStreamsList_req = {(byte) 90,(byte) 82,(byte) 0,(byte) 223,(byte) 1};
1992 public class App2AppGetStreamsListResponse {
1993 public boolean result;
1994 public String[] streams;
1995 public int[] receivedSizes;
1996 };
1997
1998 /** Takes application ID and list type filter and returns a stringlist with streamID's that pass the filter. * @param appname application ID
1999 * @param listType list type filter
2000 * @return App2AppGetStreamsListResponse
2001 * <br> - result results true if the method call was successful
2002 * <br> - streams string list with stream IDs
2003 * <br> - receivedSizes For RECEIVED_STREAMS, contains the number of bytes in each stream waiting to be read
2004 */
2005 public App2AppGetStreamsListResponse app2AppGetStreamsList(String appname, App2AppStreams listType) {
2006 try {
2007 Decoding decoder = sidDoRequest(app2AppGetStreamsList_req)
2008 .addStringParm(1, appname) .addEnumParm(2, listType)
2009 .endRequest();
2010 App2AppGetStreamsListResponse result = new App2AppGetStreamsListResponse();
2011 result.result = decoder.getBoolParm(1, false);
2012 result.streams = decoder.getStringListParm(2, false);
2013 result.receivedSizes = decoder.getUintListParm(3, true);
2014 return result;
2015 } catch(IOException e) {
2016 sidOnFatalError(e);
2017 return null
2018 ;}
2019 }
2020 public void sidDispatchEvent(final int modId, final int evId, final Decoding decoder) {
2021 switch (modId) {
2022 case 0: {
2023 if (mSkypeListener!= null) {
2024 switch (evId) {
2025 case 1: {
2026 ContactGroup group;
2027 try {
2028 group = (ContactGroup) decoder.getObjectParm(1, 10, true);
2029 } catch (IOException e) {
2030 sidOnFatalError(e);
2031 return;
2032 }
2033 mSkypeListener.onNewCustomContactGroup(this, group);
2034 return;
2035 }
2036 case 2: {
2037 Contact contact;
2038 try {
2039 contact = (Contact) decoder.getObjectParm(1, 2, true);
2040 } catch (IOException e) {
2041 sidOnFatalError(e);
2042 return;
2043 }
2044 mSkypeListener.onContactOnlineAppearance(this, contact);
2045 return;
2046 }
2047 case 3: {
2048 Contact contact;
2049 try {
2050 contact = (Contact) decoder.getObjectParm(1, 2, true);
2051 } catch (IOException e) {
2052 sidOnFatalError(e);
2053 return;
2054 }
2055 mSkypeListener.onContactGoneOffline(this, contact);
2056 return;
2057 }
2058 case 4: {
2059 Conversation conversation;
2060 Conversation.ListType type;
2061 boolean added;
2062 try {
2063 conversation = (Conversation) decoder.getObjectParm(1, 18, false);
2064 type = (Conversation.ListType) decoder.getEnumParm(2, Conversation.ListType.get(0), false);
2065 added = decoder.getBoolParm(3, true);
2066 } catch (IOException e) {
2067 sidOnFatalError(e);
2068 return;
2069 }
2070 mSkypeListener.onConversationListChange(this, conversation, type, added);
2071 return;
2072 }
2073 case 5: {
2074 Message message;
2075 boolean changesInboxTimestamp;
2076 Message supersedesHistoryMessage;
2077 Conversation conversation;
2078 try {
2079 message = (Message) decoder.getObjectParm(1, 9, false);
2080 changesInboxTimestamp = decoder.getBoolParm(2, false);
2081 supersedesHistoryMessage = (Message) decoder.getObjectParm(3, 9, false);
2082 conversation = (Conversation) decoder.getObjectParm(4, 18, true);
2083 } catch (IOException e) {
2084 sidOnFatalError(e);
2085 return;
2086 }
2087 mSkypeListener.onMessage(this, message, changesInboxTimestamp, supersedesHistoryMessage, conversation);
2088 return;
2089 }
2090 case 7: {
2091 try {
2092 decoder.skipEndOfMessage();
2093 } catch (IOException e) {
2094 sidOnFatalError(e);
2095 return;
2096 }
2097 mSkypeListener.onAvailableVideoDeviceListChange(this);
2098 return;
2099 }
2100 case 44: {
2101 try {
2102 decoder.skipEndOfMessage();
2103 } catch (IOException e) {
2104 sidOnFatalError(e);
2105 return;
2106 }
2107 mSkypeListener.onH264Activated(this);
2108 return;
2109 }
2110 case 28: {
2111 QualityTestType testType;
2112 QualityTestResult testResult;
2113 String withUser;
2114 String details;
2115 String xmlDetails;
2116 try {
2117 testType = (QualityTestType) decoder.getEnumParm(0, QualityTestType.get(0), false);
2118 testResult = (QualityTestResult) decoder.getEnumParm(1, QualityTestResult.get(0), false);
2119 withUser = decoder.getStringParm(2, false);
2120 details = decoder.getStringParm(3, false);
2121 xmlDetails = decoder.getXmlParm(4, true);
2122 } catch (IOException e) {
2123 sidOnFatalError(e);
2124 return;
2125 }
2126 mSkypeListener.onQualityTestResult(this, testType, testResult, withUser, details, xmlDetails);
2127 return;
2128 }
2129 case 10: {
2130 try {
2131 decoder.skipEndOfMessage();
2132 } catch (IOException e) {
2133 sidOnFatalError(e);
2134 return;
2135 }
2136 mSkypeListener.onAvailableDeviceListChange(this);
2137 return;
2138 }
2139 case 11: {
2140 try {
2141 decoder.skipEndOfMessage();
2142 } catch (IOException e) {
2143 sidOnFatalError(e);
2144 return;
2145 }
2146 mSkypeListener.onNrgLevelsChange(this);
2147 return;
2148 }
2149 case 12: {
2150 ProxyType type;
2151 try {
2152 type = (ProxyType) decoder.getEnumParm(1, ProxyType.get(0), true);
2153 } catch (IOException e) {
2154 sidOnFatalError(e);
2155 return;
2156 }
2157 mSkypeListener.onProxyAuthFailure(this, type);
2158 return;
2159 }
2160 case 6: {
2161 String appname;
2162 String stream;
2163 byte[] data;
2164 try {
2165 appname = decoder.getStringParm(1, false);
2166 stream = decoder.getStringParm(2, false);
2167 data = decoder.getBinaryParm(3, true);
2168 } catch (IOException e) {
2169 sidOnFatalError(e);
2170 return;
2171 }
2172 mSkypeListener.onApp2AppDatagram(this, appname, stream, data);
2173 return;
2174 }
2175 case 8: {
2176 String appname;
2177 App2AppStreams listType;
2178 String[] streams;
2179 int[] receivedSizes;
2180 try {
2181 appname = decoder.getStringParm(1, false);
2182 listType = (App2AppStreams) decoder.getEnumParm(2, App2AppStreams.get(0), false);
2183 streams = decoder.getStringListParm(3, false);
2184 receivedSizes = decoder.getUintListParm(4, true);
2185 } catch (IOException e) {
2186 sidOnFatalError(e);
2187 return;
2188 }
2189 mSkypeListener.onApp2AppStreamListChange(this, appname, listType, streams, receivedSizes);
2190 return;
2191 }
2192 }
2193 }
2194 }
2195 break;
2196 case 10:
2197 if (mContactGroupListener != null) {
2198 ContactGroup object = (ContactGroup) sidDecodeEventTarget(modId, decoder);
2199 if (object == null) return;
2200 switch (evId) {
2201 case 1: {
2202 Conversation conversation;
2203 try {
2204 conversation = (Conversation) decoder.getObjectParm(1, 18, true);
2205 } catch (IOException e) {
2206 sidOnFatalError(e);
2207 return;
2208 }
2209 mContactGroupListener.onChangeConversation(object, conversation);
2210 return;
2211 }
2212 case 2: {
2213 Contact contact;
2214 try {
2215 contact = (Contact) decoder.getObjectParm(1, 2, true);
2216 } catch (IOException e) {
2217 sidOnFatalError(e);
2218 return;
2219 }
2220 mContactGroupListener.onChange(object, contact);
2221 return;
2222 }
2223 }
2224 }
2225 break;
2226 case 1:
2227 if (mContactSearchListener != null) {
2228 ContactSearch object = (ContactSearch) sidDecodeEventTarget(modId, decoder);
2229 if (object == null) return;
2230 switch (evId) {
2231 case 1: {
2232 Contact contact;
2233 int rankValue;
2234 try {
2235 contact = (Contact) decoder.getObjectParm(1, 2, false);
2236 rankValue = decoder.getUintParm(2, true);
2237 } catch (IOException e) {
2238 sidOnFatalError(e);
2239 return;
2240 }
2241 mContactSearchListener.onNewResult(object, contact, rankValue);
2242 return;
2243 }
2244 }
2245 }
2246 break;
2247 case 19:
2248 if (mParticipantListener != null) {
2249 Participant object = (Participant) sidDecodeEventTarget(modId, decoder);
2250 if (object == null) return;
2251 switch (evId) {
2252 case 1: {
2253 Participant.Dtmf dtmf;
2254 try {
2255 dtmf = (Participant.Dtmf) decoder.getEnumParm(1, Participant.Dtmf.get(0), true);
2256 } catch (IOException e) {
2257 sidOnFatalError(e);
2258 return;
2259 }
2260 mParticipantListener.onIncomingDtmf(object, dtmf);
2261 return;
2262 }
2263 }
2264 }
2265 break;
2266 case 18:
2267 if (mConversationListener != null) {
2268 Conversation object = (Conversation) sidDecodeEventTarget(modId, decoder);
2269 if (object == null) return;
2270 switch (evId) {
2271 case 1: {
2272 try {
2273 decoder.skipEndOfMessage();
2274 } catch (IOException e) {
2275 sidOnFatalError(e);
2276 return;
2277 }
2278 mConversationListener.onParticipantListChange(object);
2279 return;
2280 }
2281 case 2: {
2282 Message message;
2283 try {
2284 message = (Message) decoder.getObjectParm(1, 9, true);
2285 } catch (IOException e) {
2286 sidOnFatalError(e);
2287 return;
2288 }
2289 mConversationListener.onMessage(object, message);
2290 return;
2291 }
2292 case 3: {
2293 Conversation spawned;
2294 try {
2295 spawned = (Conversation) decoder.getObjectParm(1, 18, true);
2296 } catch (IOException e) {
2297 sidOnFatalError(e);
2298 return;
2299 }
2300 mConversationListener.onSpawnConference(object, spawned);
2301 return;
2302 }
2303 }
2304 }
2305 break;
2306 case 11:
2307 if (mVideoListener != null) {
2308 Video object = (Video) sidDecodeEventTarget(modId, decoder);
2309 if (object == null) return;
2310 switch (evId) {
2311 case 2: {
2312 int requestId; boolean isSuccessful;
2313 byte[] image;
2314 int width;
2315 int height;
2316 try {
2317 requestId = decoder.getUintParm(1, false);
2318 isSuccessful = decoder.getBoolParm(2, false);
2319 image = decoder.getBinaryParm(3, false);
2320 width = decoder.getIntParm(4, false);
2321 height = decoder.getIntParm(5, true);
2322 } catch (IOException e) {
2323 sidOnFatalError(e);
2324 return;
2325 }
2326 mVideoListener.onCaptureRequestCompleted(object, requestId, isSuccessful, image, width, height);
2327 return;
2328 }
2329 }
2330 }
2331 break;
2332 }
2333 try {
2334 decoder.skipEvent(modId);
2335 } catch (IOException e) {
2336 sidOnFatalError(e);
2337 }
2338 }
2339 public void registerContactGroupListener(ContactGroupListener listener) {
2340 mContactGroupListener = listener;
2341 }
2342 public void unRegisterContactGroupListener(ContactGroupListener listener) {
2343 mContactGroupListener = null;
2344 }
2345 public ContactGroupListener getContactGroupListener() {
2346 return mContactGroupListener;
2347 }
2348 private ContactGroupListener mContactGroupListener;
2349 public void registerContactListener(ContactListener listener) {
2350 mContactListener = listener;
2351 }
2352 public void unRegisterContactListener(ContactListener listener) {
2353 mContactListener = null;
2354 }
2355 public ContactListener getContactListener() {
2356 return mContactListener;
2357 }
2358 private ContactListener mContactListener;
2359 public void registerContactSearchListener(ContactSearchListener listener) {
2360 mContactSearchListener = listener;
2361 }
2362 public void unRegisterContactSearchListener(ContactSearchListener listener) {
2363 mContactSearchListener = null;
2364 }
2365 public ContactSearchListener getContactSearchListener() {
2366 return mContactSearchListener;
2367 }
2368 private ContactSearchListener mContactSearchListener;
2369 public void registerParticipantListener(ParticipantListener listener) {
2370 mParticipantListener = listener;
2371 }
2372 public void unRegisterParticipantListener(ParticipantListener listener) {
2373 mParticipantListener = null;
2374 }
2375 public ParticipantListener getParticipantListener() {
2376 return mParticipantListener;
2377 }
2378 private ParticipantListener mParticipantListener;
2379 public void registerConversationListener(ConversationListener listener) {
2380 mConversationListener = listener;
2381 }
2382 public void unRegisterConversationListener(ConversationListener listener) {
2383 mConversationListener = null;
2384 }
2385 public ConversationListener getConversationListener() {
2386 return mConversationListener;
2387 }
2388 private ConversationListener mConversationListener;
2389 public void registerMessageListener(MessageListener listener) {
2390 mMessageListener = listener;
2391 }
2392 public void unRegisterMessageListener(MessageListener listener) {
2393 mMessageListener = null;
2394 }
2395 public MessageListener getMessageListener() {
2396 return mMessageListener;
2397 }
2398 private MessageListener mMessageListener;
2399 public void registerVideoListener(VideoListener listener) {
2400 mVideoListener = listener;
2401 }
2402 public void unRegisterVideoListener(VideoListener listener) {
2403 mVideoListener = null;
2404 }
2405 public VideoListener getVideoListener() {
2406 return mVideoListener;
2407 }
2408 private VideoListener mVideoListener;
2409 public void registerVoicemailListener(VoicemailListener listener) {
2410 mVoicemailListener = listener;
2411 }
2412 public void unRegisterVoicemailListener(VoicemailListener listener) {
2413 mVoicemailListener = null;
2414 }
2415 public VoicemailListener getVoicemailListener() {
2416 return mVoicemailListener;
2417 }
2418 private VoicemailListener mVoicemailListener;
2419 public void registerSmsListener(SmsListener listener) {
2420 mSmsListener = listener;
2421 }
2422 public void unRegisterSmsListener(SmsListener listener) {
2423 mSmsListener = null;
2424 }
2425 public SmsListener getSmsListener() {
2426 return mSmsListener;
2427 }
2428 private SmsListener mSmsListener;
2429 public void registerTransferListener(TransferListener listener) {
2430 mTransferListener = listener;
2431 }
2432 public void unRegisterTransferListener(TransferListener listener) {
2433 mTransferListener = null;
2434 }
2435 public TransferListener getTransferListener() {
2436 return mTransferListener;
2437 }
2438 private TransferListener mTransferListener;
2439 public void registerAccountListener(AccountListener listener) {
2440 mAccountListener = listener;
2441 }
2442 public void unRegisterAccountListener(AccountListener listener) {
2443 mAccountListener = null;
2444 }
2445 public AccountListener getAccountListener() {
2446 return mAccountListener;
2447 }
2448 private AccountListener mAccountListener;
2449 public void registerSkypeListener(SkypeListener listener) {
2450 mSkypeListener = listener;
2451 }
2452 public void unRegisterSkypeListener(SkypeListener listener) {
2453 mSkypeListener = null;
2454 }
2455 public SkypeListener getSkypeListener() {
2456 return mSkypeListener;
2457 }
2458 private SkypeListener mSkypeListener;
2459 public SidObject[] sidGetObjects(int modId, int size) {
2460 switch (modId) {
2461 case 10: return new ContactGroup[size];
2462 case 2: return new Contact[size];
2463 case 1: return new ContactSearch[size];
2464 case 19: return new Participant[size];
2465 case 18: return new Conversation[size];
2466 case 9: return new Message[size];
2467 case 11: return new Video[size];
2468 case 7: return new Voicemail[size];
2469 case 12: return new Sms[size];
2470 case 6: return new Transfer[size];
2471 case 5: return new Account[size];
2472 }
2473 return null;
2474 }
2475
2476 protected SidObject sidCreateObject(int modId, int oid) {
2477 if (oid == 0) return null;
2478 switch (modId) {
2479 case 10: return new ContactGroup(oid, this);
2480 case 2: return new Contact(oid, this);
2481 case 1: return new ContactSearch(oid, this);
2482 case 19: return new Participant(oid, this);
2483 case 18: return new Conversation(oid, this);
2484 case 9: return new Message(oid, this);
2485 case 11: return new Video(oid, this);
2486 case 7: return new Voicemail(oid, this);
2487 case 12: return new Sms(oid, this);
2488 case 6: return new Transfer(oid, this);
2489 case 5: return new Account(oid, this);
2490 }
2491 return null;
2492 }
2493 }