fix parsing of zmq arguments

Use the return value of parse_string function to determine whether a parameter was found.
I experienced issues when the rx_type was set, but the rx_format was not. This led to "Unsupported sample format pub" as the tmp variable is still set to the value of the rx_type.
master
Fabian Eckermann 5 years ago committed by Andre Puschmann
parent 847366bcdb
commit 447b989aad

@ -240,8 +240,7 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
// rx_type // rx_type
char tmp[RF_PARAM_LEN] = {0}; char tmp[RF_PARAM_LEN] = {0};
parse_string(args, "rx_type", -1, tmp); if (parse_string(args, "rx_type", -1, tmp) == SRSLTE_SUCCESS) {
if (strlen(tmp) > 0) {
if (!strcmp(tmp, "sub")) { if (!strcmp(tmp, "sub")) {
rx_opts.socket_type = ZMQ_SUB; rx_opts.socket_type = ZMQ_SUB;
} else { } else {
@ -251,9 +250,8 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
} }
// rx_format // rx_format
parse_string(args, "rx_format", -1, tmp);
rx_opts.sample_format = ZMQ_TYPE_FC32; rx_opts.sample_format = ZMQ_TYPE_FC32;
if (strlen(tmp) > 0) { if (parse_string(args, "rx_format", -1, tmp) == SRSLTE_SUCCESS) {
if (!strcmp(tmp, "sc16")) { if (!strcmp(tmp, "sc16")) {
rx_opts.sample_format = ZMQ_TYPE_SC16; rx_opts.sample_format = ZMQ_TYPE_SC16;
} else { } else {
@ -263,8 +261,7 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
} }
// tx_type // tx_type
parse_string(args, "tx_type", -1, tmp); if (parse_string(args, "tx_type", -1, tmp) == SRSLTE_SUCCESS) {
if (strlen(tmp) > 0) {
if (!strcmp(tmp, "pub")) { if (!strcmp(tmp, "pub")) {
tx_opts.socket_type = ZMQ_PUB; tx_opts.socket_type = ZMQ_PUB;
} else { } else {
@ -274,9 +271,8 @@ int rf_zmq_open_multi(char* args, void** h, uint32_t nof_channels)
} }
// tx_format // tx_format
parse_string(args, "tx_format", -1, tmp);
tx_opts.sample_format = ZMQ_TYPE_FC32; tx_opts.sample_format = ZMQ_TYPE_FC32;
if (strlen(tmp) > 0) { if (parse_string(args, "tx_format", -1, tmp) == SRSLTE_SUCCESS) {
if (!strcmp(tmp, "sc16")) { if (!strcmp(tmp, "sc16")) {
tx_opts.sample_format = ZMQ_TYPE_SC16; tx_opts.sample_format = ZMQ_TYPE_SC16;
} else { } else {

Loading…
Cancel
Save