summaryrefslogtreecommitdiff
path: root/src/plugins/dm-private/fumo/src/plugin_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dm-private/fumo/src/plugin_interface.c')
-rwxr-xr-xsrc/plugins/dm-private/fumo/src/plugin_interface.c234
1 files changed, 234 insertions, 0 deletions
diff --git a/src/plugins/dm-private/fumo/src/plugin_interface.c b/src/plugins/dm-private/fumo/src/plugin_interface.c
new file mode 100755
index 0000000..230e15a
--- /dev/null
+++ b/src/plugins/dm-private/fumo/src/plugin_interface.c
@@ -0,0 +1,234 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <vconf.h>
+
+/*sync-agent*/
+#include <sync_agent.h>
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+#ifndef OMADM_AGENT_LOG
+#undef LOG_TAG
+#define LOG_TAG "PLUGIN_FUMO"
+#endif
+
+#define SERVER_NUM 1
+
+static sync_agent_get_devinfo_cb func_get_dev_info = 0;
+
+//static int _get_index(const char *name);
+//static char *_get_mo_value_str(const char *vconf_key, int n_index);
+
+EXPORT_API char **sync_agent_plugin_get_server_id_list(int *server_id_list_cnt)
+{
+ _EXTERN_FUNC_ENTER;
+/*
+ *server_id_list_cnt = 0;
+ char **temp_id_list = (char **)calloc(SERVER_NUM, sizeof(char *));
+ if (temp_id_list == NULL) {
+ _EXTERN_FUNC_EXIT;
+ return 0;
+ }
+
+ char *sever_name = 0;
+ int server_idx = 0;
+ char *server_id = 0;
+
+ int i = 0;
+ for (i = 0; i < SERVER_NUM; i++) {
+
+ switch (i) {
+ case 0:
+ sever_name = ALTER_SYNCMLDM_ACCNAME_1;
+ break;
+ case 1:
+ sever_name = ALTER_SYNCMLDM_ACCNAME_2;
+ break;
+ }
+
+ server_idx = _get_index(sever_name);
+ server_id = _get_mo_value_str(CSC_VCONF_KEY_SYNCMLDM_SERVID, server_idx);
+ if (server_id == NULL) {
+ switch(i){
+ case 0:
+ server_id = strdup(ALTER_SYNCMLDM_SERVID_1);
+ break;
+ case 1:
+ server_id = strdup(ALTER_SYNCMLDM_SERVID_2);
+ break;
+ }
+ }
+ _DEBUG_INFO("Temp_id_list[%d] = %s\n", i, server_id);
+ temp_id_list[i] = server_id;
+ (*server_id_list_cnt)++;
+ }
+ _DEBUG_INFO("server_id_list_cnt = %d\n", *server_id_list_cnt);
+
+ _EXTERN_FUNC_EXIT;
+ return temp_id_list;
+*/
+ *server_id_list_cnt = 1;
+ char **temp_id_list = (char **)calloc(SERVER_NUM, sizeof(char *));
+ if (temp_id_list == NULL) {
+ _EXTERN_FUNC_EXIT;
+ return NULL;
+ }
+ char *server_id = NULL;
+ server_id = strdup("*");
+ *temp_id_list = server_id;
+
+ _DEBUG_INFO("fumo server_id = %s\n", server_id);
+ _DEBUG_INFO("fumo server_id_list_cnt = %d\n", *server_id_list_cnt);
+
+ _EXTERN_FUNC_EXIT;
+ return temp_id_list;
+}
+
+EXPORT_API int sync_agent_plugin_get_mo_value(const char *mo_pull_path, const char *mo_name, char **mo_value)
+{
+ _EXTERN_FUNC_ENTER;
+
+ retvm_if((mo_pull_path) == NULL, -1, "mo_pull_path is NULL!!");
+ retvm_if((mo_name) == NULL, -1, "mo_name is NULL!!");
+
+ _DEBUG_INFO("mo_name : %s", mo_name);
+ *mo_value = NULL;
+
+ if (!strcmp(mo_name, "PkgName")) {
+ /*
+ if (pFunc_Get_DevInfo == NULL) {
+ return -1;
+ }
+ sync_agent_dev_return_e res = pFunc_Get_DevInfo(2, "FwV", mo_value);
+ */
+ } else if (!strcmp(mo_name, "PkgVersion")) {
+ /* Empty */
+ } else if (!strcmp(mo_name, "State")) {
+ *mo_value = strdup("10");
+ }
+
+ _DEBUG_INFO("mo_value : %s", *mo_value);
+ _EXTERN_FUNC_EXIT;
+ return 0;
+}
+
+EXPORT_API void sync_agent_plugin_set_function_get_devinfo(sync_agent_get_devinfo_cb func)
+{
+ _EXTERN_FUNC_ENTER;
+
+ func_get_dev_info = func;
+
+ _EXTERN_FUNC_EXIT;
+}
+
+EXPORT_API int sync_agent_plugin_initialize()
+{
+ _EXTERN_FUNC_ENTER;
+
+ int result = 1;
+ result = 1; //_req_fumo_server_reg(0);
+/*
+ if (result == -1)
+ goto error;
+*/
+ _EXTERN_FUNC_EXIT;
+
+ return result;
+/*
+ error:
+
+ _EXTERN_FUNC_EXIT;
+ return -1; // Fail
+*/
+}
+
+/*
+static int _get_index(const char *name)
+{
+ _INNER_FUNC_ENTER;
+
+ retvm_if((name) == NULL, -1, "name is NULL!!");
+
+ int n_acc_count = 0;
+ if (vconf_get_int(CSC_VCONF_KEY_SYNCMLDM_NBFIELD, &n_acc_count)) {
+ _DEBUG_TRACE("vconf_get_int FAIL");
+ //return -1;
+ n_acc_count =ALTER_SYNCMLDM_NBFIELD;
+ }
+
+ _DEBUG_TRACE("nAccCount : %d", n_acc_count);
+
+ int i = 0;
+ for (; i < n_acc_count; i++) {
+ char *compare_name = _get_mo_value_str(CSC_VCONF_KEY_SYNCMLDM_ACCNAME, i + 1);
+ if (compare_name == NULL) {
+ switch(i) {
+ case 0:
+ compare_name = ALTER_SYNCMLDM_ACCNAME_1;
+ break;
+ case 1:
+ compare_name = ALTER_SYNCMLDM_ACCNAME_2;
+ break;
+ default :
+ continue;
+ break;
+ }
+ }
+
+ _DEBUG_TRACE("[%d] compare_name : %s [%d], name : %s [%d]", i, compare_name, strlen(compare_name), name, strlen(name));
+ if (!strcmp(name, compare_name)) {
+ _DEBUG_TRACE("nIndex : %d", i + 1);
+ return i + 1;
+ }
+ }
+
+ _INNER_FUNC_EXIT;
+ return -1;
+}
+
+static char *_get_mo_value_str(const char *vconf_key, int n_index)
+{
+ _INNER_FUNC_ENTER;
+
+ retvm_if((vconf_key) == NULL, NULL, "vconf_key is NULL!!");
+
+ if (n_index == -1) {
+ _EXTERN_FUNC_EXIT;
+ return 0;
+ }
+
+ char input_vconf_path[200] = { 0, };
+ char rec_idx[8];
+
+ memset(rec_idx, 0x0, sizeof(rec_idx));
+ snprintf(rec_idx, sizeof(rec_idx), "%d", n_index);
+ snprintf(input_vconf_path, strlen(vconf_key) + strlen(rec_idx) + 1, vconf_key, n_index);
+
+ char *value = vconf_get_str(input_vconf_path);
+ if (value == NULL) {
+ _DEBUG_TRACE("vconf_get_str FAIL");
+ }
+
+ _INNER_FUNC_EXIT;
+ return value;
+}
+*/