| pnd-cpp-sdk 1.5.1

Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Pnd::Lookup Class Referencefinal

Maintains a registry of network-connected modules and returns Group objects to the user. More...

`#include <lookup.hpp>`

## Classes
class | EntryList

## Public Member Functions
| Lookup (std::string *addr=nullptr)
| Creates a Lookup object which can create Module and Group references. Typically, only one Lookup object should exist at a time.
| ~Lookup () noexcept
| Destructor frees all resources created by Lookup object, and stops the background query thread.
void | setNetWorks (std::string networks)
| Sets the broadcast address for the lookup.
std::string | getCtrlBoxIP ()
| Get CtrlBox ip address.
std::shared_ptr< Group > | getGroupFromFamily (const std::string &family, int32_t timeout_ms=DEFAULT_TIMEOUT)
| Get a group from all known modules with the given family.
std::shared_ptr< Group > | getGroupFromIps (const std::vector< std::string > &ips)
float | getLookupFrequencyHz () const
| Gets the rate [Hz] at which "discovery" packets are broadcast.
bool | setLookupFrequencyHz (float frequency)
| Sets the lookup rate [Hz].
std::shared_ptr< EntryList > | getEntryList ()
DeviceList * | getDeviceList ()

## Detailed Description

Maintains a registry of network-connected modules and returns Group objects to the user.

Only one Lookup object is needed per application.

## Constructor & Destructor Documentation

## ◆ Lookup()

Pnd::Lookup::Lookup | ( | std::string * | addr = `nullptr` | ) |

Creates a Lookup object which can create Module and Group references. Typically, only one Lookup object should exist at a time.

Note that this call invokes a background thread to query the network for modules at regular intervals.

## Member Function Documentation

## ◆ getGroupFromFamily()

std::shared_ptr< Group > Pnd::Lookup::getGroupFromFamily | ( | const std::string & | family,
|  | int32_t | timeout_ms = `DEFAULT_TIMEOUT`
| ) |  |

Get a group from all known modules with the given family.

Parameters

  family | The family of each of the desired group modules.

Returns
  A shared_ptr with no reference if no group found in allotted time, or reference to a newly allocated group object corresponding to the given parameters otherwise.

## ◆ getLookupFrequencyHz()

float Pnd::Lookup::getLookupFrequencyHz | ( |  | ) | const

Gets the rate [Hz] at which "discovery" packets are broadcast.

Defaults to 5 Hz.

## ◆ setLookupFrequencyHz()

bool Pnd::Lookup::setLookupFrequencyHz | ( | float | frequency | ) |

Sets the lookup rate [Hz].

Parameters

  frequency | The rate at which "discovery" packets get broadcast on the network to search for modules.

Returns
  true on success, false on failure (e.g., invalid frequency)

## ◆ setNetWorks()

void Pnd::Lookup::setNetWorks | ( | std::string | networks | ) |

Sets the broadcast address for the lookup.

Parameters

  networks | A string pointer to a broadcast address. eg: "192.168.100.255,192.168.101.255"

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

- /Users/lvhao/ws/pnd/sdk/pnd-cpp/src/lookup.hpp
- /Users/lvhao/ws/pnd/sdk/pnd-cpp/src/lookup.cpp