reformat WTP config file reader
This commit is contained in:
parent
2b489947c2
commit
d93cd1044d
401
src/wtp/wtp.c
401
src/wtp/wtp.c
@ -159,7 +159,7 @@ static void wtp_print_usage(void) {
|
|||||||
|
|
||||||
/* */
|
/* */
|
||||||
static int wtp_parsing_radio_configuration(config_setting_t* configElement, struct wtp_radio* radio) {
|
static int wtp_parsing_radio_configuration(config_setting_t* configElement, struct wtp_radio* radio) {
|
||||||
int i;
|
int i, len, cnt;
|
||||||
int configBool;
|
int configBool;
|
||||||
LIBCONFIG_LOOKUP_INT_ARG configInt;
|
LIBCONFIG_LOOKUP_INT_ARG configInt;
|
||||||
const char* configString;
|
const char* configString;
|
||||||
@ -168,227 +168,167 @@ static int wtp_parsing_radio_configuration(config_setting_t* configElement, stru
|
|||||||
|
|
||||||
/* Physical radio mode */
|
/* Physical radio mode */
|
||||||
radio->radioinformation.radioid = radio->radioid;
|
radio->radioinformation.radioid = radio->radioid;
|
||||||
if (config_setting_lookup_string(configElement, "mode", &configString) == CONFIG_TRUE) {
|
if (config_setting_lookup_string(configElement, "mode", &configString) != CONFIG_TRUE)
|
||||||
int length = strlen(configString);
|
return 0;
|
||||||
if (!length) {
|
|
||||||
|
len = strlen(configString);
|
||||||
|
if (!len)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
switch (configString[i]) {
|
||||||
|
case 'a':
|
||||||
|
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211A;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211B;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'g':
|
||||||
|
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211G;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'n':
|
||||||
|
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211N;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
|
||||||
switch (configString[i]) {
|
|
||||||
case 'a': {
|
|
||||||
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211A;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'b': {
|
|
||||||
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211B;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'g': {
|
|
||||||
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211G;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'n': {
|
|
||||||
radio->radioinformation.radiotype |= CAPWAP_RADIO_TYPE_80211N;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Antenna */
|
/* Antenna */
|
||||||
configSection = config_setting_get_member(configElement, "antenna");
|
configSection = config_setting_get_member(configElement, "antenna");
|
||||||
if (configSection) {
|
if (!configSection)
|
||||||
radio->antenna.radioid = radio->radioid;
|
return 0;
|
||||||
|
|
||||||
if (config_setting_lookup_bool(configSection, "diversity", &configBool) == CONFIG_TRUE) {
|
radio->antenna.radioid = radio->radioid;
|
||||||
radio->antenna.diversity = (configBool ? CAPWAP_ANTENNA_DIVERSITY_ENABLE : CAPWAP_ANTENNA_DIVERSITY_DISABLE);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config_setting_lookup_string(configSection, "combiner", &configString) == CONFIG_TRUE) {
|
if (config_setting_lookup_bool(configSection, "diversity", &configBool) != CONFIG_TRUE)
|
||||||
if (!strcmp(configString, "left")) {
|
return 0;
|
||||||
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_LEFT;
|
radio->antenna.diversity = (configBool ? CAPWAP_ANTENNA_DIVERSITY_ENABLE : CAPWAP_ANTENNA_DIVERSITY_DISABLE);
|
||||||
} else if (!strcmp(configString, "right")) {
|
|
||||||
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_RIGHT;
|
|
||||||
} else if (!strcmp(configString, "omni")) {
|
|
||||||
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_OMNI;
|
|
||||||
} else if (!strcmp(configString, "mimo")) {
|
|
||||||
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_MIMO;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
configItems = config_setting_get_member(configSection, "selection");
|
if (config_setting_lookup_string(configSection, "combiner", &configString) != CONFIG_TRUE)
|
||||||
if (configItems != NULL) {
|
return 0;
|
||||||
int count = config_setting_length(configItems);
|
if (!strcmp(configString, "left")) {
|
||||||
if ((count > 0) && (count <= CAPWAP_ANTENNASELECTIONS_MAXLENGTH)) {
|
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_LEFT;
|
||||||
for (i = 0; i < count; i++) {
|
} else if (!strcmp(configString, "right")) {
|
||||||
uint8_t* selection = (uint8_t*)capwap_array_get_item_pointer(radio->antenna.selections, i);
|
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_RIGHT;
|
||||||
|
} else if (!strcmp(configString, "omni")) {
|
||||||
configString = config_setting_get_string_elem(configItems, i);
|
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_OMNI;
|
||||||
if (!strcmp(configString, "internal")) {
|
} else if (!strcmp(configString, "mimo")) {
|
||||||
*selection = CAPWAP_ANTENNA_INTERNAL;
|
radio->antenna.combiner = CAPWAP_ANTENNA_COMBINER_SECT_MIMO;
|
||||||
} else if (!strcmp(configString, "external")) {
|
|
||||||
*selection = CAPWAP_ANTENNA_EXTERNAL;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configItems = config_setting_get_member(configSection, "selection");
|
||||||
|
if (!configItems)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
cnt = config_setting_length(configItems);
|
||||||
|
if (cnt == 0 || cnt > CAPWAP_ANTENNASELECTIONS_MAXLENGTH)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < cnt; i++) {
|
||||||
|
uint8_t* selection = (uint8_t*)capwap_array_get_item_pointer(radio->antenna.selections, i);
|
||||||
|
|
||||||
|
configString = config_setting_get_string_elem(configItems, i);
|
||||||
|
if (!strcmp(configString, "internal")) {
|
||||||
|
*selection = CAPWAP_ANTENNA_INTERNAL;
|
||||||
|
} else if (!strcmp(configString, "external")) {
|
||||||
|
*selection = CAPWAP_ANTENNA_EXTERNAL;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Multi-Domain Capability */
|
/* Multi-Domain Capability */
|
||||||
configSection = config_setting_get_member(configElement, "multidomaincapability");
|
configSection = config_setting_get_member(configElement, "multidomaincapability");
|
||||||
if (configSection) {
|
if (configSection) {
|
||||||
radio->multidomaincapability.radioid = radio->radioid;
|
radio->multidomaincapability.radioid = radio->radioid;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configSection, "firstchannel", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configSection, "firstchannel", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 0) && (configInt < 65536)) {
|
configInt == 0 || configInt > 65535)
|
||||||
radio->multidomaincapability.firstchannel = (uint16_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->multidomaincapability.firstchannel = (uint16_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configSection, "numberchannels", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configSection, "numberchannels", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 0) && (configInt < 65536)) {
|
configInt == 0 || configInt > 65535)
|
||||||
radio->multidomaincapability.numberchannels = (uint16_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->multidomaincapability.numberchannels = (uint16_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configSection, "maxtxpower", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configSection, "maxtxpower", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt >= 0) && (configInt < 65536)) {
|
configInt == 0 || configInt > 65535)
|
||||||
radio->multidomaincapability.maxtxpowerlevel = (uint16_t)configInt;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->multidomaincapability.maxtxpowerlevel = (uint16_t)configInt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MAC Operation */
|
/* MAC Operation */
|
||||||
radio->macoperation.radioid = radio->radioid;
|
radio->macoperation.radioid = radio->radioid;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "rtsthreshold", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "rtsthreshold", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 0) && (configInt <= 2347)) {
|
configInt == 0 || configInt > 2347)
|
||||||
radio->macoperation.rtsthreshold = (uint16_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->macoperation.rtsthreshold = (uint16_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "shortretry", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "shortretry", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 1) && (configInt < 256)) {
|
configInt < 2 || configInt > 255)
|
||||||
radio->macoperation.shortretry = (uint8_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->macoperation.shortretry = (uint8_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "longretry", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "longretry", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 1) && (configInt < 256)) {
|
configInt < 2 || configInt > 255)
|
||||||
radio->macoperation.longretry = (uint8_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->macoperation.longretry = (uint8_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "fragmentationthreshold", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "fragmentationthreshold", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt >= 256) && (configInt <= 2346)) {
|
configInt < 256 || configInt > 2346)
|
||||||
radio->macoperation.fragthreshold = (uint16_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->macoperation.fragthreshold = (uint16_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "txmsdulifetime", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "txmsdulifetime", &configInt) != CONFIG_TRUE ||
|
||||||
if (configInt > 0) {
|
configInt == 0)
|
||||||
radio->macoperation.txmsdulifetime = (uint32_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->macoperation.txmsdulifetime = (uint32_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "rxmsdulifetime", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "rxmsdulifetime", &configInt) != CONFIG_TRUE ||
|
||||||
if (configInt > 0) {
|
configInt == 0)
|
||||||
radio->macoperation.rxmsdulifetime = (uint32_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->macoperation.rxmsdulifetime = (uint32_t)configInt;
|
||||||
|
|
||||||
/* Supported rate */
|
/* Supported rate */
|
||||||
radio->supportedrates.radioid = radio->radioid;
|
radio->supportedrates.radioid = radio->radioid;
|
||||||
|
|
||||||
configItems = config_setting_get_member(configElement, "supportedrates");
|
configItems = config_setting_get_member(configElement, "supportedrates");
|
||||||
if (configItems != NULL) {
|
if (!configItems)
|
||||||
int count = config_setting_length(configItems);
|
return 0;
|
||||||
if ((count >= CAPWAP_SUPPORTEDRATES_MINLENGTH) && (count <= CAPWAP_SUPPORTEDRATES_MAXLENGTH)) {
|
|
||||||
radio->supportedrates.supportedratescount = (uint8_t)count;
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
config_setting_t *elem;
|
|
||||||
int value;
|
|
||||||
|
|
||||||
elem = config_setting_get_elem(configItems, i);
|
cnt = config_setting_length(configItems);
|
||||||
switch (config_setting_type(elem)) {
|
if (cnt < CAPWAP_SUPPORTEDRATES_MINLENGTH ||
|
||||||
case CONFIG_TYPE_INT:
|
cnt > CAPWAP_SUPPORTEDRATES_MAXLENGTH)
|
||||||
value = config_setting_get_int(elem) * 2;
|
return 0;
|
||||||
break;
|
|
||||||
case CONFIG_TYPE_FLOAT:
|
radio->supportedrates.supportedratescount = (uint8_t)cnt;
|
||||||
value = config_setting_get_float(elem) * 2;
|
for (i = 0; i < cnt; i++) {
|
||||||
break;
|
config_setting_t *elem;
|
||||||
default:
|
int value;
|
||||||
return 0;
|
|
||||||
}
|
elem = config_setting_get_elem(configItems, i);
|
||||||
if ((value >= 2) && (value <= 127)) {
|
switch (config_setting_type(elem)) {
|
||||||
radio->supportedrates.supportedrates[i] = (uint8_t)value;
|
case CONFIG_TYPE_INT:
|
||||||
} else {
|
value = config_setting_get_int(elem) * 2;
|
||||||
return 0;
|
break;
|
||||||
}
|
case CONFIG_TYPE_FLOAT:
|
||||||
}
|
value = config_setting_get_float(elem) * 2;
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
if (value < 2 || value > 127)
|
||||||
return 0;
|
return 0;
|
||||||
|
radio->supportedrates.supportedrates[i] = (uint8_t)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TX Power */
|
/* TX Power */
|
||||||
@ -396,33 +336,25 @@ static int wtp_parsing_radio_configuration(config_setting_t* configElement, stru
|
|||||||
if (configSection) {
|
if (configSection) {
|
||||||
radio->txpower.radioid = radio->radioid;
|
radio->txpower.radioid = radio->radioid;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configSection, "current", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configSection, "current", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt >= 0) && (configInt <= 10000)) {
|
configInt == 0 || configInt > 10000)
|
||||||
radio->txpower.currenttxpower = (uint16_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->txpower.currenttxpower = (uint16_t)configInt;
|
||||||
|
|
||||||
configItems = config_setting_get_member(configSection, "supported");
|
configItems = config_setting_get_member(configSection, "supported");
|
||||||
if (configItems != NULL) {
|
if (configItems != NULL) {
|
||||||
int count = config_setting_length(configItems);
|
cnt = config_setting_length(configItems);
|
||||||
if ((count > 0) && (count <= CAPWAP_TXPOWERLEVEL_MAXLENGTH)) {
|
if (cnt == 0 || cnt > CAPWAP_TXPOWERLEVEL_MAXLENGTH)
|
||||||
radio->txpowerlevel.radioid = radio->radioid;
|
|
||||||
radio->txpowerlevel.numlevels = (uint8_t)count;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
int value = config_setting_get_int_elem(configItems, i);
|
|
||||||
if ((configInt >= 0) && (configInt <= 10000)) {
|
|
||||||
radio->txpowerlevel.powerlevel[i] = (uint8_t)value;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
radio->txpowerlevel.radioid = radio->radioid;
|
||||||
|
radio->txpowerlevel.numlevels = (uint8_t)cnt;
|
||||||
|
|
||||||
|
for (i = 0; i < cnt; i++) {
|
||||||
|
int value = config_setting_get_int_elem(configItems, i);
|
||||||
|
if (value < 0 || value > 10000)
|
||||||
|
return 0;
|
||||||
|
radio->txpowerlevel.powerlevel[i] = (uint8_t)value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,68 +362,41 @@ static int wtp_parsing_radio_configuration(config_setting_t* configElement, stru
|
|||||||
/* WTP Radio Configuration */
|
/* WTP Radio Configuration */
|
||||||
radio->radioconfig.radioid = radio->radioid;
|
radio->radioconfig.radioid = radio->radioid;
|
||||||
|
|
||||||
if (config_setting_lookup_bool(configElement, "shortpreamble", &configBool) == CONFIG_TRUE) {
|
if (config_setting_lookup_bool(configElement, "shortpreamble", &configBool) != CONFIG_TRUE)
|
||||||
radio->radioconfig.shortpreamble = (configBool ? CAPWAP_WTP_RADIO_CONF_SHORTPREAMBLE_ENABLE : CAPWAP_WTP_RADIO_CONF_SHORTPREAMBLE_DISABLE);
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->radioconfig.shortpreamble = (configBool ? CAPWAP_WTP_RADIO_CONF_SHORTPREAMBLE_ENABLE : CAPWAP_WTP_RADIO_CONF_SHORTPREAMBLE_DISABLE);
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "maxbssid", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "maxbssid", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 0) && (configInt <= 16)) {
|
configInt == 0 || configInt > 16)
|
||||||
radio->radioconfig.maxbssid = (uint8_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->radioconfig.maxbssid = (uint8_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_string(configElement, "bssprefixname", &configString) == CONFIG_TRUE) {
|
if (config_setting_lookup_string(configElement, "bssprefixname", &configString) != CONFIG_TRUE ||
|
||||||
if (strlen(configString) < IFNAMSIZ) {
|
strlen(configString) >= IFNAMSIZ)
|
||||||
strcpy(radio->wlanprefix, configString);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
strcpy(radio->wlanprefix, configString);
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "dtimperiod", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "dtimperiod", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 0) && (configInt < 256)) {
|
configInt == 0 || configInt > 256)
|
||||||
radio->radioconfig.dtimperiod = (uint8_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->radioconfig.dtimperiod = (uint8_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_int(configElement, "beaconperiod", &configInt) == CONFIG_TRUE) {
|
if (config_setting_lookup_int(configElement, "beaconperiod", &configInt) != CONFIG_TRUE ||
|
||||||
if ((configInt > 0) && (configInt < 65536)) {
|
configInt == 0 ||configInt > 65535)
|
||||||
radio->radioconfig.beaconperiod = (uint16_t)configInt;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
radio->radioconfig.beaconperiod = (uint16_t)configInt;
|
||||||
|
|
||||||
if (config_setting_lookup_string(configElement, "country", &configString) == CONFIG_TRUE) {
|
if (config_setting_lookup_string(configElement, "country", &configString) != CONFIG_TRUE ||
|
||||||
if (strlen(configString) == 2) {
|
strlen(configString) != 2)
|
||||||
radio->radioconfig.country[0] = (uint8_t)configString[0];
|
|
||||||
radio->radioconfig.country[1] = (uint8_t)configString[1];
|
|
||||||
|
|
||||||
if (config_setting_lookup_bool(configElement, "shortpreamble", &configBool) == CONFIG_TRUE) {
|
|
||||||
radio->radioconfig.country[2] = (uint8_t)(configBool ? 'O' : 'I');
|
|
||||||
} else {
|
|
||||||
radio->radioconfig.country[2] = (uint8_t)' ';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
radio->radioconfig.country[0] = (uint8_t)configString[0];
|
||||||
|
radio->radioconfig.country[1] = (uint8_t)configString[1];
|
||||||
|
|
||||||
|
if (config_setting_lookup_bool(configElement, "shortpreamble", &configBool) == CONFIG_TRUE)
|
||||||
|
radio->radioconfig.country[2] = (uint8_t)(configBool ? 'O' : 'I');
|
||||||
|
else
|
||||||
|
radio->radioconfig.country[2] = (uint8_t)' ';
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user