#ifndef CONFIG_ENGINE_H #define CONFIG_ENGINE_H #include #include #include "smart_sound.h" #ifdef __cplusplus extern "C" { #endif #define GLOBAL_CFG_FILE_PATH ("/mnt/UDISK/global.db") typedef enum { CFG_TYPE_STRING = 0, CFG_TYPE_INT = 1, CFG_TYPE_DOUBLE = 2, } CFG_DATA_TYPE; typedef struct { char* pKeyName; int keyType; int keyModule; union { char* pStrValue; int intValue; double doubleValue; }; UT_hash_handle hh; ///< UT Hash handle } CFG_ITEM, *PCFG_ITEM; typedef void (*OnCfgMsg)(DBUS_CMD cmd, PCFG_ITEM pMsg, int err); int CfgGlobalEnvInit(void); void CfgItemPrint(const char* pPrefix, PCFG_ITEM pCfgItem); int CfgGetKeyValue(const char* pKeyName, PCFG_ITEM* pItem); int CfgChangeKeyValue(const char *pKeyName, PCFG_ITEM pItem, int saveToDB); int CfgAddKeyValue(const char *pKeyName, PCFG_ITEM pItem, int saveToDB); void CfgSetIntValue(const char* pTags, int iValue); void OnCfgMsgProcess(MODULE_NAME dest, DBUS_CMD busCmd, const char *pJsonStr); int Sqlite3SyncDB(sqlite3* pSqlMemory, const char* pMemDbName, const char* pDBFilePath, const char* pFileDbName, int isSave); #ifdef __cplusplus } #endif #endif