Skip to content
Snippets Groups Projects
Commit 26e407a2 authored by Suvendhu Hansa's avatar Suvendhu Hansa :speech_balloon:
Browse files

Initial code for Device.GatewayInfo.

parent 5040956b
Branches
No related tags found
1 merge request!1Initial code for Device.GatewayInfo.
/src/*.so
/src/*.o
/*.xml
/*.log
/result
*.swp
*.swo
*.gcda
*.gcno
*.gcov
*.o
*.so
*.tar
docs/index.md
LIBGWINFO = libgwinfo.so
LIBGWOBJS = gatewayinfo.o
LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC
%.o: %.c
$(CC) $(LIB_CFLAGS) -c -o $@ $<
all: $(LIBGWINFO)
$(LIBGWINFO): $(LIBGWOBJS)
$(CC) -shared -o $@ $^ $(LDFLAGS)
clean:
rm -rf *.o $(LIBGWINFO)
/*
* Copyright (C) 2025 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
*/
#include "libbbfdm-api/legacy/dmcommon.h"
static int get_manufacturer_oui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string_varstate("gwinfo", "gatewayinfo", "oui", value);
if (*value[0] == '\0') {
db_get_value_string("device", "deviceinfo", "ManufacturerOUI", value);
}
return 0;
}
static int get_product_class(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string_varstate("gwinfo", "gatewayinfo", "class", value);
if (*value[0] == '\0') {
db_get_value_string("device", "deviceinfo", "ProductClass", value);
}
return 0;
}
static int get_serial_number(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string_varstate("gwinfo", "gatewayinfo", "serial", value);
if (*value[0] == '\0') {
db_get_value_string("device", "deviceinfo", "SerialNumber", value);
}
return 0;
}
static int get_gateway_proto(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string_varstate("gwinfo", "gatewayinfo", "proto", value);
return 0;
}
static int get_endpoint_id(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string_varstate("gwinfo", "gatewayinfo", "endpoint", value);
return 0;
}
static int get_mac_address(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_option_value_string_varstate("gwinfo", "gatewayinfo", "hwaddr", value);
return 0;
}
/**********************************************************************************************************************************
* OBJ & PARAM DEFINITION
***********************************************************************************************************************************/
/* *** Device.GatewayInfo. *** */
DMLEAF tGatewayInfoParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
{"ManufacturerOUI", &DMREAD, DMT_STRING, get_manufacturer_oui, NULL, BBFDM_BOTH},
{"ProductClass", &DMREAD, DMT_STRING, get_product_class, NULL, BBFDM_BOTH},
{"SerialNumber", &DMREAD, DMT_STRING, get_serial_number, NULL, BBFDM_BOTH},
{"ManagementProtocol", &DMREAD, DMT_STRING, get_gateway_proto, NULL, BBFDM_USP},
{"EndpointID", &DMREAD, DMT_STRING, get_endpoint_id, NULL, BBFDM_USP},
{"MACAddress", &DMREAD, DMT_STRING, get_mac_address, NULL, BBFDM_USP},
{0}
};
DMOBJ tDeviceObjs[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
{"GatewayInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tGatewayInfoParams, NULL, BBFDM_BOTH},
{0}
};
DM_MAP_OBJ tDynamicObj[] = {
/* parentobj, nextobject, parameter */
{"Device.", tDeviceObjs, NULL},
{0}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment