From 00adaec949d230fb196a89f10e5bef471eb9e41d Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Wed, 30 Dec 2020 20:37:47 +0100 Subject: [PATCH] Device.DSL.Channel.{i}.Status: add the missing cases according to the standard --- dmtree/tr181/dsl.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dmtree/tr181/dsl.c b/dmtree/tr181/dsl.c index 09d281c1..e85ec601 100644 --- a/dmtree/tr181/dsl.c +++ b/dmtree/tr181/dsl.c @@ -906,7 +906,20 @@ static int set_DSLChannel_Enable(char *refparam, struct dmctx *ctx, void *data, static int get_DSLChannel_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *status = get_dsl_value_without_argument("dsl.channel", ((struct dsl_channel_args*)data)->id, "status", "status"); - *value = (strcmp(status, "up") == 0) ? "Up" : "Down"; + if (strcmp(status, "up") == 0) + *value = "Up"; + else if (strcmp(status, "down") == 0) + *value = "Down"; + else if (strcmp(status, "dormant") == 0) + *value = "Dormant"; + else if (strcmp(status, "not_present") == 0) + *value = "NotPresent"; + else if (strcmp(status, "lower_layer_down") == 0) + *value = "LowerLayerDown"; + else if (strcmp(status, "error") == 0) + *value = "Error"; + else + *value = "Unknown"; return 0; }