summaryrefslogtreecommitdiff
path: root/src/agent/dm-engine/fumo/fumo_account.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/agent/dm-engine/fumo/fumo_account.c')
-rw-r--r--src/agent/dm-engine/fumo/fumo_account.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/agent/dm-engine/fumo/fumo_account.c b/src/agent/dm-engine/fumo/fumo_account.c
new file mode 100644
index 0000000..c18bf24
--- /dev/null
+++ b/src/agent/dm-engine/fumo/fumo_account.c
@@ -0,0 +1,83 @@
+/*
+ * oma-dm-agent
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*sync-agent*/
+#include <sync_agent.h>
+
+/*common*/
+#include "common/dm_common.h"
+#include "dm-engine/fumo/fumo_account.h"
+
+#ifndef OMADM_AGENT_LOG
+#undef LOG_TAG
+#define LOG_TAG "FUMO_ENGINE"
+#endif
+
+int register_fota_account()
+{
+ _EXTERN_FUNC_ENTER;
+
+ int ret = 1;
+ sync_agent_dm_mo_error_e err = 1;
+ int count = 0;
+ int value = 0;
+
+ /*
+ * check ip push registration
+ */
+ //temp code
+/* int db_ret = 0;
+
+ db_ret = sync_agent_open_agent();
+ _DEBUG_INFO("OPEN DACI : %d", db_ret);*/
+ set_alarm_config_int(FUMO_ACCOUNT_FLAG_TYPE, FUMO_ACCOUNT_FLAG, 0, FUMO_ENGINE);
+ value = get_config_int(FUMO_ACCOUNT_FLAG_TYPE, FUMO_ACCOUNT_FLAG);
+
+ if (value != 1) {
+ do {
+ err = sync_agent_initialize_mo(3);
+ if (err == SYNC_AGENT_DM_MO_FAIL) {
+ _DEBUG_INFO("fail register fota account : %d ", err);
+ ret = 0;
+ } else {
+ _DEBUG_INFO("success register fota account : %d ", err);
+ break;
+ }
+ count++;
+ } while (err == SYNC_AGENT_DM_MO_FAIL && count < 3);
+
+ if (err == SYNC_AGENT_DM_MO_FAIL) {
+ ret = set_account_registration_alarm(FUMO_ACCOUNT_ALARM, FUMO_ACCOUNT_ALARM_TYPE);
+ _DEBUG_INFO("add fota account registration alarm : %d ", ret);
+ ret = 0;
+ } else {
+ ret = set_config_int(FUMO_ACCOUNT_FLAG_TYPE, FUMO_ACCOUNT_FLAG, 1, FUMO_ENGINE, 0);
+ _DEBUG_INFO("add fota account flag type setting result : %d ", ret);
+ delete_account_registration_alarm(FUMO_ACCOUNT_ALARM, FUMO_ACCOUNT_ALARM_TYPE);
+ _DEBUG_INFO("delete fota account delete alarm ");
+ }
+ } else {
+ //do nothing
+ }
+
+ /*db_ret = sync_agent_close_agent();
+ _DEBUG_INFO("CLOSE DACI : %d", db_ret); */
+ _DEBUG_INFO("end : %d", ret);
+ _EXTERN_FUNC_EXIT;
+ return ret;
+
+}