pcshareMgr/src/settings.c File Reference

Get PC share related settings. More...

#include <stdlib.h>
#include <glib.h>
#include <libermanifest/ermanifest.h>
#include "logging.h"
#include "constants.h"
#include "settings.h"

Go to the source code of this file.

Functions

static pcShareCfg_tmakeDefaultCfg ()
pcShareCfg_tget_pc_share_settings ()
void free_pc_share_settings (pcShareCfg_t *thePCShareSettings)


Detailed Description

Get PC share related settings.

Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.

<File description>="">

Definition in file settings.c.


Function Documentation

void free_pc_share_settings ( pcShareCfg_t thePCShareSettings  ) 

Definition at line 95 of file settings.c.

00096 {
00097     DL_LOGPRINTF("entry");
00098     g_free(thePCShareSettings);
00099 }

pcShareCfg_t* get_pc_share_settings (  ) 

Definition at line 61 of file settings.c.

00062 {
00063     DL_LOGPRINTF("entry");
00064 
00065     // Open /mnt/share/iliad.xml
00066     char szCfgFilePath[MAX_PATH];
00067     snprintf(szCfgFilePath, sizeof(szCfgFilePath), "%s/%s", SHARE_MOUNT_POINT, CONFIG_FILE);
00068 
00069     erManifest manifest;
00070     if (RET_OK != ermXmlOpenFile(szCfgFilePath, &manifest))
00071     {
00072         DL_ERRORPRINTF("Could not open manifest file [%s]", szCfgFilePath);
00073         return makeDefaultCfg();
00074     }
00075 
00076     pcShareCfg_t* thePCShareSettings = NULL;
00077     thePCShareSettings = g_new0(pcShareCfg_t, 1);
00078 
00079     if (NULL == thePCShareSettings)
00080     {
00081         DL_ERRORPRINTF("Memory allocation failed.");
00082         g_assert_not_reached();
00083     }
00084 
00085     int ret = ermXmlGetBoolean(&manifest, OVERWRITE_SETTING_XPATH, &thePCShareSettings->overwrite);
00086     if (ret == RET_ERR)
00087     {
00088         thePCShareSettings->overwrite = FALSE;
00089     }
00090 
00091     ermXmlClose(&manifest);
00092     return thePCShareSettings;
00093 }

Here is the call graph for this function:

static pcShareCfg_t* makeDefaultCfg (  )  [static]

Definition at line 45 of file settings.c.

00046 {
00047     pcShareCfg_t* thePCShareSettings = NULL;
00048 
00049     thePCShareSettings = g_new0(pcShareCfg_t, 1);
00050 
00051     if (NULL == thePCShareSettings)
00052     {
00053         DL_ERRORPRINTF("Memory allocation failed.");
00054         g_assert_not_reached();
00055     }
00056 
00057     thePCShareSettings->overwrite = FALSE;
00058     return thePCShareSettings;
00059 }


Generated on Sun Dec 14 17:16:51 2008 by  doxygen 1.5.6