mtc_dsr.h
15.7 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
/************************************************************************
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_dsr.h
Module : multimedia talk client
Author : bob.liu
Created on : 2016-01-12
Description :
Data structure and function declare required by MTC statistics
Modify History:
1. Date: Author: Modification:
*************************************************/
#ifndef _MTC_DSR_H__
#define _MTC_DSR_H__
/**
* @file mtc_dsr.h
* @brief MTC Document Sharing Interface Functions
*
* This file includes document sharing interface function.
*/
/** @brief The failed reason number. */
typedef enum EN_MTC_DSR_REASON_TYPE
{
EN_MTC_DSR_REASON_BASE = 3000, /**< @brief Base of reason number. */
EN_MTC_DSR_REASON_INVALID_ID, /**< @brief Invalid document ID. */
EN_MTC_DSR_REASON_TOO_LARGE_DOCUMENT, /**< @brief Too large document. */
EN_MTC_DSR_REASON_SERVER, /**< @brief Server error. */
} EN_MTC_DSR_REASON_TYPE;
/** @brief The document state number. */
typedef enum EN_MTC_DSR_STATE_TYPE
{
EN_MTC_DSR_STATE_INVALID = 0, /**< @brief Invalid state. */
EN_MTC_DSR_STATE_QUEUED, /**< @brief Document is waiting for convert. */
EN_MTC_DSR_STATE_CONVERTING, /**< @brief Document is converting. */
EN_MTC_DSR_STATE_READY, /**< @brief Document is ready for loading. */
EN_MTC_DSR_STATE_LOADED, /**< @brief Document is loaded. */
EN_MTC_DSR_STATE_CACHED, /**< @brief Document is cached on load storage. */
} EN_MTC_DSR_STATE_TYPE;
/**
* @defgroup MtcDsrKey MTC notification key for document sharing.
* @{
*/
/**
* @brief A key whose value is a number object reflecting
* the failed reason, @ref EN_MTC_DSR_REASON_TYPE.
*/
#define MtcDsrReasonKey "Reason"
/**
* @brief A key whose value is a string object reflecting
* the detail information of failure.
*/
#define MtcDsrFailInfoKey "FailInfo"
/**
* @brief A key whose value is a string object reflecting
* the ID of sharing document.
*/
#define MtcDsrDocIdKey "Id"
/**
* @brief A key whose value is a number object reflecting
* the state of document.
*/
#define MtcDsrDocStateKey "State"
/**
* @brief A key whose value is a string object reflecting
* the name property of sharing document.
*/
#define MtcDsrDocNameKey "Name"
/**
* @brief A key whose value is a string object reflecting
* the memo property of sharing document.
*/
#define MtcDsrDocMemoKey "Memo"
/**
* @brief A key whose value is a string object reflecting
* the user data property of sharing document.
*/
#define MtcDsrDocUserDataKey "UserData"
/**
* @brief A key whose value is a string object reflecting
* the document shared URI.
*/
#define MtcDsrDocUriKey "URI"
/**
* @brief A key whose value is a boolean object reflecting
* if the user is the owner of document.
*/
#define MtcDsrDocIsOwnerKey "IsOwner"
/**
* @brief A key whose value is a number object reflecting
* the page count of sharing document.
*/
#define MtcDsrPageCountKey "PageCount"
/**
* @brief A key whose value is a array object.
* Each item is string object reflecting the path of thumbnail file of
* corresponding page.
*/
#define MtcDsrThumbsKey "Thumbs"
/**
* @brief A key whose value is a array object.
* Each item is string object reflecting the path of image file of
* corresponding page.
*/
#define MtcDsrPagesKey "Pages"
/**
* @brief A key whose value is a number object reflecting
* the page index of sharing document, start from 0.
*/
#define MtcDsrPageIdKey "PageId"
/**
* @brief A key whose value is a string object reflecting
* the page image file name of sharing document.
*/
#define MtcDsrPageKey "Page"
/** @} */
/**
* @defgroup MtcDsrNotification MTC notification names for document sharing.
* @{
*/
/**
* @brief Posted when query sharing documents successfully..
*
* The pcInfo of this notification contains
* an array of document info object. Each object contains
* @ref MtcDsrDocIdKey
* @ref MtcDsrDocStateKey
* @ref MtcDsrDocNameKey
* @ref MtcDsrDocMemoKey
* @ref MtcDsrDocUserDataKey
* @ref MtcDsrPageCountKey.
*/
#define MtcDsrQueryOkNotification "MtcDsrQueryOkNotification"
/**
* @brief Posted when query sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrQueryDidFailNotification "MtcDsrQueryDidFailNotification"
/**
* @brief Posted when delete sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrRemoveOkNotification "MtcDsrRemoveOkNotification"
/**
* @brief Posted when query sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrRemoveDidFailNotification "MtcDsrRemoveDidFailNotification"
/**
* @brief Posted when upload sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrUploadOkNotification "MtcDsrUploadOkNotification"
/**
* @brief Posted when upload sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrUploadDidFailNotification "MtcDsrUploadDidFailNotification"
/**
* @brief Posted when upload sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrUploadImagesOkNotification "MtcDsrUploadImagesOkNotification"
/**
* @brief Posted when upload sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrUploadImagesDidFailNotification "MtcDsrUploadImagesDidFailNotification"
/**
* @brief Posted when convert sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrConvertOkNotification "MtcDsrConvertOkNotification"
/**
* @brief Posted when convert sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrConvertDidFailNotification "MtcDsrConvertDidFailNotification"
/**
* @brief Posted when download sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrDownloadOkNotification "MtcDsrDownloadOkNotification"
/**
* @brief Posted when download sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrDownloadDidFailNotification "MtcDsrDownloadDidFailNotification"
/**
* @brief Posted when modify sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey.
*/
#define MtcDsrModifyOkNotification "MtcDsrModifyOkNotification"
/**
* @brief Posted when modify sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrModifyDidFailNotification "MtcDsrModifyDidFailNotification"
/**
* @brief Posted when load sharing document successfully.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey,
* @ref MtcDsrDocStateKey
* @ref MtcDsrDocNameKey
* @ref MtcDsrDocMemoKey
* @ref MtcDsrDocUserDataKey
* @ref MtcDsrPageCountKey.
* @ref MtcDsrThumbsKey,
* @ref MtcDsrPagesKey.
*/
#define MtcDsrLoadOkNotification "MtcDsrLoadOkNotification"
/**
* @brief Posted when load sharing documents failed.
*
* The pcInfo of this notification contains
* @ref MtcDsrReasonKey
* @ref MtcDsrFailInfoKey.
*/
#define MtcDsrLoadDidFailNotification "MtcDsrLoadDidFailNotification"
/**
* @brief Posted when page loaded.
*
* The pcInfo of this notification contains
* @ref MtcDsrDocIdKey,
* @ref MtcDsrPageIdKey
* @ref MtcDsrPageKey.
*/
#define MtcDsrPageLoadedNotification "MtcDsrPageLoadedNotification"
/** @} */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Query all document for sharing.
*
* @param zCookie The cookie value.
*
* @retval ZOK The request has been sent successfully.
* When query has been done successfully, UI will receive @ref MtcDsrQueryOkNotification.
* When query failed, UI will receive @ref MtcDsrQueryDidFailNotification.
* @retval ZFAILED Failed to send request.
*/
MTCFUNC ZINT Mtc_DsrQuery(ZCOOKIE zCookie);
/**
* @brief Remove specific sharing document.
*
* @param zCookie The cookie value.
* @param pcDocId The document ID string.
*
* @retval ZOK The request has been sent successfully.
* When document deleted successfully, UI will receive @ref MtcDsrRemoveOkNotification.
* When delete failed, UI will receive @ref MtcDsrRemoveDidFailNotification.
* @retval ZFAILED Failed to send request.
*/
MTCFUNC ZINT Mtc_DsrRemove(ZCOOKIE zCookie, ZCONST ZCHAR *pcDocId);
/**
* @brief Upload document for sharing.
*
* @param zCookie The cookie value.
* @param pcFilePath The file path string.
* @param pcInfo The info of the document, which contains
* @ref MtcDsrDocNameKey
* @ref MtcDsrDocMemoKey
* @ref MtcDsrDocUserDataKey.
*
* @retval ZOK The request has been sent successfully.
* When the document upload successfully, UI will receive @ref MtcDsrUploadOkNotification.
* The document cannot be shared immediately. The document can be shared after its state
* changed to ready.
* When delete failed, UI will receive @ref MtcDsrUploadDidFailNotification.
* @retval ZFAILED Failed to send request.
*/
MTCFUNC ZINT Mtc_DsrUpload(ZCOOKIE zCookie, ZCONST ZCHAR *pcFilePath, ZCONST ZCHAR *pcInfo);
/**
* @brief Upload document image files for sharing.
*
* @param zCookie The cookie value.
* @param pcDirPath The directory contains image files.
* @param pcInfo The info of the document, which contains
* @ref MtcDsrDocNameKey
* @ref MtcDsrDocMemoKey
* @ref MtcDsrDocUserDataKey.
*
* @retval ZOK The request has been sent successfully.
* When the document upload successfully, UI will receive @ref MtcDsrUploadImagesOkNotification.
* The document cannot be shared immediately. The document can be shared after its state
* changed to ready.
* When delete failed, UI will receive @ref MtcDsrUploadImagesDidFailNotification.
* @retval ZFAILED Failed to send request.
*/
MTCFUNC ZINT Mtc_DsrUploadImages(ZCOOKIE zCookie, ZCONST ZCHAR *pcDocId,
ZCONST ZCHAR *pcDirPath, ZINT iPageCount, ZCONST ZCHAR *pcInfo);
/**
* @brief Modify document information.
*
* @param zCookie The cookie value.
* @param pcDocId The document ID string.
* @param pcInfo The info of the document, which contains
* @ref MtcDsrDocNameKey
* @ref MtcDsrDocMemoKey
* @ref MtcDsrDocUserDataKey.
*
* @retval ZOK The request has been sent successfully.
* When the document modified successfully, UI will receive @ref MtcDsrModifyOkNotification.
* When modify failed, UI will receive @ref MtcDsrModifyDidFailNotification.
* @retval ZFAILED Failed to send request.
*/
MTCFUNC ZINT Mtc_DsrModify(ZCOOKIE zCookie, ZCONST ZCHAR *pcDocId, ZCONST ZCHAR *pcInfo);
/**
* @brief Load document from the URI of sharing link.
*
* @param zCookie The cookie value.
* @param pcUri The URI of sharing link.
*
* @retval ZOK The request has been sent successfully.
* When the document loaded successfully, UI will receive @ref MtcDsrLoadOkNotification.
* When loaded failed, UI will receive @ref MtcDsrLoadDidFailNotification.
* @retval ZFAILED Failed to send request.
*/
MTCFUNC ZINT Mtc_DsrLoad(ZCOOKIE zCookie, ZCONST ZCHAR *pcUri);
/**
* @brief Get document ID from file
*
* @param pcFilePath The file path.
*
* @return The document ID of the file.
*/
MTCFUNC ZCONST ZCHAR * Mtc_DsrGetDocId(ZCONST ZCHAR *pcFilePath);
/**
* @brief Check document is exist.
*
* @param pcDocId The document ID.
*
* @return ZTRUE when document is exist, otherwise is not exist.
*/
MTCFUNC ZBOOL Mtc_DsrIsDocExist(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the document state.
*
* @param pcDocId The document ID string.
*
* @return The state of document @ref EN_MTC_DSR_STATE_TYPE.
*/
MTCFUNC ZINT Mtc_DsrGetDocState(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the document URI for sharing.
*
* @param pcDocId The document ID string.
*
* @return The string of document URI.
*/
MTCFUNC ZCONST ZCHAR * Mtc_DsrGetDocUri(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the document name information.
*
* @param pcDocId The document ID string.
*
* @return The string of document name.
*/
MTCFUNC ZCONST ZCHAR * Mtc_DsrGetDocName(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the document memo information.
*
* @param pcDocId The document ID string.
*
* @return The string of document memo.
*/
MTCFUNC ZCONST ZCHAR * Mtc_DsrGetDocMemo(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the document user data information.
*
* @param pcDocId The document ID string.
*
* @return The string of document user data.
*/
MTCFUNC ZCONST ZCHAR * Mtc_DsrGetDocUserData(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the document page count.
*
* @param pcDocId The document ID string.
*
* @return The count of pages.
*/
MTCFUNC ZUINT Mtc_DsrGetDocPageCount(ZCONST ZCHAR *pcDocId);
/**
* @brief Get if the user is the owner of document.
*
* @param pcDocId The document ID string.
*
* @return ZTRUE, the user is the owner.
*/
MTCFUNC ZBOOL Mtc_DsrIsDocOwner(ZCONST ZCHAR *pcDocId);
/**
* @brief Get the image file path of specific page index.
*
* @param pcDocId The document ID string.
* @param iPageId The page index, from 0 to count-1.
*
* @return The path string of image file.
*/
MTCFUNC ZCONST ZCHAR * Mtc_DsrGetPage(ZCONST ZCHAR *pcDocId, ZINT iPageId);
#ifdef __cplusplus
}
#endif
#endif /* _MTC_DSR_H__ */