Tizen 2.0 Release
[framework/system/oma-dm-agent.git] / include / common / dm_common.h
1 /*
2  * oma-dm-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 /**
19  *   @DM_Common.h
20  *   @version                                                                   0.1
21  *              @brief                                                                          This file is the header file of defined common interface for using oma-dm-agent
22  */
23
24 #ifndef OMA_DM_COMMON_H_
25 #define OMA_DM_COMMON_H_
26
27 /*lib*/
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <ctype.h>
32
33 /*dm-agent*/
34 #include "common/dm-status/oma_dm_status_db_common.h"
35 #include "common/dm-status/oma_dm_status_db_handler.h"
36 #include "common/dm-status/oma_dm_status_db.h"
37 #include "common/dm_common_def.h"
38 #include "common/dm_error.h"
39 #include "framework/platform-event-handler/dm_platform_event_handler.h"
40
41 /**
42  * @par Description: API to initiate dm-service
43  *
44  *
45  * @par Purpose:
46  * @par Typical use case:
47  * @par par Method of function operation:
48  * @par Important notes:
49  *
50  * @return              DM_OK   on success
51  *
52  * @par Errors:
53  *
54  * @pre None.
55  * @post
56  * @see
57  * @remarks None.
58  *
59  * @par Sample Code:
60  * @code
61  * @endcode
62  */
63 DM_ERROR init_dm();
64
65 /**
66  * @par Description: API to end dm-service
67  *
68  *
69  * @par Purpose:
70  * @par Typical use case:
71  * @par par Method of function operation:
72  * @par Important notes:
73  *
74  * @return              DM_OK   on success
75  *
76  * @par Errors:
77  *
78  * @pre None.
79  * @post
80  * @see
81  * @remarks None.
82  *
83  * @par Sample Code:
84  * @code
85  * @endcode
86  */
87 DM_ERROR end_dm();
88
89 /**
90  * @par Description: API to reset dm-service
91  *
92  *
93  * @par Purpose:
94  * @par Typical use case:
95  * @par par Method of function operation:
96  * @par Important notes:
97  *
98  * @return              DM_OK   on success
99  *
100  * @par Errors:
101  *
102  * @pre None.
103  * @post
104  * @see
105  * @remarks None.
106  *
107  * @par Sample Code:
108  * @code
109  * @endcode
110  */
111 DM_ERROR reset_dm();
112
113 /**
114  * @par Description: API to operate service engine (fumo, lawmo) by dm status db query API
115  *
116  *
117  * @par Purpose:
118  * @par Typical use case:
119  * @par par Method of function operation:
120  * @par Important notes:
121  *
122  * @return              DM_OK   on success
123  *
124  * @par Errors:
125  *
126  * @pre None.
127  * @post
128  * @see
129  * @remarks None.
130  *
131  * @par Sample Code:
132  * @code
133  * @endcode
134  */
135 DM_ERROR auto_operate_service_engine();
136
137 /**
138  * @par Description: API to register scheduler(alarm)
139  *
140  *
141  * @par Purpose:
142  * @par Typical use case:
143  * @par par Method of function operation:
144  * @par Important notes:
145  *
146  * @return              1       on success
147  *                                      0  on error
148  *
149  * @par Errors:
150  *
151  * @pre None.
152  * @post
153  * @see
154  * @remarks None.
155  *
156  * @par Sample Code:
157  * @code
158  * @endcode
159  */
160 int register_scheduler();
161
162 /**
163  * @par Description: API to register wap push module
164  *
165  *
166  * @par Purpose:
167  * @par Typical use case:
168  * @par par Method of function operation:
169  * @par Important notes:
170  *
171  * @return              1       on success
172  *                                      0  on error
173  *
174  * @par Errors:
175  *
176  * @pre None.
177  * @post
178  * @see
179  * @remarks None.
180  *
181  * @par Sample Code:
182  * @code
183  * @endcode
184  */
185 int register_wap_push();
186
187 /**
188  * @par Description: API to register fumo ip push module
189  *
190  *
191  * @par Purpose:
192  * @par Typical use case:
193  * @par par Method of function operation:
194  * @par Important notes:
195  *
196  * @return              1       on success
197  *                                      0  on error
198  *
199  * @par Errors:
200  *
201  * @pre None.
202  * @post
203  * @see
204  * @remarks None.
205  *
206  * @par Sample Code:
207  * @code
208  * @endcode
209  */
210 int register_fumo_ip_push();
211
212 /**
213  * @par Description: API to register lawmo samsung account
214  *
215  *
216  * @par Purpose:
217  * @par Typical use case:
218  * @par par Method of function operation:
219  * @par Important notes:
220  *
221  * @return              1       on success
222  *                                      0  on error
223  *
224  * @par Errors:
225  *
226  * @pre None.
227  * @post
228  * @see
229  * @remarks None.
230  *
231  * @par Sample Code:
232  * @code
233  * @endcode
234  */
235 int register_lawmo_samsung_account();
236
237 /**
238  * @par Description: API to register telephony module
239  *
240  *
241  * @par Purpose:
242  * @par Typical use case:
243  * @par par Method of function operation:
244  * @par Important notes:
245  *
246  * @return              1       on success
247  *                                      0  on error
248  *
249  * @par Errors:
250  *
251  * @pre None.
252  * @post
253  * @see
254  * @remarks None.
255  *
256  * @par Sample Code:
257  * @code
258  * @endcode
259  */
260 int register_telephony();
261
262 /**
263  * @par Description: API to register network
264  *
265  *
266  * @par Purpose:
267  * @par Typical use case:
268  * @par par Method of function operation:
269  * @par Important notes:
270  *
271  * @return              1       on success
272  *                                      0  on error
273  *
274  * @par Errors:
275  *
276  * @pre None.
277  * @post
278  * @see
279  * @remarks None.
280  *
281  * @par Sample Code:
282  * @code
283  * @endcode
284  */
285 int register_network();
286
287 /**
288  * @par Description: API to cancel network callback function
289  *
290  *
291  * @par Purpose:
292  * @par Typical use case:
293  * @par par Method of function operation:
294  * @par Important notes:
295  * @param[in]           user data(network session id)
296  *
297  * @return
298  *
299  *
300  * @par Errors:
301  *
302  * @pre None.
303  * @post
304  * @see
305  * @remarks None.
306  *
307  * @par Sample Code:
308  * @code
309  * @endcode
310  */
311 void network_cancel_callback(void *user_data);
312
313 /**
314  * @par Description: API to delay network connection
315  *
316  *
317  * @par Purpose:
318  * @par Typical use case:
319  * @par par Method of function operation:
320  * @par Important notes:
321  *
322  * @return
323  *
324  * @par Errors:
325  *
326  * @pre None.
327  * @post
328  * @see
329  * @remarks None.
330  *
331  * @par Sample Code:
332  * @code
333  * @endcode
334  */
335 void network_connection_delay();
336
337 /**
338  *@par Description: API to set account registration alarm
339  *
340  *
341  * @par Purpose:
342  * @par Typical use case:
343  * @par par Method of function operation:
344  * @par Important notes:
345  * @param[in]           alarm type string(fumo, fmm)
346  * @param[in]           alarm type(fumo, fmm)
347  *
348  * @return              DM_OK   on success
349  *                                      DM_ERROR  on error
350  *
351  * @par Errors:
352  *
353  * @pre None.
354  * @post
355  * @see
356  * @remarks None.
357  *
358  * @par Sample Code:
359  * @code
360  * @endcode
361  */
362 DM_ERROR set_account_registration_alarm(char *alarm_str, CONFIG_TYPE alarm_type);
363
364 /**
365  * @par Description: API to delete fota account registration alarm
366  *
367  *
368  * @par Purpose:
369  * @par Typical use case:
370  * @par par Method of function operation:
371  * @par Important notes:
372  * @param[in]           alarm type string
373  * @param[in]           alarm type
374  *
375  * @return
376  *
377  * @par Errors:
378  *
379  * @pre None.
380  * @post
381  * @see
382  * @remarks None.
383  *
384  * @par Sample Code:
385  * @code
386  * @endcode
387  */
388 void delete_account_registration_alarm(char *alarm_str, CONFIG_TYPE alarm_type);
389
390 /**
391  * @par Description: API to set alarm schedule
392  *
393  *
394  * @par Purpose:
395  * @par Typical use case:
396  * @par par Method of function operation:
397  * @par Important notes:
398  * @param[in]           reminder interval
399  * @param[in]           alarm type
400  * @param[in]           config type
401  *
402  * @return              DM_OK   on success
403  *                                      DM_ERROR  on error
404  *
405  * @par Errors:
406  *
407  * @pre None.
408  * @post
409  * @see
410  * @remarks None.
411  *
412  * @par Sample Code:
413  * @code
414  * @endcode
415  */
416 DM_ERROR add_alarm_item(Reminder_Interval interval, char *alarm_type, CONFIG_TYPE conf_type);
417
418 /**
419  * @par Description: API to delete alarm schedule
420  *
421  *
422  * @par Purpose:
423  * @par Typical use case:
424  * @par par Method of function operation:
425  * @par Important notes:
426  * @param[in]           alarm type
427  * @param[in]           config type
428  *
429  * @return
430  *
431  * @par Errors:
432  *
433  * @pre None.
434  * @post
435  * @see
436  * @remarks None.
437  *
438  * @par Sample Code:
439  * @code
440  * @endcode
441  */
442 void delete_alarm_item(char *alarm_type, CONFIG_TYPE conf_type);
443
444 /**
445  * @par Description: API to start fumo service
446  *
447  *
448  * @par Purpose:
449  * @par Typical use case:
450  * @par par Method of function operation:
451  * @par Important notes:
452  * @param[in]           event contents
453  *
454  * @return              DM_OK   on success
455  *                                      DM_ERROR  on error
456  *
457  * @par Errors:
458  *
459  * @pre None.
460  * @post
461  * @see
462  * @remarks None.
463  *
464  * @par Sample Code:
465  * @code
466  * @endcode
467  */
468 DM_ERROR fumo_service_start(Event_Contents * pEvent_data);
469
470 /**
471  * @par Description: API to get service engine type
472  *
473  *
474  * @par Purpose:
475  * @par Typical use case:
476  * @par par Method of function operation:
477  * @par Important notes:
478  * @param[in]   service engine type string
479  *
480  * @return                      SAMSUNG_FUMO_TYPE
481  *                                              SAMSUNG_FMM_TYPE
482  *                                              GCF_TYPE
483  *                                              NO_ENGINE_TYPE
484  *
485  * @par Errors:
486  *
487  * @pre None.
488  * @post
489  * @see
490  * @remarks None.
491  *
492  * @par Sample Code:
493  * @code
494  * @endcode
495  */
496 SERVICE_SERVER_TYPE get_service_engine_type(const char *service_engine_type);
497
498 /**
499  * @par Description: API to get server information
500  *
501  *
502  * @par Purpose:
503  * @par Typical use case:
504  * @par par Method of function operation:
505  * @par Important notes:
506  * @param[in]   Event contents
507  * @param[out]  server id
508  * @param[out]  session id
509  * @param[out]  session type
510  *
511  * @return                      DM_OK on success
512  *                                              DM_ERRORS on error
513  *
514  * @par Errors:
515  *
516  * @pre None.
517  * @post
518  * @see
519  * @remarks None.
520  *
521  * @par Sample Code:
522  * @code
523  * @endcode
524  */
525 DM_ERROR get_server_info(Event_Contents * pEvent_data, char **server_id, char **session_id, int *session_type);
526
527 /**
528  * @par Description: API to get fumo ui mode
529  *
530  *
531  * @par Purpose:
532  * @par Typical use case:
533  * @par par Method of function operation:
534  * @par Important notes:
535  * @param[out]  ui mode
536  *
537  * @return                      DM_OK on success
538  *                                              DM_ERRORS on error
539  *
540  * @par Errors:
541  *
542  * @pre None.
543  * @post
544  * @see
545  * @remarks None.
546  *
547  * @par Sample Code:
548  * @code
549  * @endcode
550  */
551 DM_ERROR get_fumo_ui_mode(char **ui_mode);
552
553 /**
554  * @par Description: API to check existed fumo remind interval
555  *
556  *
557  * @par Purpose:
558  * @par Typical use case:
559  * @par par Method of function operation:
560  * @par Important notes:
561  *
562  * @return                      1 on success
563  *                                              0 on error
564  *
565  * @par Errors:
566  *
567  * @pre None.
568  * @post
569  * @see
570  * @remarks None.
571  *
572  * @par Sample Code:
573  * @code
574  * @endcode
575  */
576 int check_existed_fumo_reminder_interval();
577
578 /**
579  * @par Description: API to init defult fumo configuration
580  *
581  *
582  * @par Purpose:
583  * @par Typical use case:
584  * @par par Method of function operation:
585  * @par Important notes:
586  *
587  * @return                              1 success
588  *                                              -1 error
589  *
590  * @par Errors:
591  *
592  * @pre None.
593  * @post
594  * @see
595  * @remarks None.
596  *
597  * @par Sample Code:
598  * @code
599  * @endcode
600  */
601 int init_default_fumo_config();
602
603 /**
604  * @par Description: API to set configuration int value
605  *
606  *
607  * @par Purpose:
608  * @par Typical use case:
609  * @par par Method of function operation:
610  * @par Important notes:
611  * @param[in]   config_type
612  * @param[in]   key
613  * @param[in]   value
614  * @param[in]   accessName
615  * @param[in]   isFirst
616  *
617  * @return              1 success
618  *                                      -1 error
619  *
620  * @par Errors:
621  *
622  * @pre None.
623  * @post
624  * @see
625  * @remarks None.
626  *
627  * @par Sample Code:
628  * @code
629  * @endcode
630  */
631 int set_config_int(CONFIG_TYPE config_type, char *key, int value, char *accessName, int isFirst);
632
633 /**
634  * @par Description: API to set alarm configuration int value
635  *
636  *
637  * @par Purpose:
638  * @par Typical use case:
639  * @par par Method of function operation:
640  * @par Important notes:
641  * @param[in]   config_type
642  * @param[in]   key
643  * @param[in]   value
644  * @param[in]   accessName
645  *
646  * @return                      1 success
647  *                                      0 error
648  *
649  * @par Errors:
650  *
651  * @pre None.
652  * @post
653  * @see
654  * @remarks None.
655  *
656  * @par Sample Code:
657  * @code
658  * @endcode
659  */
660 int set_alarm_config_int(CONFIG_TYPE config_type, char *key, int value, char *accessName);
661
662 /**
663  * @par Description: API to get configuration int value
664  *
665  *
666  * @par Purpose:
667  * @par Typical use case:
668  * @par par Method of function operation:
669  * @par Important notes:
670  * @param[in]   config id
671  * @param[in]   key
672  *
673  * @return                      1 success
674  *                                              0 error
675  *                                              0
676  * @par Errors:
677  *
678  * @pre None.
679  * @post
680  * @see
681  * @remarks None.
682  *
683  * @par Sample Code:
684  * @code
685  * @endcode
686  */
687 int get_config_int(CONFIG_TYPE config_id, char *key);
688
689 /**
690  * @par Description: API to get wifi only config
691  *
692  *
693  * @par Purpose:
694  * @par Typical use case:
695  * @par par Method of function operation:
696  * @par Important notes:
697  *
698  * @return                       1 on success
699  *                                              -1 on error
700  *
701  * @par Errors:
702  *
703  * @pre None.
704  * @post
705  * @see
706  * @remarks None.
707  *
708  * @par Sample Code:
709  * @code
710  * @endcode
711  */
712 int get_wifi_only_config();
713
714 /**
715  * @par Description: API to set wifi only config
716  *
717  *
718  * @par Purpose:
719  * @par Typical use case:
720  * @par par Method of function operation:
721  * @par Important notes:
722  * @param[in] value
723  *
724  * @return                       1 on success
725  *                                              -1 on error
726  *
727  * @par Errors:
728  *
729  * @pre None.
730  * @post
731  * @see
732  * @remarks None.
733  *
734  * @par Sample Code:
735  * @code
736  * @endcode
737  */
738 int set_wifi_only_config(int value);
739
740 /**
741  * @par Description: API to get battery state
742  *
743  *
744  * @par Purpose:
745  * @par Typical use case:
746  * @par par Method of function operation:
747  * @par Important notes:
748  * @param[out]          battery value
749  *
750  * @return
751  *
752  * @par Errors:
753  *
754  * @pre None.
755  * @post
756  * @see
757  * @remarks None.
758  *
759  * @par Sample Code:
760  * @code
761  * @endcode
762  */
763
764 DM_ERROR get_battery_state(char **battery_level);
765
766 /**
767  * @par Description: API to check existed sd card memory
768  *
769  *
770  * @par Purpose:
771  * @par Typical use case:
772  * @par par Method of function operation:
773  * @par Important notes:
774  * @param[out]          existed sd
775  *
776  * @return                      DM_OK on success
777  *                                      DM_SD_CARD_ERROR on error
778  *
779  * @par Errors:
780  *
781  * @pre None.
782  * @post
783  * @see
784  * @remarks None.
785  *
786  * @par Sample Code:
787  * @code
788  * @endcode
789  */
790 DM_ERROR existed_sd_card_memory(int *existed_sd);
791
792 /**
793  * @par Description: API to get telephony state
794  *
795  *
796  * @par Purpose:
797  * @par Typical use case:
798  * @par par Method of function operation:
799  * @par Important notes:
800  * @param[out]          now calling
801  *
802  * @return                      DM_OK on success
803  *                                              DM_TELEPHONY_ERROR on errorS
804  *
805  * @par Errors:
806  *
807  * @pre None.
808  * @post
809  * @see
810  * @remarks None.
811  *
812  * @par Sample Code:
813  * @code
814  * @endcode
815  */
816 DM_ERROR get_telephony_state(int *now_calling);
817
818 /**
819  * @par Description: API to get compare memory space
820  *
821  *
822  * @par Purpose:
823  * @par Typical use case:
824  * @par par Method of function operation:
825  * @par Important notes:
826  * @param[in]           memory_type
827  * @param[in]           file_size
828  *
829  * @return                      DM_OK on success
830  *                                              DM_MEMORY_ERROR, DM_OVER_MEMORY_ERROR on error
831  *
832  * @par Errors:
833  *
834  * @pre None.
835  * @post
836  * @see
837  * @remarks None.
838  *
839  * @par Sample Code:
840  * @code
841  * @endcode
842  */
843 DM_ERROR compare_memory_space(char *memory_type, long double file_size);
844
845 /**
846  * @par Description: API to get roaming state
847  *
848  *
849  * @par Purpose:
850  * @par Typical use case:
851  * @par par Method of function operation:
852  * @par Important notes:
853  * @param[in]           roaming_state
854  *
855  * @return
856  *
857  * @par Errors:
858  *
859  * @pre None.
860  * @post
861  * @see
862  * @remarks None.
863  *
864  * @par Sample Code:
865  * @code
866  * @endcode
867  */
868 void get_roaming_state(int *roaming_state);
869
870 /**
871  * @par Description: API to get call state
872  *
873  *
874  * @par Purpose:
875  * @par Typical use case:
876  * @par par Method of function operation:
877  * @par Important notes:
878  * @param[in]           call_state
879  *
880  * @return
881  *
882  * @par Errors:
883  *
884  * @pre None.
885  * @post
886  * @see
887  * @remarks None.
888  *
889  * @par Sample Code:
890  * @code
891  * @endcode
892  */
893 void get_call_sate(int *call_state);
894
895 /**
896  * @par Description: API to get mmc state
897  *
898  *
899  * @par Purpose:
900  * @par Typical use case:
901  * @par par Method of function operation:
902  * @par Important notes:
903  * @param[out]          mmc_state
904  *
905  * @return                      1 on success
906  *                                              0 on error
907  *
908  * @par Errors:
909  *
910  * @pre None.
911  * @post
912  * @see
913  * @remarks None.
914  *
915  * @par Sample Code:
916  * @code
917  * @endcode
918  */
919 int get_mmc_state(int *mmc_state);
920
921 /**
922  * @par Description: API to get fota download_dir
923  *
924  *
925  * @par Purpose:
926  * @par Typical use case:
927  * @par par Method of function operation:
928  * @par Important notes:
929  * @param[in]           memory type
930  * @param[out]          download folder path
931  *
932  * @return                      DM_OK on success
933  *                                              DM_MEMORY_ERROR on fail
934  *
935  * @pre None.
936  * @post
937  * @see
938  * @remarks None.
939  *
940  * @par Sample Code:
941  * @code
942  * @endcode
943  */
944 DM_ERROR get_fota_download_dir(MEMORY_TYPE type, char **download_folder);
945
946 /**
947  * @par Description: API to get fota save dir
948  *
949  *
950  * @par Purpose:
951  * @par Typical use case:
952  * @par par Method of function operation:
953  * @par Important notes:
954  * @param[in]           memory type
955  * @param[out]          save folder path
956  *
957  * @return                      DM_OK on success
958  *                                              DM_MEMORY_ERROR on fail
959  *
960  * @par Errors:
961  *
962  * @pre None.
963  * @post
964  * @see
965  * @remarks None.
966  *
967  * @par Sample Code:
968  * @code
969  * @endcode
970  */
971 DM_ERROR get_fota_save_dir(MEMORY_TYPE type, char **save_folder);
972
973 /**
974  * @par Description: API to delete fumo contents
975  *
976  *
977  * @par Purpose:
978  * @par Typical use case:
979  * @par par Method of function operation:
980  * @par Important notes:
981  *      @param[in] memory type
982  *
983  *      @return
984  *
985  * @par Errors:
986  *
987  * @pre None.
988  * @post
989  * @see
990  * @remarks None.
991  *
992  * @par Sample Code:
993  * @code
994  * @endcode
995  */
996 void delete_fumo_contents(MEMORY_TYPE memory_type);
997
998 /**
999  * @par Description: API to the first server bootstrap
1000  *
1001  *
1002  * @par Purpose:
1003  * @par Typical use case:
1004  * @par par Method of function operation:
1005  * @par Important notes:
1006  *      @param[in] server id
1007  *
1008  *      @return
1009  *
1010  * @par Errors:
1011  *
1012  * @pre None.
1013  * @post
1014  * @see
1015  * @remarks None.
1016  *
1017  * @par Sample Code:
1018  * @code
1019  * @endcode
1020  */
1021 void first_server_bootstrap(char *server_id);
1022
1023 /**
1024  * @par Description: API to get default noti type
1025  *
1026  *
1027  * @par Purpose:
1028  * @par Typical use case:
1029  * @par par Method of function operation:
1030  * @par Important notes:
1031  *      @param[in] ui mode
1032  * @param[in] noti type
1033  *
1034  *      @return
1035  *
1036  * @par Errors:
1037  *
1038  * @pre None.
1039  * @post
1040  * @see
1041  * @remarks None.
1042  *
1043  * @par Sample Code:
1044  * @code
1045  * @endcode
1046  */
1047 int get_default_noti_type(char *ui_mode, NotI_Type noti_type);
1048
1049 /**
1050  * @par Description: API to get new url
1051  *
1052  *
1053  * @par Purpose:
1054  * @par Typical use case:
1055  * @par par Method of function operation:
1056  * @par Important notes:
1057  *      @param[in] uri
1058  *      @param[out] new uri
1059  *
1060  *      @return
1061  *
1062  * @par Errors:
1063  *
1064  * @pre None.
1065  * @post
1066  * @see
1067  * @remarks None.
1068  *
1069  * @par Sample Code:
1070  * @code
1071  * @endcode
1072  */
1073 char *get_new_uri(char *old_object_uri);
1074
1075 #endif                          /* OMA_DM_COMMON_H_ */