diff --git a/dmtree/tr104/servicesvoiceservicecapabilities.c b/dmtree/tr104/servicesvoiceservicecapabilities.c index 057ca6e8..468d129f 100644 --- a/dmtree/tr104/servicesvoiceservicecapabilities.c +++ b/dmtree/tr104/servicesvoiceservicecapabilities.c @@ -11,6 +11,15 @@ #include "servicesvoiceservicecapabilities.h" #include "common.h" +/************************************************************************** +* LINKER +***************************************************************************/ +static int get_voice_service_capabilities_codec_linker(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker) +{ + *linker = data ? dmstrdup(((struct codec_info *)data)->codec) : ""; + return 0; +} + /************************************************************* * ENTRY METHOD **************************************************************/ @@ -171,7 +180,7 @@ DMOBJ tServicesVoiceServiceCapabilitiesObj[] = { /* OBJ, permission, addobj, delobj, checkdep, browseinstobj nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/ {"SIP", &DMREAD, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesSIPObj, NULL, NULL, BBFDM_BOTH}, {"POTS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tServicesVoiceServiceCapabilitiesPOTSParams, NULL, BBFDM_BOTH}, -{"Codec", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCapabilitiesCodecInst, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "Codec", "BitRate", NULL}}, +{"Codec", &DMREAD, NULL, NULL, NULL, browseServicesVoiceServiceCapabilitiesCodecInst, NULL, NULL, tServicesVoiceServiceCapabilitiesCodecParams, get_voice_service_capabilities_codec_linker, BBFDM_BOTH, LIST_KEY{"Alias", "Codec", "BitRate", NULL}}, {0} }; diff --git a/dmtree/tr104/servicesvoiceservicecodecprofile.c b/dmtree/tr104/servicesvoiceservicecodecprofile.c index acc0321c..2b75c7ca 100644 --- a/dmtree/tr104/servicesvoiceservicecodecprofile.c +++ b/dmtree/tr104/servicesvoiceservicecodecprofile.c @@ -8,6 +8,7 @@ * Author: Yalu Zhang, yalu.zhang@iopsys.eu */ +#include "dmentry.h" #include "servicesvoiceservicecodecprofile.h" #include "common.h" @@ -17,32 +18,12 @@ /*#Device.Services.VoiceService.{i}.CodecProfile.{i}.Codec!UCI:asterisk/codec_profile,@i-1/name*/ static int get_ServicesVoiceServiceCodecProfile_Codec(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "name", value); - return 0; -} + char *linker; -static int set_ServicesVoiceServiceCodecProfile_Codec(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) -{ - int i; - const char *uci_name; - - switch (action) { - case VALUECHECK: - for (i = 0; i < codecs_num; i++) { - if (strcmp(supported_codecs[i].codec, value) == 0) - return 0; - } - TR104_DEBUG("Wrong codec: [%s]\n", value); - return FAULT_9007; - case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "name", value); - // The UCI section name must be changed accordingly. Otherwise it can not be referenced correctly - uci_name = get_codec_uci_name(value); - if (uci_name) { - dmuci_rename_section_by_section((struct uci_section *)data, (char *)uci_name); - } - break; - } + dmuci_get_value_by_section_string((struct uci_section *)data, "name", &linker); + adm_entry_get_linker_param(ctx, "Device.Services.VoiceService.", linker, value); + if (*value == NULL) + *value = ""; return 0; } @@ -73,7 +54,7 @@ static int set_ServicesVoiceServiceCodecProfile_PacketizationPeriod(char *refpar /* *** Device.Services.VoiceService.{i}.CodecProfile.{i}. *** */ DMLEAF tServicesVoiceServiceCodecProfileParams[] = { /* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/ -{"Codec", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCodecProfile_Codec, set_ServicesVoiceServiceCodecProfile_Codec, BBFDM_BOTH}, +{"Codec", &DMREAD, DMT_STRING, get_ServicesVoiceServiceCodecProfile_Codec, NULL, BBFDM_BOTH}, {"PacketizationPeriod", &DMWRITE, DMT_STRING, get_ServicesVoiceServiceCodecProfile_PacketizationPeriod, set_ServicesVoiceServiceCodecProfile_PacketizationPeriod, BBFDM_BOTH}, {0} };