devscan
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
DeviceScan Interface

Table of Contents

Introduction

The DeviceScan interface allows automatic discovery and monitoring reachability of devices connected to the network.

Protocols providing similar functionality are for example:

Usage

The abstract interface of the DeviceScan library is defined in hbm.devscan.ReceiverIf The library provides an executable implementation of this interface in hbm.devscan.Receiver.
The user application should create an instance of the hbm.devscan.Receiver class to make use of the provided DeviceScan code.

devscan_receiver.class.png
Documented interface and provided implementation

The hbm.devscan.Receiver class provides methods to register application provided callback functions:

It is not mandatory to register any callback function. Not making use of announcement and expire callback will limit the functionality of the application dramatically. Registering an error callback is explicitly optional, as it serves for debugging only.

The application provided callback functions need to match the following signatures:

See the documentation of theses typedefs for information on the data passed to the user's application.

Execution time of the hbm.devscan.Receiver can be controlled with the methods:

Registration of callbacks can be done at any time, regardless of the running status of the hbm.devscan.Receiver object.

Sequence

devscan_client.sequence.png
Typical usage of the ReceiverIf

Examples

scanclientnotifier main:

int main(int argc, char* argv[])
{
if(argc>1) {
if(std::string(argv[1])=="-h") {
std::cout << "Listens on incoming announces. Notifies about added, changed and removed announcements in a compact format." << std::endl;
std::cout << "return format: <family type> <uuid> <type> <name> <address> <netmask> <http port> <interface address> <interface netmask>" << std::endl;
return 0;
}
}
receiver.setExpireCb(&expireCb);
receiver.setErrorCb(&errorCb);
receiver.start();
return 0;
}