FrontPanel API 5.3.6
|
Allows to iterate over and open all devices available in the given realm. More...
Public Member Functions | |
FrontPanelDevices (const std::string &realm=std::string()) | |
Enumerates all the devices available in the given realm. | |
int | GetCount () const |
Returns the number of available devices, possibly 0. | |
std::string | GetSerial (int num) const |
FrontPanelPtr | Open (const std::string &serial=std::string()) const |
~FrontPanelDevices () | |
The devices are identified by their index, which ranges from 0 to GetCount(). Each device has its own unique serial number returned by GetSerial() which can be used to pass it to Open(), but in the simplest case it is enough to just call Open() without any arguments to open the first connected device:
Generally speaking, there can be more than one connected device in which case you need to call GetCount() to determine the device number, then call GetSerial() for each of them in a loop, select the serial number of the device you want to open (e.g. by asking the user to select one of the serial numbers) and, finally, pass it to Open().
Note that, unlike FrontPanelManager, this class doesn't provide notifications for the devices being connected or disconnected, however, because of this, it is also simpler to use and doesn't require using a message loop or a separate thread.
|
explicit |
Currently supported realms are "local", corresponding to the devices connected to the machine running the program itself, or any URI of the form "fpoip://username:password@hostname[:port]" to operate with the remote devices on the specified host, running FPOIP server.
If connecting to the remote server fails, an std::runtime_error
exception is thrown.
realm | The realm of the devices represented by this object. By default, i.e. if the value of this argument is an empty string, the realm specified by the okFP_REALM environment variable is used or, if this variable is not defined, the "local" realm. |
OpalKelly::FrontPanelDevices::~FrontPanelDevices | ( | ) |
Destructor doesn't do anything special, in particular any devices returned by Open() can still be used even after this object itself is destroyed.
std::string OpalKelly::FrontPanelDevices::GetSerial | ( | int | num | ) | const |
Returns the serial number of the given device, possibly empty if the index is invalid.
FrontPanelPtr OpalKelly::FrontPanelDevices::Open | ( | const std::string & | serial = std::string() | ) | const |
Opens the device with the given serial number, first one by default. Returns an empty pointer if there is no such device (or no devices at all if the serial is empty).