rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #ifndef AUDIO_PARAM_PARSER_H |
| 2 | #define AUDIO_PARAM_PARSER_H |
| 3 | |
| 4 | #include <libxml/parser.h> |
| 5 | #include <libxml/xmlreader.h> |
| 6 | #include <libxml/tree.h> |
| 7 | |
| 8 | #ifdef WIN32 |
| 9 | #pragma warning( disable : 4996 ) |
| 10 | #ifdef __cplusplus |
| 11 | #define EXPORT extern "C" __declspec(dllexport) |
| 12 | #else |
| 13 | #define EXPORT __declspec(dllexport) |
| 14 | #endif |
| 15 | #else /* WIN32*/ |
| 16 | #define EXPORT |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | #endif |
| 21 | |
| 22 | #include "utstring.h" |
| 23 | #include "uthash.h" |
| 24 | #include "utlist.h" |
| 25 | |
| 26 | #ifndef WIN32 |
| 27 | #include <pthread.h> |
| 28 | #endif |
| 29 | |
| 30 | /* Enable cus xml support */ |
| 31 | //#define APP_FORCE_ENABLE_CUS_XML |
| 32 | |
| 33 | /* Debugging Macro Definition */ |
| 34 | //#define FORCE_DEBUG_LEVEL |
| 35 | |
| 36 | #define XML_FOLDER_ON_TUNING_TOOL ".\\preload_xml\\" |
| 37 | #define XML_CUS_FOLDER_ON_TUNING_TOOL ".\\cus_xml\\" |
| 38 | #define XML_FOLDER_ON_DEVICE "/system/etc/audio_param/" |
| 39 | #define XML_CUS_FOLDER_ON_DEVICE "/home/root/.audio_param/" |
| 40 | |
| 41 | #define MAX_AUDIO_TYPE_LEN 50 |
| 42 | #define INOTIFY_BUF_SIZE 512 |
| 43 | |
| 44 | #define AUDIO_PARAM_XML_POSFIX "_AudioParam.xml" |
| 45 | #define PARAM_UNIT_DESC_XML_POSFIX "_ParamUnitDesc.xml" |
| 46 | #define PARAM_TREE_VIEW_XML_POSFIX "_ParamTreeView.xml" |
| 47 | #define FEATURE_OPTIONS_XML "AudioParamOptions.xml" |
| 48 | |
| 49 | /* XML element definition */ |
| 50 | #define ELEM_AUDIO_FEATURE_OPTIONS "AudioParamOptions" |
| 51 | #define ELEM_PARAM "Param" |
| 52 | #define ELEM_PARAM_UNIT_DESC "ParamUnitDesc" |
| 53 | #define ELEM_CATEGORY_TYPE_LIST "CategoryTypeList" |
| 54 | #define ELEM_CATEGORY_TYPE "CategoryType" |
| 55 | #define ELEM_CATEGORY_GROUP "CategoryGroup" |
| 56 | #define ELEM_CATEGORY "Category" |
| 57 | |
| 58 | #define ELEM_AUDIO_PARAM "AudioParam" |
| 59 | #define ELEM_PARAM_TREE "ParamTree" |
| 60 | #define ELEM_PARAM_UNIT_POOL "ParamUnitPool" |
| 61 | #define ELEM_PARAM_UNIT "ParamUnit" |
| 62 | #define ELEM_PARAM "Param" |
| 63 | #define ELEM_FIELD "Field" |
| 64 | |
| 65 | #define ELEM_PARAM_TREE_VIEW "ParamTreeView" |
| 66 | #define ELEM_TREE_ROOT "TreeRoot" |
| 67 | #define ELEM_SHEET "Sheet" |
| 68 | #define ELEM_FEATURE "Feature" |
| 69 | #define ELEM_FIELD_LIST "FieldList" |
| 70 | #define ELEM_CATEGORY_PATH_LIST "CategoryPathList" |
| 71 | |
| 72 | /* XML attribute definition */ |
| 73 | #define ATTRI_NAME "name" |
| 74 | #define ATTRI_TAB_NAME "tab_name" |
| 75 | #define ATTRI_VERSION "version" |
| 76 | #define ATTRI_WORDING "wording" |
| 77 | #define ATTRI_PARAM_ID "param_id" |
| 78 | #define ATTRI_PATH "path" |
| 79 | #define ATTRI_VALUE "value" |
| 80 | #define ATTRI_TYPE "type" |
| 81 | #define ATTRI_ARRAY_INDEX "array_index" |
| 82 | #define ATTRI_BIT "bit" |
| 83 | #define ATTRI_CHECK_LIST "check_list" |
| 84 | #define ATTRI_ALIAS "alias" |
| 85 | #define ATTRI_FEATURE_OPTION "feature_option" |
| 86 | #define ATTRI_SWITCH_AUDIO_TYPE "switch_audio_type" |
| 87 | #define ATTRI_SWITCH_PARAM "switch_param" |
| 88 | #define ATTRI_SWITCH_FIELD "switch_field" |
| 89 | #define ATTRI_AUDIO_TYPE "audio_type" |
| 90 | #define ATTRI_PARAM "param" |
| 91 | #define ATTRI_VISIBLE "visible" |
| 92 | |
| 93 | /* DATA_TYPE string */ |
| 94 | #define DATA_TYPE_UNKNOWN_STRING "unknown" |
| 95 | #define DATA_TYPE_STR_STRING "string" |
| 96 | #define DATA_TYPE_INT_STRING "int" |
| 97 | #define DATA_TYPE_UINT_STRING "uint" |
| 98 | #define DATA_TYPE_FLOAT_STRING "float" |
| 99 | #define DATA_TYPE_BYTE_ARRAY_STRING "byte_array" |
| 100 | #define DATA_TYPE_UBYTE_ARRAY_STRING "ubyte_array" |
| 101 | #define DATA_TYPE_SHORT_ARRAY_STRING "short_array" |
| 102 | #define DATA_TYPE_USHORT_ARRAY_STRING "ushort_array" |
| 103 | #define DATA_TYPE_INT_ARRAY_STRING "int_array" |
| 104 | #define DATA_TYPE_UINT_ARRAY_STRING "uint_array" |
| 105 | #define DATA_TYPE_DOUBLE_ARRAY_STRING "double_array" |
| 106 | #define DATA_TYPE_FIELD_STRING "Field" |
| 107 | |
| 108 | #define ARRAY_SEPERATOR "," |
| 109 | #define ARRAY_SEPERATOR_CH ',' |
| 110 | #define PARAM_FIELD_NAME_SEPERATOR "/" |
| 111 | |
| 112 | #define AUDIO_TYPE_FMT_STR(STR_LEN) AUDIO_TYPE_FMT(STR_LEN) |
| 113 | #define AUDIO_TYPE_FMT(STR_LEN) "%"#STR_LEN"[^_]" |
| 114 | |
| 115 | typedef struct _AppHandle AppHandle; |
| 116 | typedef struct _AudioType AudioType; |
| 117 | typedef struct _FieldInfo FieldInfo; |
| 118 | typedef struct _Category Category; |
| 119 | typedef struct _CategoryAlias CategoryAlias; |
| 120 | typedef struct _CategoryGroup CategoryGroup; |
| 121 | typedef struct _CategoryNameAlias CategoryNameAlias; |
| 122 | typedef struct _CategoryPath CategoryPath; |
| 123 | typedef struct _CategoryType CategoryType; |
| 124 | typedef struct _Feature Feature; |
| 125 | typedef struct _FeatureField FeatureField; |
| 126 | typedef struct _FeatureOption FeatureOption; |
| 127 | typedef struct _Param Param; |
| 128 | typedef struct _ParamInfo ParamInfo; |
| 129 | typedef struct _ParamTreeView ParamTreeView; |
| 130 | typedef struct _ParamUnit ParamUnit; |
| 131 | typedef struct _TreeRoot TreeRoot; |
| 132 | typedef struct _NotifyCb NotifyCb; |
| 133 | |
| 134 | typedef void(*NOTIFY_CB_FUN)(AppHandle *appHandle, const char *audioType); |
| 135 | |
| 136 | extern int appDebugLevel; |
| 137 | |
| 138 | typedef enum |
| 139 | { |
| 140 | DEBUG_LEVEL = 0, |
| 141 | INFO_LEVEL, |
| 142 | WARN_LEVEL, |
| 143 | ERR_LEVEL, |
| 144 | } MSG_LEVEL; |
| 145 | |
| 146 | typedef enum |
| 147 | { |
| 148 | APP_ERROR = 0, |
| 149 | APP_NO_ERROR = 1, |
| 150 | } APP_STATUS; |
| 151 | |
| 152 | typedef enum |
| 153 | { |
| 154 | PARENT_IS_CATEGORY_GROUP = 0, |
| 155 | PARENT_IS_CATEGORY_TYPE = 1, |
| 156 | } CATEGORY_PARENT_TYPE; |
| 157 | |
| 158 | /* |
| 159 | Due to the system/media/camera/include/system/camera_metadata.h declare the same TYPE_FLOAT enum name, |
| 160 | If module include the camera_metadata.h and AudioParamParser.h, AudioParamParser change the DATA_TYPE |
| 161 | enum decleration to avoid conflict. |
| 162 | User could using the APP_TYPE_FLOAT enum instead the TYPE_FLOAT. |
| 163 | */ |
| 164 | #ifndef SYSTEM_MEDIA_INCLUDE_ANDROID_CAMERA_METADATA_H |
| 165 | typedef enum |
| 166 | { |
| 167 | TYPE_UNKNOWN = -1, |
| 168 | TYPE_STR, |
| 169 | TYPE_INT, |
| 170 | TYPE_UINT, |
| 171 | TYPE_FLOAT, |
| 172 | TYPE_BYTE_ARRAY, |
| 173 | TYPE_UBYTE_ARRAY, |
| 174 | TYPE_SHORT_ARRAY, |
| 175 | TYPE_USHORT_ARRAY, |
| 176 | TYPE_INT_ARRAY, |
| 177 | TYPE_UINT_ARRAY, |
| 178 | TYPE_DOUBLE_ARRAY, |
| 179 | TYPE_FIELD, |
| 180 | } DATA_TYPE; |
| 181 | #else |
| 182 | typedef enum |
| 183 | { |
| 184 | APP_TYPE_UNKNOWN = -1, |
| 185 | APP_TYPE_STR, |
| 186 | APP_TYPE_INT, |
| 187 | APP_TYPE_UINT, |
| 188 | APP_TYPE_FLOAT, |
| 189 | APP_TYPE_BYTE_ARRAY, |
| 190 | APP_TYPE_UBYTE_ARRAY, |
| 191 | APP_TYPE_SHORT_ARRAY, |
| 192 | APP_TYPE_USHORT_ARRAY, |
| 193 | APP_TYPE_INT_ARRAY, |
| 194 | APP_TYPE_UINT_ARRAY, |
| 195 | APP_TYPE_DOUBLE_ARRAY, |
| 196 | APP_TYPE_FIELD, |
| 197 | } DATA_TYPE; |
| 198 | #endif |
| 199 | |
| 200 | typedef union CategoryParent |
| 201 | { |
| 202 | Category *category; /* Link to parent Category if it's not CategoryGroup */ |
| 203 | CategoryType *categoryType; /* Link to parent CategoryType if it's CategoryGroup */ |
| 204 | } CategoryParent; |
| 205 | |
| 206 | /* UHash the parameter tree info from ParamTreeView.xml */ |
| 207 | struct _CategoryPath |
| 208 | { |
| 209 | char *path; |
| 210 | Feature *feature; |
| 211 | UT_hash_handle hh; |
| 212 | }; |
| 213 | |
| 214 | struct _FeatureField |
| 215 | { |
| 216 | FieldInfo *fieldInfo; |
| 217 | UT_hash_handle hh; |
| 218 | }; |
| 219 | |
| 220 | struct _Feature |
| 221 | { |
| 222 | char *name; |
| 223 | char *featureOption; |
| 224 | FieldInfo *switchFieldInfo; |
| 225 | CategoryPath *categoryPathHash; |
| 226 | FeatureField *featureFieldHash; |
| 227 | AudioType *audioType; |
| 228 | UT_hash_handle hh; |
| 229 | }; |
| 230 | |
| 231 | struct _TreeRoot |
| 232 | { |
| 233 | char *name; /* Key */ |
| 234 | FieldInfo *switchFieldInfo; |
| 235 | xmlNode *treeRootNode; /* Used to traversal tree */ |
| 236 | Feature *featureHash; /* Used to opt feature information */ |
| 237 | ParamTreeView *paramTreeView; /* Belong to which paramTreeView */ |
| 238 | UT_hash_handle hh; |
| 239 | }; |
| 240 | |
| 241 | struct _ParamTreeView |
| 242 | { |
| 243 | int verMaj; |
| 244 | int verMin; |
| 245 | AudioType *audioType; |
| 246 | TreeRoot *treeRootHash; |
| 247 | }; |
| 248 | |
| 249 | /* Hash the Param & Field info from ParamUnitDesc.xml */ |
| 250 | struct _FieldInfo |
| 251 | { |
| 252 | char *name; /* key */ |
| 253 | size_t arrayIndex; |
| 254 | int startBit; |
| 255 | int endBit; |
| 256 | char *checkListStr; /* check list string array */ |
| 257 | struct _ParamInfo *paramInfo; /* Link to parent ParamInfo */ |
| 258 | UT_hash_handle hh; /* hash handle */ |
| 259 | }; |
| 260 | |
| 261 | struct _ParamInfo |
| 262 | { |
| 263 | char *name; /* key */ |
| 264 | DATA_TYPE dataType; |
| 265 | struct _FieldInfo *fieldInfoHash; |
| 266 | AudioType *audioType; /* Link to parent AudioType */ |
| 267 | UT_hash_handle hh; /* hash handle */ |
| 268 | }; |
| 269 | |
| 270 | /* Hash the param name with value from AudioParam.xml */ |
| 271 | struct _Param |
| 272 | { |
| 273 | char *name; /* key */ |
| 274 | void *data; /* raw data */ |
| 275 | size_t arraySize; /* Array size if the data is the array pointer */ |
| 276 | ParamInfo *paramInfo; |
| 277 | struct _ParamUnit *paramUnit; /* Link to it's ParamUnit */ |
| 278 | UT_hash_handle hh; /* hash handle */ |
| 279 | }; |
| 280 | |
| 281 | /* Hash the id with ParamUnit from AudioParam.xml */ |
| 282 | struct _ParamUnit |
| 283 | { |
| 284 | int paramId; /* key */ |
| 285 | int refCount; |
| 286 | AudioType *audioType; /* Link to it's AudioType */ |
| 287 | struct _Param *paramHash; /* ParamUnit's params */ |
| 288 | UT_hash_handle hh; |
| 289 | }; |
| 290 | |
| 291 | /* Hash ParamTree info from AudioParam.xml */ |
| 292 | typedef struct |
| 293 | { |
| 294 | char *categoryPath; /* key */ |
| 295 | int paramId; /* Param id */ |
| 296 | UT_hash_handle hh; |
| 297 | } ParamTree; |
| 298 | |
| 299 | struct _Category |
| 300 | { |
| 301 | char *wording; /* key */ |
| 302 | char *name; |
| 303 | int visible; |
| 304 | CategoryParent parent; |
| 305 | CATEGORY_PARENT_TYPE parentType; |
| 306 | UT_hash_handle hh; |
| 307 | }; |
| 308 | |
| 309 | struct _CategoryAlias |
| 310 | { |
| 311 | char *alias; /* key */ |
| 312 | Category *category; |
| 313 | UT_hash_handle hh; |
| 314 | }; |
| 315 | |
| 316 | struct _CategoryGroup |
| 317 | { |
| 318 | char *wording; /* key */ |
| 319 | char *name; |
| 320 | int visible; |
| 321 | Category *categoryHash; /* Link to children */ |
| 322 | CategoryType *categoryType; /* Link to parent */ |
| 323 | UT_hash_handle hh; |
| 324 | }; |
| 325 | |
| 326 | struct _CategoryType |
| 327 | { |
| 328 | char *wording; /* key */ |
| 329 | char *name; |
| 330 | int visible; |
| 331 | CategoryGroup *categoryGroupHash; /* Link to children */ |
| 332 | Category *categoryHash; /* Link to children */ |
| 333 | CategoryAlias *categoryAliasHash; /* Save category alias information */ |
| 334 | AudioType *audioType; /* Link to parent */ |
| 335 | UT_hash_handle hh; |
| 336 | }; |
| 337 | |
| 338 | struct _AudioType |
| 339 | { |
| 340 | char *name; |
| 341 | char *tabName; |
| 342 | int paramUnitDescVerMaj; /* ParamUniDesc version */ |
| 343 | int paramUnitDescVerMin; |
| 344 | int audioParamVerMaj; /* AudioParam version */ |
| 345 | int audioParamVerMin; |
| 346 | xmlDocPtr audioParamDoc; |
| 347 | xmlDocPtr paramUnitDescDoc; |
| 348 | xmlDocPtr paramTreeViewDoc; |
| 349 | ParamTree *paramTreeHash; |
| 350 | ParamUnit *paramUnitHash; |
| 351 | ParamInfo *paramInfoHash; |
| 352 | ParamTreeView *paramTreeView; |
| 353 | int unusedParamId; |
| 354 | int dirty; /* Indicate if the audio type modified without saveing*/ |
| 355 | int allowReload; /* Indicate the audio type can be reload since xml updated */ |
| 356 | CategoryType *categoryTypeHash; |
| 357 | #ifndef WIN32 |
| 358 | pthread_rwlock_t lock; |
| 359 | const char *lockCallerFun; /* Used to cache the lock holder */ |
| 360 | #endif |
| 361 | AppHandle *appHandle; /* Link to it's appHandle parent */ |
| 362 | UT_hash_handle hh; |
| 363 | }; |
| 364 | |
| 365 | struct _FeatureOption |
| 366 | { |
| 367 | char *name; |
| 368 | char *value; |
| 369 | UT_hash_handle hh; |
| 370 | }; |
| 371 | |
| 372 | struct _NotifyCb |
| 373 | { |
| 374 | NOTIFY_CB_FUN cb; |
| 375 | char test[512]; |
| 376 | struct _NotifyCb *next, *pre; |
| 377 | }; |
| 378 | |
| 379 | struct _AppHandle |
| 380 | { |
| 381 | char *xmlDir; |
| 382 | char *xmlCusDir; |
| 383 | AudioType *audioTypeHash; |
| 384 | FeatureOption *featureOptionsHash; |
| 385 | xmlDocPtr featureOptionsDoc; |
| 386 | #ifndef WIN32 |
| 387 | pthread_t appThread; |
| 388 | int appThreadExit; |
| 389 | int inotifyFd; |
| 390 | pthread_rwlock_t lock; |
| 391 | const char *lockCallerFun; /* Used to cache the lock holder */ |
| 392 | #endif |
| 393 | NotifyCb *noficyCbList; |
| 394 | }; |
| 395 | |
| 396 | typedef struct AudioTypeVerInfo{ |
| 397 | const char* audioTypeName; |
| 398 | int paramUnitDescVerMaj; |
| 399 | int paramUnitDescVerMin; |
| 400 | int audioParamVerMaj; |
| 401 | int audioParamVerMin; |
| 402 | } AudioTypeVerInfo; |
| 403 | |
| 404 | static const AudioTypeVerInfo audioTypeSupportVerInfo [] = |
| 405 | { |
| 406 | /* AudioType name, ParamUnitDescVer (maj, min), AudioParamVer (maj, min) */ |
| 407 | {"AudioCommonSetting", 1, 0, 1, 0}, |
| 408 | {"PlaybackACF", 1, 0, 1, 0}, |
| 409 | {"Playback", 1, 0, 1, 0}, |
| 410 | {"PlaybackDRC", 1, 0, 1, 0}, |
| 411 | {"PlaybackHCF", 1, 0, 1, 0}, |
| 412 | {"PlaybackVolAna", 1, 0, 1, 0}, |
| 413 | {"PlaybackVolDigi", 1, 0, 1, 0}, |
| 414 | {"PlaybackVolUI", 1, 0, 1, 0}, |
| 415 | {"Record", 1, 0, 1, 0}, |
| 416 | {"RecordDMNR", 1, 0, 1, 0}, |
| 417 | {"RecordFIR", 1, 0, 1, 0}, |
| 418 | {"RecordUI", 1, 0, 1, 0}, |
| 419 | {"RecordVol", 1, 0, 1, 0}, |
| 420 | {"RecordVolUI", 1, 0, 1, 0}, |
| 421 | {"Speech", 1, 0, 1, 0}, |
| 422 | {"SpeechDMNR", 1, 0, 1, 0}, |
| 423 | {"SpeechGeneral", 1, 0, 1, 0}, |
| 424 | {"SpeechMagiClarity", 1, 0, 1, 0}, |
| 425 | {"SpeechUI", 1, 0, 1, 0}, |
| 426 | {"SpeechVol", 1, 0, 1, 0}, |
| 427 | {"SpeechVolUI", 1, 0, 1, 0}, |
| 428 | {"VoIP", 1, 0, 1, 0}, |
| 429 | {"VoIPDMNR", 1, 0, 1, 0}, |
| 430 | {"VoIPGeneral", 1, 0, 1, 0}, |
| 431 | {"VoIPUI", 1, 0, 1, 0}, |
| 432 | {"VoIPVol", 1, 0, 1, 0}, |
| 433 | {"VoIPVolUI", 1, 0, 1, 0}, |
| 434 | {"Volume", 1, 0, 1, 0}, |
| 435 | {"VolumeGainMap", 1, 0, 1, 0}, |
| 436 | {NULL, 0, 0, 0, 0} |
| 437 | }; |
| 438 | |
| 439 | /*********************** |
| 440 | * Public API |
| 441 | **********************/ |
| 442 | EXPORT void appSetDebugLevel(MSG_LEVEL level); |
| 443 | EXPORT MSG_LEVEL appGetDebugLevel(void); |
| 444 | |
| 445 | /* appHandle API */ |
| 446 | EXPORT APP_STATUS appHandleInit(AppHandle *appHandle); |
| 447 | EXPORT APP_STATUS appHandleUninit(AppHandle *appHandle); |
| 448 | EXPORT void appHandleRedirectIOToConsole(void); |
| 449 | EXPORT AppHandle *appHandleGetInstance(void); /* Never uninit global instance */ |
| 450 | EXPORT size_t appHandleGetNumOfAudioType(AppHandle *appHandle); |
| 451 | EXPORT AudioType *appHandleGetAudioTypeByIndex(AppHandle *appHandle, size_t index); |
| 452 | EXPORT AudioType *appHandleGetAudioTypeByName(AppHandle *appHandle, const char *name); |
| 453 | EXPORT const char *appHandleGetFeatureOptionValue(AppHandle *appHandle, const char *featureOptionName); |
| 454 | EXPORT int appHandleIsFeatureOptionEnabled(AppHandle *appHandle, const char *featureOptionName); |
| 455 | EXPORT size_t appHandleGetNumOfFeatureOption(AppHandle *appHandle); |
| 456 | EXPORT FeatureOption *appHandleGetFeatureOptionByIndex(AppHandle *appHandle, size_t index); |
| 457 | EXPORT const char *appHandleGetBuildTimeStamp(); |
| 458 | EXPORT APP_STATUS appHandleCompressFiles(const char* srcDir, const char* destFile); |
| 459 | EXPORT APP_STATUS appHandleUncompressFile(const char* srcFile, const char* destDir); |
| 460 | |
| 461 | /* Following 4 APIs will acquire app handle write lock automatically */ |
| 462 | EXPORT APP_STATUS appHandleParseXml(AppHandle *appHandle, const char *dir, const char *cusDir); |
| 463 | EXPORT APP_STATUS appHandleReloadAudioType(AppHandle *appHandle, const char *audioTypeName); |
| 464 | EXPORT void appHandleRegXmlChangedCb(AppHandle *appHandle, NOTIFY_CB_FUN nofiyCallback); |
| 465 | EXPORT void appHandleUnregXmlChangedCb(AppHandle *appHandle, NOTIFY_CB_FUN nofiyCallback); |
| 466 | |
| 467 | /* AudioType API */ |
| 468 | EXPORT APP_STATUS audioTypeIsTuningToolSupportedXmlVer(AudioType *audioType); |
| 469 | EXPORT APP_STATUS audioTypeIsDeviceSupportedXmlVer(AudioType *audioType); |
| 470 | EXPORT size_t audioTypeGetNumOfCategoryType(AudioType *audioType); |
| 471 | EXPORT CategoryType *audioTypeGetCategoryTypeByIndex(AudioType *audioType, size_t idnex); |
| 472 | EXPORT CategoryType *audioTypeGetCategoryTypeByName(AudioType *audioType, const char *categoryTypeName); |
| 473 | EXPORT CategoryType *audioTypeGetCategoryTypeByWording(AudioType *audioType, const char *categoryTypeWording); |
| 474 | EXPORT xmlNode *audioTypeGetCategoryTypeListNode(AudioType *audioType); |
| 475 | EXPORT ParamUnit *audioTypeGetParamUnit(AudioType *audioType, const char *categoryPath); |
| 476 | EXPORT size_t audioTypeGetNumOfParamInfo(AudioType *audioType); |
| 477 | EXPORT ParamInfo *audioTypeGetParamInfoByIndex(AudioType *audioType, size_t index); |
| 478 | EXPORT ParamInfo *audioTypeGetParamInfoByName(AudioType *audioType, const char *paramName); |
| 479 | EXPORT APP_STATUS audioTypeSaveAudioParamXml(AudioType *audioType, const char *saveDir, int clearDirtyBit); |
| 480 | EXPORT int audioTypeReadLock(AudioType *audioType, const char *callerFun); |
| 481 | EXPORT int audioTypeWriteLock(AudioType *audioType, const char *callerFun); |
| 482 | EXPORT int audioTypeUnlock(AudioType *audioType); |
| 483 | EXPORT TreeRoot *audioTypeGetTreeRoot(AudioType *audioType, const char *treeRootName); |
| 484 | |
| 485 | /* Following 3 write APIs will acquire write lock automatically */ |
| 486 | EXPORT APP_STATUS audioTypeSetParamData(AudioType *audioType, const char *categoryPath, ParamInfo *paramName, void *dataPtr, int arraySize); |
| 487 | EXPORT APP_STATUS audioTypeSetFieldData(AudioType *audioType, const char *categoryPath, FieldInfo *fieldInfo, unsigned int val); |
| 488 | EXPORT APP_STATUS audioTypeParamUnitCopy(AudioType *audioType, const char *srcCategoryPath, const char *dstCategoryPath); |
| 489 | |
| 490 | /* CategoryType API */ |
| 491 | EXPORT size_t categoryTypeGetNumOfCategoryGroup(CategoryType *categoryType); |
| 492 | EXPORT CategoryGroup *categoryTypeGetCategoryGroupByIndex(CategoryType *categoryType, size_t index); |
| 493 | EXPORT CategoryGroup *categoryTypeGetCategoryGroupByWording(CategoryType *categoryType, const char *wording); |
| 494 | EXPORT size_t categoryTypeGetNumOfCategory(CategoryType *categoryType); |
| 495 | EXPORT Category *categoryTypeGetCategoryByIndex(CategoryType *categoryType, size_t index); |
| 496 | EXPORT Category *categoryTypeGetCategoryByWording(CategoryType *categoryType, const char *wording); |
| 497 | |
| 498 | /* CategoryGroup API */ |
| 499 | EXPORT size_t categoryGroupGetNumOfCategory(CategoryGroup *categoryGroup); |
| 500 | EXPORT Category *categoryGroupGetCategoryByIndex(CategoryGroup *categoryGroup, size_t index); |
| 501 | EXPORT Category *categoryGroupGetCategoryByWording(CategoryGroup *categoryGroup, const char *index); |
| 502 | |
| 503 | /* CategoryAlias API */ |
| 504 | EXPORT CategoryAlias *categoryAliasCreate(const char *alias, Category *category); |
| 505 | EXPORT void categoryAliasRelease(CategoryAlias *categoryAlias); |
| 506 | |
| 507 | /* ParamInfo API */ |
| 508 | EXPORT size_t paramInfoGetNumOfFieldInfo(ParamInfo *paramInfo); |
| 509 | EXPORT FieldInfo *paramInfoGetFieldInfoByIndex(ParamInfo *paramInfo, size_t index); |
| 510 | EXPORT FieldInfo *paramInfoGetFieldInfoByName(ParamInfo *paramInfo, const char *fieldName); |
| 511 | EXPORT char *paramNewDataStr(Param *param); |
| 512 | |
| 513 | /* ParamUnit API */ |
| 514 | EXPORT size_t paramUnitGetNumOfParam(ParamUnit *paramUnit); |
| 515 | EXPORT Param *paramUnitGetParamByIndex(ParamUnit *paramUnit, size_t index); |
| 516 | EXPORT Param *paramUnitGetParamByName(ParamUnit *paramUnit, const char *paramName); |
| 517 | EXPORT ParamInfo *paramUnitGetParamInfo(ParamUnit *paramUnit, const char *paramInfoName); |
| 518 | EXPORT FieldInfo *paramUnitGetFieldInfo(ParamUnit *paramUnit, const char *paramName, const char *fieldName); |
| 519 | EXPORT APP_STATUS paramUnitGetFieldVal(ParamUnit *paramUnit, const char *paramName, const char *fieldName, unsigned int *val); |
| 520 | |
| 521 | /* Param API */ |
| 522 | EXPORT size_t paramGetArraySizeFromString(const char *str); |
| 523 | EXPORT APP_STATUS paramGetFieldVal(Param *param, FieldInfo *fieldInfo, unsigned int *val); |
| 524 | EXPORT APP_STATUS paramSetFieldVal(Param *param, FieldInfo *fieldInfo, unsigned int val); |
| 525 | EXPORT DATA_TYPE paramDataTypeToEnum(const char *dataType); |
| 526 | EXPORT const char *paramDataTypeToStr(DATA_TYPE dataType); |
| 527 | |
| 528 | /* Field API */ |
| 529 | EXPORT APP_STATUS fieldInfoGetCheckListValue(FieldInfo *fieldInfo, const char *checkName, unsigned int *checkVal); |
| 530 | |
| 531 | /* TreeRoot API */ |
| 532 | EXPORT Feature *treeRootGetFeatureByName(TreeRoot *treeRoot, const char *featureName); |
| 533 | EXPORT int featureIsCategoryPathSupport(Feature *feature, const char *categoryPath); |
| 534 | |
| 535 | /* Xml Node related APIs */ |
| 536 | EXPORT xmlNode *findXmlNodeByElemName(xmlNode *node, const char *elemName); |
| 537 | EXPORT xmlChar *xmlNodeGetProp(xmlNode *node, const char *prop); |
| 538 | EXPORT xmlChar *xmlNodeGetWording(xmlNode *node); |
| 539 | |
| 540 | /* Utils APIs */ |
| 541 | EXPORT APP_STATUS utilConvDataStringToNative(DATA_TYPE dataType, const char *paramDataStr, void **paramData, size_t *arraySize); |
| 542 | |
| 543 | /* Unit test */ |
| 544 | EXPORT APP_STATUS unitTest(AppHandle *appHandle); |
| 545 | EXPORT char *utilGetStdin(char *buf, int bufSize); |
| 546 | |
| 547 | /* Following APIs is designed for EM tool integration */ |
| 548 | EXPORT APP_STATUS utilNativeSetField(const char *audioTypeName, const char *categoryPath, const char *paramName, const char *fieldName, const char *fieldValueStr); |
| 549 | EXPORT APP_STATUS utilNativeSetParam(const char *audioTypeName, const char *categoryPath, const char *paramName, const char *paramDataStr); |
| 550 | EXPORT char *utilNativeGetCategory(const char *audioTypeName, const char *categoryTypeName); |
| 551 | EXPORT char *utilNativeGetParam(const char *audioTypeName, const char *categoryPath, const char *paramName); |
| 552 | EXPORT unsigned int utilNativeGetField(const char *audioTypeName, const char *categoryPath, const char *paramName, const char *fieldName); |
| 553 | EXPORT APP_STATUS utilNativeSaveXml(const char *audioTypeName); |
| 554 | EXPORT char *utilNativeGetChecklist(const char *audioTypeName, const char *paramName, const char *fieldName); |
| 555 | |
| 556 | #ifndef WIN32 |
| 557 | #ifdef __cplusplus |
| 558 | } |
| 559 | #endif |
| 560 | #endif |
| 561 | |
| 562 | #endif |