mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-04 21:07:43 +01:00
ATM,PTM: Add support for Enable parameter
This commit is contained in:
parent
9d3f12e527
commit
20d5f3bf82
3 changed files with 44 additions and 6 deletions
|
|
@ -203,21 +203,25 @@ static int get_atm_stats_pack_sent(char *refparam, struct dmctx *ctx, void *data
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.ATM.Link.{i}.Enable!UCI:dsl/atm-device,@i-1/enabled*/
|
||||
static int get_atm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "true";
|
||||
*value = dmuci_get_value_by_section_fallback_def(((struct atm_args *)data)->atm_sec, "enabled", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_atm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
bool b;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
//TODO
|
||||
string_to_bool(value, &b);
|
||||
dmuci_set_value_by_section(((struct atm_args *)data)->atm_sec, "enabled", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -100,21 +100,25 @@ static int get_ptm_stats_pack_sent(char *refparam, struct dmctx *ctx, void *data
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.PTM.Link.{i}.Enable!UCI:dsl/ptm-device,@i-1/enabled*/
|
||||
static int get_ptm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "true";
|
||||
*value = dmuci_get_value_by_section_fallback_def(((struct ptm_args *)data)->ptm_sec, "enabled", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ptm_enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
bool b;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
//TODO
|
||||
string_to_bool(value, &b);
|
||||
dmuci_set_value_by_section(((struct ptm_args *)data)->ptm_sec, "enabled", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -17361,7 +17361,22 @@
|
|||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean"
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "dsl",
|
||||
"section": {
|
||||
"type": "atm-device",
|
||||
"index": "@i-1"
|
||||
},
|
||||
"option": {
|
||||
"name": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Status": {
|
||||
"type": "string",
|
||||
|
|
@ -18235,7 +18250,22 @@
|
|||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"datatype": "boolean"
|
||||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "dsl",
|
||||
"section": {
|
||||
"type": "ptm-device",
|
||||
"index": "@i-1"
|
||||
},
|
||||
"option": {
|
||||
"name": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Status": {
|
||||
"type": "string",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue