BAOS SDK  18.2.0
Public Types | Public Member Functions | List of all members
kdrive::baos::BaosIpEnumerator Class Reference

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 Devicesscan ()
 Enumerates all network interfaces and for each available network interfaces searches for baos devices. More...
 
const DevicesgetDevices () const
 Returns the list of found devices. More...
 
const Devicefind (const std::string &name) const
 Finds device information for a BAOS device with a human-readable name that matches the specified name. More...
 
const DevicefindByAddress (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...
 

Detailed Description

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

Note
BaosEnumerator supports only IP Baos devices. FT 1.2 Serial device are not supported.
Examples:
BaosDatapointDescription.cpp, BaosIpEnumerator.cpp, BaosLightSwitcher.cpp, BaosMultiConnector.cpp, and BaosMultiThreaded.cpp.

Member Typedef Documentation

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

Examples:
BaosDatapointDescription.cpp, BaosLightSwitcher.cpp, BaosMultiConnector.cpp, and BaosMultiThreaded.cpp.
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.

Examples:
BaosIpEnumerator.cpp.
const BaosIpEnumerator::Devices & BaosIpEnumerator::getDevices ( ) const

Returns the list of found devices.

Examples:
BaosIpEnumerator.cpp.
const std::string & BaosIpEnumerator::getInterfaceAddress ( const Device device) const

Returns the interface ip address of the device tuple.

Examples:
BaosIpEnumerator.cpp.
const std::string & BaosIpEnumerator::getName ( const Device device) const

Returns the name field of the device tuple.

Examples:
BaosIpEnumerator.cpp.
unsigned char BaosIpEnumerator::getVersion ( const Device device) const

Returns the protocol version of the device tuple.

Examples:
BaosIpEnumerator.cpp.
const BaosIpEnumerator::Devices & BaosIpEnumerator::scan ( )

Enumerates all network interfaces and for each available network interfaces searches for baos devices.

The loopback interface is ignored.


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