lime: add lo_locked sensor read

master
Andre Puschmann 7 years ago
parent aa6699e25f
commit 9be16097bf

@ -97,7 +97,11 @@ char* rf_soapy_devname(void* h)
bool rf_soapy_rx_wait_lo_locked(void *h) bool rf_soapy_rx_wait_lo_locked(void *h)
{ {
printf("TODO: implement rf_soapy_rx_wait_lo_locked()\n"); rf_soapy_handler_t *handler = (rf_soapy_handler_t*)h;
char *ret = SoapySDRDevice_readChannelSensor(handler->device, SOAPY_SDR_RX, 0, "lo_locked");
if (ret != NULL) {
return (strcmp(ret, "true") == 0 ? true : false);
}
return true; return true;
} }
@ -212,7 +216,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
SoapySDRDevice *sdr = SoapySDRDevice_make(&(soapy_args[0])); SoapySDRDevice *sdr = SoapySDRDevice_make(&(soapy_args[0]));
if (sdr == NULL) { if (sdr == NULL) {
printf("failed to create SOAPY object\n"); printf("Failed to create Soapy object\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
@ -225,7 +229,7 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
handler->rx_stream_active = false; handler->rx_stream_active = false;
handler->devname = devname; handler->devname = devname;
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){ if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_RX) > 0){
printf("setting up RX stream\n"); printf("Setting up RX stream\n");
if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) { if(SoapySDRDevice_setupStream(handler->device, &(handler->rxStream), SOAPY_SDR_RX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError()); printf("Rx setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR; return SRSLTE_ERROR;
@ -233,19 +237,27 @@ int rf_soapy_open_multi(char *args, void **h, uint32_t nof_rx_antennas)
} }
if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_TX) > 0){ if(SoapySDRDevice_getNumChannels(handler->device,SOAPY_SDR_TX) > 0){
printf("setting up TX stream\n"); printf("Setting up TX stream\n");
if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) { if (SoapySDRDevice_setupStream(handler->device, &(handler->txStream), SOAPY_SDR_TX, SOAPY_SDR_CF32, NULL, 0, NULL) != 0) {
printf("Tx setupStream fail: %s\n", SoapySDRDevice_lastError()); printf("Tx setupStream fail: %s\n", SoapySDRDevice_lastError());
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
} }
// list device sensors
size_t sensor_length; size_t sensor_length;
char** sensors; char** sensors;
sensors = SoapySDRDevice_listSensors(handler->device, &sensor_length); sensors = SoapySDRDevice_listSensors(handler->device, &sensor_length);
for(int i = 0; i < sensor_length;i++) printf("Available device sensors: \n");
{ for(int i = 0; i < sensor_length; i++) {
printf("available sensors are : \n"); printf(" - %s\n", sensors[i]);
puts(sensors[i]); }
// list channel sensors
sensors = SoapySDRDevice_listChannelSensors(handler->device, SOAPY_SDR_RX, 0, &sensor_length);
printf("Available sensors for RX channel 0: \n");
for(int i = 0; i < sensor_length; i++) {
printf(" - %s\n", sensors[i]);
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;

Loading…
Cancel
Save