Tizen 2.0 Release
[framework/system/oma-dm-agent.git] / src / agent / framework / task / oma_dm_task_register.c
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 /*sync-agent*/
19 #include <sync_agent.h>
20
21 /*dm-agent*/
22 #include "common/dm_common.h"
23 #include "framework/task/oma_dm_task_register.h"
24 #include "framework/task/oma_dm_task_spec.h"
25
26 #ifndef OMADM_AGENT_LOG
27 #undef LOG_TAG
28 #define LOG_TAG "TASK_SPEC"
29 #endif
30
31 DM_ERROR task_register()
32 {
33         _EXTERN_FUNC_ENTER;
34
35         DM_ERROR ret = DM_OK;
36
37         sync_agent_ec_task_spec_s *pDm_InitSpec = make_dm_init_task_spec();
38
39         sync_agent_register_task_spec(EC_MSG_TYPE_DM_INIT_TASK_REQUEST, EC_MSG_TYPE_NAME_DM_INIT_TASK_REQUEST, pDm_InitSpec, NULL);
40
41         sync_agent_ec_task_spec_s *pDm_ResetSpec = make_dm_reset_task_spec();
42
43         sync_agent_register_task_spec(EC_MSG_TYPE_DM_RESET_TASK_REQUEST, EC_MSG_TYPE_NAME_DM_RESET_TASK_REQUEST, pDm_ResetSpec, NULL);
44
45         sync_agent_ec_task_spec_s *pBootstrapSpec = make_bootstrap_task_spec();
46
47         sync_agent_register_task_spec(EC_MSG_TYPE_BOOTSTRAP_TASK_REQUEST, EC_MSG_TYPE_NAME_BOOTSTRAP_TASK_REQUEST, pBootstrapSpec, NULL);
48
49         sync_agent_ec_task_spec_s *pDm_fumo_commonSpec = make_dm_fumo_common_process_task_spec();
50
51         sync_agent_register_task_spec(EC_MSG_TYPE_DM_FUMO_COMMON_TASK_REQUEST, EC_MSG_TYPE_NAME_DM_FUMO_COMMON_TASK_REQUEST, pDm_fumo_commonSpec, NULL);
52
53         sync_agent_ec_task_spec_s *pDm_fumo_uiSpec = make_dm_fumo_ui_process_task_spec();
54
55         sync_agent_register_task_spec(EC_MSG_TYPE_DM_FUMO_UI_TASK_REQUEST, EC_MSG_TYPE_NAME_DM_FUMO_UI_TASK_REQUEST, pDm_fumo_uiSpec, NULL);
56
57         sync_agent_ec_task_spec_s *pDm_lawmo_commonSpec = make_dm_lawmo_common_process_task_spec();
58
59         sync_agent_register_task_spec(EC_MSG_TYPE_DM_LAWMO_COMMON_TASK_REQUEST, EC_MSG_TYPE_NAME_DM_LAWMO_COMMON_TASK_REQUEST, pDm_lawmo_commonSpec, NULL);
60
61         sync_agent_ec_task_spec_s *pGenericAlertSpec = make_genericAlert_process_task_spec();
62
63         sync_agent_register_task_spec(EC_MSG_TYPE_GENERICALERT_TASK_REQUEST, EC_MSG_TYPE_NAME_GENERICALERT_TASK_REQUEST, pGenericAlertSpec, NULL);
64
65         sync_agent_ec_task_spec_s *pFumoServiceEngineSpec = make_fumo_serviceEngine_process_task_spec();
66
67         sync_agent_register_task_spec(EC_MSG_TYPE_FUMO_SERVICE_ENGINE_TASK_REQUEST, EC_MSG_TYPE_NAME_FUMO_SERVICE_ENGINE_TASK_REQUEST, pFumoServiceEngineSpec, NULL);
68
69         sync_agent_ec_task_spec_s *pLawmoServiceEngineSpec = make_lawmo_serviceEngine_process_task_spec();
70
71         sync_agent_register_task_spec(EC_MSG_TYPE_LAWMO_SERVICE_ENGINE_TASK_REQUEST, EC_MSG_TYPE_NAME_LAWMO_SERVICE_ENGINE_TASK_REQUEST, pLawmoServiceEngineSpec, NULL);
72
73         sync_agent_ec_task_spec_s *pFumo_schedule_Spec = make_fumo_schedule_process_task_spec();
74
75         sync_agent_register_task_spec(EC_MSG_TYPE_FUMO_SCHEDULE_TASK_REQUEST, EC_MSG_TYPE_NAME_FUMO_SCHEDULE_TASK_REQUEST, pFumo_schedule_Spec, NULL);
76
77         _DEBUG_INFO("register tasks end");
78
79         _DEBUG_INFO("register queuing rule start");
80         sync_agent_ec_queuing_rule_spec_s *pfumo_Rule = sync_agent_create_queuing_rule_spec_outline("dm_fumo_common_queuing_rule");
81         sync_agent_ec_queuing_rule_spec_s *plawmo_Rule = sync_agent_create_queuing_rule_spec_outline("dm_lawmo_common_queuing_rule");
82
83         sync_agent_ec_error_e ec_error = sync_agent_add_progress_blocking_element(pfumo_Rule,
84                                                                                   EC_MSG_TYPE_DM_FUMO_COMMON_TASK_REQUEST, pDm_fumo_commonSpec,
85                                                                                   0);
86         ec_error = sync_agent_add_progress_blocking_element(pfumo_Rule, EC_MSG_TYPE_FUMO_SERVICE_ENGINE_TASK_REQUEST, pFumoServiceEngineSpec, 0);
87         ec_error = sync_agent_add_progress_blocking_element(pfumo_Rule, EC_MSG_TYPE_DM_FUMO_UI_TASK_REQUEST, pDm_fumo_uiSpec, 0);
88
89         ec_error = sync_agent_add_progress_blocking_element(plawmo_Rule, EC_MSG_TYPE_DM_LAWMO_COMMON_TASK_REQUEST, pDm_lawmo_commonSpec, 0);
90         ec_error = sync_agent_add_progress_blocking_element(plawmo_Rule, EC_MSG_TYPE_LAWMO_SERVICE_ENGINE_TASK_REQUEST, pLawmoServiceEngineSpec, 0);
91
92         sync_agent_register_async_queuing_rule_spec(pfumo_Rule, NULL, NULL);
93         sync_agent_unref_queuing_rule_spec(pfumo_Rule);
94         sync_agent_register_async_queuing_rule_spec(plawmo_Rule, NULL, NULL);
95         sync_agent_unref_queuing_rule_spec(plawmo_Rule);
96
97         _EXTERN_FUNC_EXIT;
98
99         return ret;
100
101 }