BAOS SDK
18.2.0
|
Finds all available IP BAOS devices on the network. More...
#include <BaosEnumerator.h>
Public Types | |
typedef BaosDevice | Device |
typedef BaosDevices | Devices |
Public Member Functions | |
BaosIpEnumerator (bool autoScan=true) | |
Creates a Baos Enumerator. More... | |
~BaosIpEnumerator () | |
Destroys the BaosEnumerator. More... | |
const Devices & | scan () |
Enumerates all network interfaces and for each available network interfaces searches for baos devices. More... | |
const Devices & | getDevices () const |
Returns the list of found devices. More... | |
const Device & | find (const std::string &name) const |
Finds device information for a BAOS device with a human-readable name that matches the specified name. More... | |
const Device & | findByAddress (const std::string &ipAddress) const |
Finds device information for a BAOS device that matches a specified IP Address. More... | |
const std::string & | getName (const Device &device) const |
Returns the name field of the device tuple. More... | |
const std::string & | getInterfaceAddress (const Device &device) const |
Returns the interface ip address of the device tuple. More... | |
const std::string & | getAddress (const Device &device) const |
Returns the BAOS device address of the device tuple. More... | |
unsigned char | getVersion (const Device &device) const |
Returns the protocol version of the device tuple. More... | |
Finds all available IP BAOS devices on the network.
The BaosEnumerator scans all available network interfaces and searches for the list of BAOS devices on the network. The information returned is a tuple of:
name, interface ip address (local), BAOS IP address (remote) version (the object server protocol version)
This device information can be directly given to the StreamConnection to create a connection.
See also the Enumerator sample and the LightSwitcher sample for an example of how to use the BaosEnumerator
BaosIpEnumerator::BaosIpEnumerator | ( | bool | autoScan = true | ) |
Creates a Baos Enumerator.
If autoScan is true it will automatically scan the network If false, you will have to explicitly run scan
BaosIpEnumerator::~BaosIpEnumerator | ( | ) |
Destroys the BaosEnumerator.
const BaosIpEnumerator::Device & BaosIpEnumerator::find | ( | const std::string & | name | ) | const |
Finds device information for a BAOS device with a human-readable name that matches the specified name.
This is a case-insensitive check. The BAOS devices typically have the MAC address programmed as their name in production. To change its name you can use the ETS software, or the Net'n Node software by writing to the specific property.
If a device is not found that matches name an exception is thrown.
const BaosIpEnumerator::Device & BaosIpEnumerator::findByAddress | ( | const std::string & | ipAddress | ) | const |
Finds device information for a BAOS device that matches a specified IP Address.
If a device is not found that matches ipAddress an exception is thrown.
const std::string & BaosIpEnumerator::getAddress | ( | const Device & | device | ) | const |
Returns the BAOS device address of the device tuple.
const BaosIpEnumerator::Devices & BaosIpEnumerator::getDevices | ( | ) | const |
Returns the list of found devices.
const std::string & BaosIpEnumerator::getInterfaceAddress | ( | const Device & | device | ) | const |
Returns the interface ip address of the device tuple.
const std::string & BaosIpEnumerator::getName | ( | const Device & | device | ) | const |
Returns the name field of the device tuple.
unsigned char BaosIpEnumerator::getVersion | ( | const Device & | device | ) | const |
Returns the protocol version of the device tuple.
const BaosIpEnumerator::Devices & BaosIpEnumerator::scan | ( | ) |
Enumerates all network interfaces and for each available network interfaces searches for baos devices.
The loopback interface is ignored.