Lightify Class Reference

`#include <liblightify++.hpp>`

## Public Member Functions

| Lightify (const char *host, unsigned int port=4000)
virtual | ~Lightify ()
int | Open (void)
int | Close (void)
int | ScanNodes (void)
int | ScanGroups (void)
struct lightify_ctx * | GetCtx (void)
int | TurnAllOnOff (bool onoff)
Lightify_Node * | GetNode (long long mac)
Lightify_Node * | GetNodeAtPosX (int x) const
Lightify_Group * | GetGroupAtPosX (int pos) const
const struct lightify_ctx * | GetLightifyContext (void) const
int | IsOpen (void) const
int | SetHostname (const char *host, unsigned int port=4000)
int | GetNodesCount (void)
int | GetGroupsCount (void)

## Detailed Description

Lightify-Class to encapsulate the library context and offer access to the management functionality.

Note
  throws std::bad_alloc on out of memory, when exceptions enabled. (see LIGHTIFY_ALLOW_THROW)

Definition at line 304 of file liblightify++.hpp.

## Constructor & Destructor Documentation

Lightify | ( | const char * | host,
|  | unsigned int | port = `4000`
| ) |  |

inline

Default Constructor Throws invalid_argument if port is >0xffff.

Definition at line 308 of file liblightify++.hpp.

virtual ~Lightify | ( |  | ) |

inline virtual

Definition at line 329 of file liblightify++.hpp.

## Member Function Documentation

int Close | ( | void |  | ) |

inline

Close the (previously) opened socket.

Definition at line 394 of file liblightify++.hpp.

struct lightify_ctx* GetCtx | ( | void |  | ) |

inline

Get direct access to the lighitfy context

Warning
  advanced use – improper use can confuse the C++ Wrapper and create inconsitent state.

Definition at line 483 of file liblightify++.hpp.

Lightify_Group* GetGroupAtPosX | ( | int | pos | ) | const

inline

Get Group at Pos X

Returns
  pointer or NULL

Definition at line 520 of file liblightify++.hpp.

int GetGroupsCount | ( | void |  | ) |

inline

Definition at line 567 of file liblightify++.hpp.

const struct lightify_ctx* GetLightifyContext | ( | void |  | ) | const

inline

Get the library context – for direct library access.

Warning
  dangerous! Avoid calls that might change e.g memory location of the node structures, like scan for nodes etc.

Definition at line 529 of file liblightify++.hpp.

Lightify_Node* GetNode | ( | long long | mac | ) |

inline

Get the node object for a given MAC address

Definition at line 494 of file liblightify++.hpp.

Lightify_Node* GetNodeAtPosX | ( | int | x | ) | const

inline

Get node at Pos X

Returns
  pointer or NULL

Definition at line 508 of file liblightify++.hpp.

int GetNodesCount | ( | void |  | ) |

inline

Definition at line 563 of file liblightify++.hpp.

int IsOpen | ( | void |  | ) | const

inline

Have the connection been opened?

Note
  this only checks for an valid file descriptor

Returns
  true, yes

Definition at line 538 of file liblightify++.hpp.

int Open | ( | void |  | ) |

inline

Open socket / prepare communication returns 0 on success, negative on error.

Definition at line 339 of file liblightify++.hpp.

int ScanGroups | ( | void |  | ) |

inline

Scan for known groups and generate a Group object for every returned group.

Note
  Scanning will invalidate all previous objects.

Returns
  number of detected groups, negative on error.

Definition at line 448 of file liblightify++.hpp.

int ScanNodes | ( | void |  | ) |

inline

Scan for nodes

Note
  : This invalidates all previously known node information!

Definition at line 410 of file liblightify++.hpp.

int SetHostname | ( | const char * | host,
|  | unsigned int | port = `4000`
| ) |  |

inline

Set a hostname / port combination

Parameters

  host | string used as host (hostname of IP)
  port | to be used, default 4000

Returns
  negative on error, otherwise on success. (Error causes are invalid parameters like host=NULL or port>0xffff and out of memory situations.)

Definition at line 552 of file liblightify++.hpp.

int TurnAllOnOff | ( | bool | onoff | ) |

inline

Actions that can be broadcasted.

Definition at line 488 of file liblightify++.hpp.

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

- src/liblightify++/liblightify++.hpp