device_handler Class Reference

`#include <device_handler.h>`

## Public Member Functions

| ~device_handler ()
void | error (int device_number)
lms_device_t * | get_device (int device_number)
int | open_device (std::string &serial)
void | close_device (int device_number, int block_type)
void | close_all_devices ()
void | check_blocks (int device_number, int block_type, int channel_mode, const std::string &filename)
void | settings_from_file (int device_number, const std::string &filename, int *antenna_tx)
void | enable_channels (int device_number, int channel_mode, bool direction)
void | set_samp_rate (int device_number, double &rate)
void | set_oversampling (int device_number, int oversample)
double | set_rf_freq (int device_number, bool direction, int channel, float rf_freq)
void | calibrate (int device_number, int direction, int channel, double bandwidth)
void | set_antenna (int device_number, int channel, int direction, int antenna)
double | set_analog_filter (int device_number, bool direction, int channel, double analog_bandw)
double | set_digital_filter (int device_number, bool direction, int channel, double digital_bandw)
unsigned | set_gain (int device_number, bool direction, int channel, unsigned gain_dB)
void | set_nco (int device_number, bool direction, int channel, float nco_freq)
void | disable_DC_corrections (int device_number)
void | set_tcxo_dac (int device_number, uint16_t dacVal)

## Static Public Member Functions

static device_handler & | getInstance ()

## Public Attributes

std::recursive_mutex | block_mutex

## Constructor & Destructor Documentation

## ~device_handler()

device_handler::~device_handler | ( |  | ) |

## Member Function Documentation

## calibrate()

void device_handler::calibrate | ( | int | device_number,
|  | int | direction,
|  | int | channel,
|  | double | bandwidth
| ) |  |

Perform device calibration.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  direction | Direction of samples: RX(LMS_CH_RX),TX(LMS_CH_RX).
  channel | Channel selection: A(LMS_CH_0),B(LMS_CH_1).
  bandwidth | Set calibration bandwidth in Hz.

## check_blocks()

void device_handler::check_blocks | ( | int | device_number,
|  | int | block_type,
|  | int | channel_mode,
|  | const std::string & | filename
| ) |  |

Check what blocks are used for single device.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  block_type | Source block(1), Sink block(2).
  channel_mode | Channel A(0), Channel B(1), MIMO(2)
  filename | Path to file if file switch is turned on.

## close_all_devices()

void device_handler::close_all_devices | ( |  | ) |

Disconnect from all devices.

## close_device()

void device_handler::close_device | ( | int | device_number,
|  | int | block_type
| ) |  |

Disconnect from the device.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  block_type | Source block(1), Sink block(2).

## disable_DC_corrections()

void device_handler::disable_DC_corrections | ( | int | device_number | ) |

## enable_channels()

void device_handler::enable_channels | ( | int | device_number,
|  | int | channel_mode,
|  | bool | direction
| ) |  |

Set used channels

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  channel_mode | Channel A(0), Channel B(1), MIMO(2)
  direction | Direction of samples RX(LMS_CH_RX), TX(LMS_CH_RX).

## error()

void device_handler::error | ( | int | device_number | ) |

Print device error and close all devices.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.

## get_device()

lms_device_t * device_handler::get_device | ( | int | device_number | ) |

Get device connection handler in order to configure it.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.

## getInstance()

static device_handler & device_handler::getInstance | ( |  | ) |

inline static

## open_device()

int device_handler::open_device | ( | std::string & | serial | ) |

Connect to the device and create singletone.

Parameters

  serial | Device serial from the list of LMS_GetDeviceList.

## set_analog_filter()

double device_handler::set_analog_filter | ( | int | device_number,
|  | bool | direction,
|  | int | channel,
|  | double | analog_bandw
| ) |  |

Set analog filters.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  direction | Direction of samples: RX(LMS_CH_RX),TX(LMS_CH_TX).
  channel | Channel selection: A(LMS_CH_0),B(LMS_CH_1).
  analog_bandw | Channel filter bandwidth in Hz.

## set_antenna()

void device_handler::set_antenna | ( | int | device_number,
|  | int | channel,
|  | int | direction,
|  | int | antenna
| ) |  |

Set which antenna is used

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  channel | Channel selection: A(LMS_CH_0),B(LMS_CH_1).
  direction | Direction of samples: RX(LMS_CH_RX),TX(LMS_CH_RX).
  antenna | Antenna to set: None(0), LNAH(1), LNAL(2), LNAW(3) for RX None(0), BAND1(1), BAND(2), NONE(3) for TX

## set_digital_filter()

double device_handler::set_digital_filter | ( | int | device_number,
|  | bool | direction,
|  | int | channel,
|  | double | digital_bandw
| ) |  |

Set digital filters (GFIR).

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  direction | Direction of samples: RX(LMS_CH_RX),TX(LMS_CH_TX).
  channel | Channel selection: A(LMS_CH_0),B(LMS_CH_1).
  digital_bandw | Channel filter bandwidth in Hz.

## set_gain()

unsigned device_handler::set_gain | ( | int | device_number,
|  | bool | direction,
|  | int | channel,
|  | unsigned | gain_dB
| ) |  |

Set the combined gain value in dB This function computes and sets the optimal gain values of various amplifiers that are present in the device based on desired gain value in dB.

Note
  actual gain depends on LO frequency and analog LPF configuration and resulting output signal level may be different when those values are changed

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  direction | Select RX or TX.
  channel | Channel selection: A(LMS_CH_0),B(LMS_CH_1).
  gain_dB | Desired gain: [0,70] RX, [0,60] TX.

## set_nco()

void device_handler::set_nco | ( | int | device_number,
|  | bool | direction,
|  | int | channel,
|  | float | nco_freq
| ) |  |

Set NCO (numerically controlled oscillator). By selecting NCO frequency configure NCO. When NCO frequency is 0, NCO is off.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  direction | Select RX or TX.
  channel | Channel index.
  nco_freq | NCO frequency in Hz.

## set_oversampling()

void device_handler::set_oversampling | ( | int | device_number,
|  | int | oversample
| ) |  |

Set oversampling value for both channels

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  oversample | Oversampling value (0 (default),1,2,4,8,16,32).

## set_rf_freq()

double device_handler::set_rf_freq | ( | int | device_number,
|  | bool | direction,
|  | int | channel,
|  | float | rf_freq
| ) |  |

Set RF frequency of both channels (RX and TX separately).

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  direction | Direction of samples RX(LMS_CH_RX), TX(LMS_CH_TX).
  channel | selection: A(LMS_CH_0),B(LMS_CH_1).
  rf_freq | RF frequency in Hz.

Returns
  returns RF frequency in Hz

## set_samp_rate()

void device_handler::set_samp_rate | ( | int | device_number,
|  | double & | rate
| ) |  |

Set the same sample rate for both channels.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  rate | Sample rate in S/s.

## set_tcxo_dac()

void device_handler::set_tcxo_dac | ( | int | device_number,
|  | uint16_t | dacVal
| ) |  |

Set TCXO DAC.

Note
  Care must be taken as this parameter is returned to default value only after power off.
  LimeSDR-Mini default value is 180 range is [0,255] LimeSDR-USB default value is 125 range is [0,255] LimeSDR-PCIe default value is 134 range is [0,255] LimeNET-Micro default value is 30714 range is [0,65535]

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  dacVal | DAC value (0-65535)

## settings_from_file()

void device_handler::settings_from_file | ( | int | device_number,
|  | const std::string & | filename,
|  | int * | antenna_tx
| ) |  |

Load settings from .ini file.

Parameters

  device_number | Device number from the list of LMS_GetDeviceList.
  filename | Path to file if file switch is turned on.
  antenna_tx | Pointer to TX antenna, so PA path would be updated in sink block

## Member Data Documentation

## block_mutex

std::recursive_mutex device_handler::block_mutex

mutable

The documentation for this class was generated from the following file:

- device_handler.h