mtc_cli.h
23.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
/************************************************************************
Copyright (c) 2005-2011 by Juphoon System Software, Inc.
All rights reserved.
This software is confidential and proprietary to Juphoon System,
Inc. No part of this software may be reproduced, stored, transmitted,
disclosed or used in any form or by any means other than as expressly
provided by the written license agreement between Juphoon and its
licensee.
THIS SOFTWARE IS PROVIDED BY JUPHOON "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL JUPHOON BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Juphoon System Software, Inc.
Email: support@juphoon.com
Web: http://www.juphoon.com
************************************************************************/
/*************************************************
File name : mtc_cli.h
Module : multimedia talk client
Author : leo.lv
Created on : 2011-01-03
Description :
Marcos and structure definitions required by the mtc.
Modify History:
1. Date: Author: Modification:
*************************************************/
#ifndef _MTC_CLI_H__
#define _MTC_CLI_H__
/**
* @file mtc_cli.h
* @brief MTC Client Interface Functions
*
@code
The MTC client startup procedure like below:
Mtc_CliInit --- init system resource.
Mtc_CliOpen --- open an user for config provision
*** Using Mtc_CliDbSetLocalIp etc db APIs for set provision
Mtc_CliStart --- start client service
The MTC client halt procedure like below:
Mtc_CliStop --- stop client service
Mtc_CliClose --- close client user
Mtc_CliDestroy --- destroy system resource.
The MTC client for support multi-user switch procedure like below:
Mtc_CliStop --- stop client service
Mtc_CliClose --- close current user provision
Mtc_CliOpen --- open another user config provision
*** Using Mtc_CliDbSetLocalIp etc db APIs for set provision
Mtc_CliStart --- start client service
@endcode
*
*/
#ifdef __cplusplus
extern "C" {
#endif
/** @brief MTC state of REGISTER. */
#define MTC_REG_STATE_IDLE 0 /**< @brief Register idle state.*/
#define MTC_REG_STATE_REGING 1 /**< @brief Register registering state. */
#define MTC_REG_STATE_REGED 2 /**< @brief Register registered state. */
#define MTC_REG_STATE_REREGING 3 /**< @brief Register registered registering state. */
#define MTC_REG_STATE_UNREGING 4 /**< @brief Register unregistering state. */
/** @brief MTC client state. */
typedef enum EN_MTC_CLI_STATE_TYPE
{
EN_MTC_CLI_STATE_INVALID = -3, /**< @brief Client is invalid. */
EN_MTC_CLI_STATE_INITED = -2, /**< @brief Client is initilized. */
EN_MTC_CLI_STATE_OPENED = -1, /**< @brief Open a profile. */
EN_MTC_CLI_STATE_IDLE = 0, /**< @brief Client is after started before login. */
EN_MTC_CLI_STATE_AUTH = 1, /**< @brief Client request authorization. */
EN_MTC_CLI_STATE_LOGINING = 1, /**< @brief Client is trying to login. */
EN_MTC_CLI_STATE_LOGINED = 2, /**< @brief Client is logined successfully. */
EN_MTC_CLI_STATE_LOGOUTING = 3, /**< @brief Client is trying to logout. */
} EN_MTC_CLI_STATE_TYPE;
/** @brief MTC error/status code base */
#define MTC_EBASE_CP 0xE000 /**< @brief CP error base. */
#define MTC_EBASE_REG 0xE100 /**< @brief REG error base. */
#define MTC_EBASE_CALL 0xE200 /**< @brief CALL error base. */
#define MTC_EBASE_VSHARE 0xE300 /**< @brief VSHARE error base. */
#define MTC_EBASE_CAP 0xE400 /**< @brief CAP error base. */
#define MTC_EBASE_BUDDY 0xE500 /**< @brief BUDDY error base. */
#define MTC_EBASE_GRP 0xE600 /**< @brief GRP error base. */
#define MTC_EBASE_CONF 0xE700 /**< @brief CONF error base. */
#define MTC_EBASE_GS 0xE800 /**< @brief GS error base. */
#define MTC_EBASE_PRES 0xE900 /**< @brief PRES error base. */
#define MTC_EBASE_IM 0xEA00 /**< @brief IM error base. */
#define MTC_EBASE_CONTACT 0xEB00 /**< @brief CONTACT error base. */
#define MTC_EBASE_LOG 0xEC00 /**< @brief LOG error base. */
/**
* @defgroup group_def_status_code Type define of status code.
* @{
*/
#define MTC_CLI_ERR_NO (MTC_EBASE_REG + 0) /**< @brief No error. */
#define MTC_CLI_ERR_LCL_FAILED (MTC_EBASE_REG + 1) /**< @brief Local request error. */
#define MTC_CLI_REG_ERR_SEND_MSG (MTC_EBASE_REG + 2) /**< @brief Send message error. */
#define MTC_CLI_REG_ERR_AUTH_FAILED (MTC_EBASE_REG + 3) /**< @brief Register authentication failed, invalid user or password. */
#define MTC_CLI_REG_ERR_INVALID_USER (MTC_EBASE_REG + 4) /**< @brief Register using invalid user. */
#define MTC_CLI_REG_ERR_TIMEOUT (MTC_EBASE_REG + 5) /**< @brief Register timeout. */
#define MTC_CLI_REG_ERR_SERV_BUSY (MTC_EBASE_REG + 6) /**< @brief Register server busy. */
#define MTC_CLI_REG_ERR_SERV_NOT_REACH (MTC_EBASE_REG + 7) /**< @brief Register server not reached. */
#define MTC_CLI_REG_ERR_SRV_FORBIDDEN (MTC_EBASE_REG + 8) /**< @brief Register forbidden. */
#define MTC_CLI_REG_ERR_SRV_UNAVAIL (MTC_EBASE_REG + 9) /**< @brief Register unavailable. */
#define MTC_CLI_REG_ERR_DNS_QRY (MTC_EBASE_REG + 10) /**< @brief Register dns query error. */
#define MTC_CLI_REG_ERR_NETWORK (MTC_EBASE_REG + 11) /**< @brief Register network error. */
#define MTC_CLI_REG_ERR_DEACTED (MTC_EBASE_REG + 12) /**< @brief Register deactived. */
#define MTC_CLI_REG_ERR_PROBATION (MTC_EBASE_REG + 13) /**< @brief Register probation. */
#define MTC_CLI_REG_ERR_INTERNAL (MTC_EBASE_REG + 14) /**< @brief Register internal error. */
#define MTC_CLI_REG_ERR_NO_RESOURCE (MTC_EBASE_REG + 15) /**< @brief Register no resource. */
#define MTC_CLI_REG_ERR_OTHER (MTC_EBASE_REG + 16) /**< @brief Other register error. */
#define MTC_CLI_REG_ERR_NO_NONCE (MTC_EBASE_REG + 17) /**< @brief No nonce error. */
#define MTC_CLI_REG_ERR_INV_AUTH_CODE (MTC_EBASE_REG + 18) /**< @brief Invalid auth code error. */
#define MTC_CLI_REG_ERR_APP_KEY (MTC_EBASE_REG + 19) /**< @brief Invalid app key. */
/** @} */
/** @brief MTC client open the last profile. */
#define MTC_CLI_OPEN_LAST(_ret) do { \
/* get current profile user */ \
ZCHAR *pcCurUser = Mtc_ProvDbGetCurProfUser(); \
/* check the profile is exist, then open client if it is exist*/ \
if (!ZOS_ISEMPTY_STR(pcCurUser) && Mtc_ProfExistUser(pcCurUser)) \
_ret = Mtc_CliOpen(pcCurUser); \
else \
_ret = ZFAILED; \
} while (0)
/**
* @defgroup group_def_access_net_type Type define of access network type
* @{
*/
#define MTC_ANET_UNAVAILABLE -2
#define MTC_ANET_UNKNOWN -1
#define MTC_ANET_MOBILE 0x0000
#define MTC_ANET_MOBILE_GPRS 0x0001
#define MTC_ANET_MOBILE_EDGE 0x0002
#define MTC_ANET_MOBILE_UMTS 0x0003
#define MTC_ANET_MOBILE_CDMA 0x0004
#define MTC_ANET_MOBILE_EVDO_0 0x0005
#define MTC_ANET_MOBILE_EVDO_A 0x0006
#define MTC_ANET_MOBILE_1XRTT 0x0007
#define MTC_ANET_MOBILE_HSDPA 0x0008
#define MTC_ANET_MOBILE_HSUPA 0x0009
#define MTC_ANET_MOBILE_HSPA 0x000A
#define MTC_ANET_MOBILE_IDEN 0x000B
#define MTC_ANET_MOBILE_EVDO_B 0x000C
#define MTC_ANET_MOBILE_LTE 0x000D
#define MTC_ANET_MOBILE_EHRPD 0x000E
#define MTC_ANET_MOBILE_HSPAP 0x000F
#define MTC_ANET_WIFI 0x0100
#define MTC_ANET_WIMAX 0x0600
#define MTC_ANET_BLUETOOTH 0x0700
#define MTC_ANET_ETHERNET 0x0900
#define MTC_ANET_MASK_CATEGORY 0xFF00
/** @} */
/**
* @defgroup group_def_account_status Type deifne of account status
* @{
*/
#define MTC_ACCOUNT_STATUS_ERR -1
#define MTC_ACCOUNT_STATUS_NOT_FOUND 0
#define MTC_ACCOUNT_STATUS_OFFLINE 1
#define MTC_ACCOUNT_STATUS_PUSH 2
#define MTC_ACCOUNT_STATUS_ONLINE 3
/** @} */
/**
* @defgroup MtcInfoKey Keys for device information.
* @{
*/
/** @brief Terminal version. */
#define MTC_INFO_TERMINAL_VERSION_KEY "DeviceInfo.terminal_sw_version"
/** @brief Terminal model. */
#define MTC_INFO_TERMINAL_MODEL_KEY "DeviceInfo.terminal_model"
/** @brief Terminal vendor. */
#define MTC_INFO_TERMINAL_VENDOR_KEY "DeviceInfo.terminal_vendor"
/** @brief Terminal language. */
#define MTC_INFO_TERMINAL_LANGUAGE_KEY "DeviceInfo.lang"
/** @brief Country code. */
#define MTC_INFO_COUNTRY_CODE_KEY "DeviceInfo.cc"
/** @brief Software version. */
#define MTC_INFO_SOFTWARE_VERSION_KEY "DeviceInfo.client_version"
/** @brief Software vendor. */
#define MTC_INFO_SOFTWARE_VENDOR_KEY "DeviceInfo.client_vendor"
/** @} */
/**
* @defgroup MtcLoginOption Option for login.
* @{
*/
/** @brief Preemptive login. Other device with same user will become offline. */
#define MTC_LOGIN_OPTION_NONE 0x00
#define MTC_LOGIN_OPTION_PREEMPTIVE 0x01
/** @} */
typedef ZCOOKIE ZMTCCLIINFOCOOKIE;
/**
* @defgroup MtcCliKey MTC notification key of client event.
* @{
*/
/**
* @brief A key whose value is a number reflecting the response status code,
* @ref group_def_status_code.
*/
#define MtcCliStatusCodeKey "MtcCliStatusCodeKey"
/**
* @brief A key whose value is a number reflecting the time left in seconds
* before registration expired.
*/
#define MtcCliExpiresKey "MtcCliExpiresKey"
/**
* @brief A key whose value is a boolean reflecting if the contact address
* of registration has changed.
*/
#define MtcCliChangedKey "MtcCliChangedKey"
/**
* @brief A key whose value is a number reflecting the challenge.
*/
#define MtcCliCookieKey "MtcCliCookieKey"
/**
* @brief A key whose value is a string reflecting the random string of the challenge.
*/
#define MtcCliRandKey "MtcCliRandKey"
/**
* @brief A key whose value is a string reflecting the AUTN string of the challenge.
*/
#define MtcCliAutnKey "MtcCliAutnKey"
/**
* @brief A key whose value is a string reflecting the account's username.
*/
#define MtcCliUserNameKey "MtcCliUserNameKey"
/**
* @brief A key whose value is a number reflecting the account's status,
* @ref group_def_account_status.
*/
#define MtcCliStatusKey "MtcCliStatusKey"
/** @} */
/**
* @defgroup MtcCliNotification MTC notification of client event.
* @{
*/
/**
* @brief Posted when the provision has been loaded and ready for perform service.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliLocalLoginOkNotification "MtcCliLocalLoginOkNotification"
/**
* @brief Posted when the service object has been destroied.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliLocalDidLogoutNotification "MtcCliLocalDidLogoutNotification"
/**
* @brief Posted when the provision has been loaded and client REGISTER on
* server successfully.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliServerLoginOkNotification "MtcCliServerLoginOkNotification"
/**
* @brief Posted when the provision has loaded but failed to REGISTER on server.
*
* The pcInfo of this notification contains @ref MtcCliStatusCodeKey
* reflecting failed reason.
*/
#define MtcCliServerLoginDidFailNotification "MtcCliServerLoginDidFailNotification"
/**
* @brief Posted when client un-REGISTER on sever successfully. The un-REGISTER
* action was requested by user.
*
* The pcInfo of this notification contains @ref MtcCliStatusCodeKey
* reflecting response code from server.
*/
#define MtcCliServerDidLogoutNotification "MtcCliServerDidLogoutNotification"
/**
* @brief Posted when client receives the message which indicates
* the registration was invalid.
*
* The pcInfo of this notification contains @ref MtcCliStatusCodeKey
* reflecting detail information from server.
*/
#define MtcCliServerLogoutedNotification "MtcCliServerLogoutedNotification"
/**
* @brief Posted when the registration on server has been refreshed successfully.
* The refresh action was requested by user.
*
* The pcInfo of this notification contains @ref MtcCliChangedKey
* reflecting if the registration contact address has changed.
*/
#define MtcCliRefreshOkNotification "MtcCliRefreshOkNotification"
/**
* @brief Posted when the registration on server has been refreshed successfully.
* The refresh action was requested by SDK.
*
* The pcInfo of this notification contains @ref MtcCliChangedKey
* reflecting if the registration contact address has changed.
*/
#define MtcCliRefreshedNotification "MtcCliRefreshedNotification"
/**
* @brief Posted when failed to refresh the registration on server.
* The refresh action was requested by user.
*
* The pcInfo of this notification contains @ref MtcCliStatusCodeKey
* reflecting failed reason.
*/
#define MtcCliRefreshDidFailNotification "MtcCliRefreshDidFailNotification"
/**
* @brief Posted when failed to refresh the registration on server.
* The refresh action was requested by SDK.
*
* The pcInfo of this notification contains @ref MtcCliStatusCodeKey
* reflecting failed reason.
*/
#define MtcCliRefreshFailedNotification "MtcCliRefreshFailedNotification"
/**
* @brief Posted when the client REGISTER on server successfully.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliRegisterOkNotification "MtcCliRegisterOkNotification"
/**
* @brief Posted when the client REGISTER on server successfully.
*
* The pcInfo of this notification contains @ref MtcCliStatusCodeKey
* reflecting failed reason.
*/
#define MtcCliRegisterDidFailNotification "MtcCliRegisterDidFailNotification"
/**
* @brief Posted when client un-REGISTER successfully.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliUnRegisterOkNotification "MtcCliUnRegisterOkNotification"
/**
* @brief Posted when client receives a challenge from server during REGISTER.
* It requests password for digest authentication.
*
* The pcInfo of this notification contains @ref MtcCliCookieKey
* reflecting the handle of this challenge.
*/
#define MtcCliDigestChallengeNotification "MtcCliDigestChallengeNotification"
/**
* @brief Posted when client receives a challenge from server during REGISTER.
* It requests response for AKA authentication.
*
* The pcInfo of this notification contains
* @ref MtcCliCookieKey reflecting the handle of this challenge,
* @ref MtcCliRandKey reflecting the random string of this challenge,
* @ref MtcCliAutnKey reflecting the AUTN value of this challenge,
*/
#define MtcCliAkaChallengeNotification "MtcCliAkaChallengeNotification"
/**
* @brief Posted when the INFO message sent successfully.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliInfoSendOkNotification "MtcCliInfoSendOkNotification"
/**
* @brief Posted when client failed to send INFO message.
*
* The pcInfo of this notification is ZNULL.
*/
#define MtcCliInfoSendDidFailNotification "MtcCliInfoSendDidFailNotification"
/**
* @brief Posted when client query status of the account successfully.
*
* The pcInfo of this notification contains
* @ref MtcCliUserNameKey reflecting the username of the account,
* @ref MtcCliStatusKey reflecting the status of the account.
*/
#define MtcCliAccountQueryOkNotification "MtcCliAccountQueryOkNotification"
/**
* @brief Posted when client failed to query status of the account.
*
* The pcInfo of this notification contains
* @ref MtcCliUserNameKey reflecting the username of the account,
* @ref MtcCliStatusKey reflecting the status of the account.
*/
#define MtcCliAccountQueryDidFailNotification "MtcCliAccountQueryDidFailNotification"
/** @} */
/**
* @brief Initialize Client Resource.
*
* @param [in] pcProfDir Profile directory
* @param [in] pCtx For Windows, it can be set a callback function with type of
* PFN_ZUIEVNT. SDK use this callback to notify UI to invoke Mtc_CliDrive
* on UI thread. If set to ZNULL, SDK will use default implement.
* For Android and iOS, use ZNULL;
*
* @retval ZOK Initialize client resource successfully.
* @retval ZFAILED Initialize client resource failed.
*
* @see @ref Mtc_CliDestroy
*/
MTCFUNC ZINT Mtc_CliInit(ZCHAR *pcProfDir, ZVOID* pCtx);
/**
* @brief Destroy Client Resource.
*
* @see @ref Mtc_CliInit
*/
MTCFUNC ZVOID Mtc_CliDestroy(ZFUNC_VOID);
/**
* @brief Open a account.
*
* @param [in] pcUserName The account name.
* If account name is ZNULL, it will load default profile information.
* For change parameter, call @ref Mtc_CliDbSetLocalIp etc functions.
*
* @retval ZOK Open a account successfully.
* @retval ZFAILED Initialize a account failed.
*
* @see @ref Mtc_CliClose
*/
MTCFUNC ZINT Mtc_CliOpen(ZCHAR *pcUserName);
/**
* @brief Close current account.
*
* @see @ref Mtc_CliOpen
*/
MTCFUNC ZVOID Mtc_CliClose(ZFUNC_VOID);
/**
* @brief Start Client Service.
*
* @retval ZOK Start client service successfully.
* @retval ZFAILED Start client service failed.
*
* @see @ref Mtc_CliStop
*/
MTCFUNC ZINT Mtc_CliStart(ZFUNC_VOID);
/**
* @brief Stop Client Service.
*
* @see @ref Mtc_CliStart
*/
MTCFUNC ZVOID Mtc_CliStop(ZFUNC_VOID);
/**
* @brief Start to Login Client.
*
* @param [in] iOption The option flag for login. @ref MtcLoginOption.
* @param [in] pcAccNetIp The access network IP string.
*
* If @ref Mtc_CliDbGetUserReg returns ZTRUE, Login result notified by callbacks
* which were set by MtcCliRegisterOkNotification, MtcCliRegisterDidFailNotification,
* MtcCliServerLoginOkNotification or MtcCliLocalLoginOkNotification
* or MtcCliServerLoginDidFailNotification or MtcCliDigestChallengeNotification.
* Otherwise, it means client needn't login to remote server,
* and will return immediately without any GUI callback.
*
* @retval ZOK Client is logining.
* @retval ZFAILED Client login failed.
*
* @see @ref Mtc_CliLogout
*/
MTCFUNC ZINT Mtc_CliLogin(ZUINT iOption, ZCONST ZCHAR *pcAccNetIp);
/**
* @brief Refresh the registration.
*
* This interface is try to send re-REGISTRE message to refresh the
* registration information on the server. Although the SDK will send
* re-REGISTER automatically accroding to the expire time length, there still
* be in some condition which the client wants to send re-REGISTER to keep
* registration information valid. Like on mobile phone platfrom, the
* SDK may not be able to send re-REGISTER on time during background mode.
* In these cases, the application should invoke this interface to send
* re-REGISTER manually to discover errors maybe occured during background mode.
*
* @retval ZOK Client send re-REGISTER ok.
* @retval ZFAILED Client send re-REGISTER failed.
*
* @see @ref Mtc_CliLogin @ref Mtc_CliLogout
*/
MTCFUNC ZINT Mtc_CliRefresh(ZFUNC_VOID);
/**
* @brief Start to Logout Client.
*
* If Mtc_DbGetUserReg returns ZTRUE, Logout result will be notified by
* callbacks which were set by MtcCliLocalDidLogoutNotification and MtcCliServerLogoutedNotification.
*
* @retval ZOK Client is logouting.
* @retval ZFAILED Client logout failed.
*
* @see @ref Mtc_CliLogin
*/
MTCFUNC ZINT Mtc_CliLogout(ZFUNC_VOID);
/**
* @brief Get client state.
*
* @return Client State. State see @ref EN_MTC_CLI_STATE_TYPE.
*/
MTCFUNC ZINT Mtc_CliGetState();
/**
* @brief Client Drive Service.
*
* MTC service was implemented by MSF, for multi-thread mode,
* MSF is running in independent thread, GUI is another one generally.
* MTC implmented service login in GUI, so it is running in GUI.
* When MSF need notify status to GUI, the event should transfered in
* two threads. For thread safety, service event was posted by
*
* @param [in] zEvntId Service Event from RSD.
*
* @retval ZOK Drive Service successfully.
* @retval ZFAILED Drive Service failed.
*
*/
MTCFUNC ZINT Mtc_CliDrive(ZEVNT zEvntId);
/**
* @brief Detect available local IP address.
* It is available in register mode.
*
* @return Available local IP detected.
*/
MTCFUNC ZUINT Mtc_CliDetLclIp(ZFUNC_VOID);
/**
* @brief Get Device Id string.
*
* @return Device Id string.
*/
MTCFUNC ZCONST ZCHAR * Mtc_CliGetDevId(ZFUNC_VOID);
/**
* @brief Apply application Id string.
*
* @param pcAppId Stirng of application Id.
*
* @retval ZOK Apply successfully.
* @retval ZFAILED Apply failed.
*/
MTCFUNC ZINT Mtc_CliApplyAppId(ZCONST ZCHAR *pcAppId);
/**
* @brief Apply application Key string.
*
* @param pcAppKey Stirng of application Key.
*
* @retval ZOK Apply successfully.
* @retval ZFAILED Apply failed.
*/
MTCFUNC ZINT Mtc_CliApplyAppKey(ZCONST ZCHAR *pcAppKey);
/**
* @brief Apply device Id string.
*
* @param pcDevId Stirng of device id.
*
* @retval ZOK Apply successfully.
* @retval ZFAILED Apply failed.
*/
MTCFUNC ZINT Mtc_CliApplyDevId(ZCONST ZCHAR *pcDevId);
/**
* @brief Set push parameter.
*
* example:
* @code
* {"Notify.APNS.AppId":"com.juphoon.justalk",
* "Notify.APNS.Token":"681C42B23EA88992B8856C"}
* @endcode
* or
* @code
* {"Notify.APNS.AppId":"com.juphoon.justalk.debug",
* "Notify.APNS.Token":"681C42B23EA88992B8856C"}
* @endcode
* or
* @code
* {"Notify.Baidu.AppId":"AECZXODEKCKDA",
* "Notify.Baidu.UserId":"ZZDEIEQRELASDIOUF",
* "Notify.Baidu.ChannelId":"123050392"}
* @endcode
* or
* @code
* {"Notify.Google.AppId":"QERIPUZXCVPDFA",
* "Notify.Google.RegistrationId":"AOIUERQEZV"}
* @endcode
*
* @retval ZOK Set successfully.
* @retval ZFAILED Set failed.
*/
MTCFUNC ZINT Mtc_CliSetPushParm(ZCONST ZCHAR *pcParm);
/**
* @brief Clear push parameter.
* @param pcAppId The application ID string.
* @retval ZOK Set successfully.
* @retval ZFAILED Set failed.
*/
MTCFUNC ZINT Mtc_CliClrPushParm(ZCONST ZCHAR *pcAppId);
/**
* @brief Network changed trigger.
* @param iAccessNetworkType Access network type, @ref group_def_access_net_type.
*/
MTCFUNC ZVOID Mtc_CliNetworkChanged(ZINT iAccessNetworkType);
/**
* @brief Set the device information for statistics.
*
* @param pcKey The device informatino key, @ref MtcInfoKey.
* @param pcValue The information string.
* @retval ZOK Set successfully.
* @retval ZFAILED Set failed.
*/
MTCFUNC ZINT Mtc_CliSetDevInfo(ZCONST ZCHAR *pcKey, ZCONST ZCHAR *pcValue);
/**
* @brief Awake client process.
*/
MTCFUNC ZVOID Mtc_CliWakeup(ZBOOL bAwake);
/* mtc query account status */
/**
* @brief Query account status.
*
* @param pcUserName Account user name stirng.
* @param zCookie Cookie value in notification.
*
* @retval ZOK Query performed, result will notify by
* MtcCliAccountQueryOkNotification or MtcCliAccountQueryDidFailNotification
* @retval ZFAILED Query perform failed.
*/
MTCFUNC ZINT Mtc_CliQueryStatus(ZCONST ZCHAR *pcUserName, ZCOOKIE zCookie);
#ifdef ZOS_SUPT_JAVA
/**
* @brief Set Java notification process function name.
*
* @retval ZOK Set successfully.
* @retval ZFAILED Set failed.
*/
MTCFUNC ZINT Mtc_CliSetJavaNotify(ZCONST ZCHAR *pcClassName,
ZCONST ZCHAR *pcMethodName);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MTC_CLI_H__ */