summaryrefslogtreecommitdiff
path: root/cleopatre/devkit/plcd/src/plcd_files.c
diff options
context:
space:
mode:
authorThierry Carré2013-03-20 14:44:17 +0100
committerThierry Carré2013-04-26 17:03:12 +0200
commit644934bb0f2efc6f03596dc47398d7cc16db21fe (patch)
tree44f9dec166b617a1821d2be78c8e071bc214b721 /cleopatre/devkit/plcd/src/plcd_files.c
parent4451f7e30c2ea196989f17359ed761ec60a29762 (diff)
cleo/devkit/plcd: move hpav.conf read into plcd_files.c, refs #3789
Diffstat (limited to 'cleopatre/devkit/plcd/src/plcd_files.c')
-rw-r--r--cleopatre/devkit/plcd/src/plcd_files.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/cleopatre/devkit/plcd/src/plcd_files.c b/cleopatre/devkit/plcd/src/plcd_files.c
new file mode 100644
index 0000000000..edda391659
--- /dev/null
+++ b/cleopatre/devkit/plcd/src/plcd_files.c
@@ -0,0 +1,58 @@
+/* Cleopatre project {{{
+ *
+ * Copyright (C) 2013 MStar Semiconductor
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file devkit/plcd/src/plcd_files.c
+ * \ingroup plcd
+ *
+ * Manage read and write operation for :
+ * - HPAV.CONF
+ * - HPAV.INFO
+ */
+#include "plcd_files.h"
+#include "plcd_ctx.h"
+
+#include "libspid.h"
+
+int
+plcd_files_read_hpavconf (plcd_ctx_t *ctx)
+{
+ char is_cco_preferred_str[LIBSPID_BOOLEAN_STR_MAX_LEN] = {0};
+ char was_cco_str[LIBSPID_BOOLEAN_STR_MAX_LEN] = {0};
+
+ PLCD_ASSERT (ctx);
+
+ /* read and save hpav.conf file contents */
+ if ((LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_CCO_PREFERRED, is_cco_preferred_str,
+ LIBSPID_BOOLEAN_STR_MAX_LEN))
+ || (LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_WAS_CCO, was_cco_str, LIBSPID_BOOLEAN_STR_MAX_LEN))
+ || (LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_NMK, ctx->hpav_conf.nmk_str,
+ LIBSPID_HPAV_CONF_NMK_STR_LEN))
+ || (LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_NID, ctx->hpav_conf.nid_str,
+ LIBSPID_HPAV_CONF_NID_STR_LEN))
+ || (LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_SL, ctx->hpav_conf.sl_str,
+ LIBSPID_HPAV_CONF_SL_STR_MAX_LEN))
+ || (LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_USER_HFID, ctx->hpav_conf.user_hfid,
+ LIBSPID_HPAV_CONF_HFID_MAX_LEN))
+ || (LIBSPID_SUCCESS != libspid_config_read_item (ctx->hpav_conf_path,
+ LIBSPID_HPAV_CONF_LABEL_AVLN_HFID, ctx->hpav_conf.avln_hfid,
+ LIBSPID_HPAV_CONF_HFID_MAX_LEN)))
+ {
+ syslog (LOG_WARNING, "libspid config read item failed");
+ return -1;
+ }
+
+ ctx->hpav_conf.is_cco_preferred = LIBSPID_GET_BOOLEAN (is_cco_preferred_str);
+ ctx->hpav_conf.was_cco = LIBSPID_GET_BOOLEAN (was_cco_str);
+ return 0;
+}