node.c File Reference
`#include "liblightify-private.h"`
`#include "node.h"`
`#include "context.h"`
`#include <stdint.h>`
`#include <stdlib.h>`
`#include <errno.h>`
`#include <string.h>`
Include dependency graph for node.c:

Go to the source code of this file.

## Data Structures

struct | lightify_node

## Macros

#define | MAX_NODE_NANE_LEN (16)

## Functions

int | lightify_node_new (struct lightify_ctx *ctx, struct lightify_node **newnode)
int | lightify_node_remove (struct lightify_node *node)
struct lightify_node * | lightify_node_get_nextnode (struct lightify_node *node)
struct lightify_node * | lightify_node_get_prevnode (struct lightify_node *node)
int | lightify_node_set_name (struct lightify_node *node, char *name)
LIGHTIFY_EXPORT const char * | lightify_node_get_name (struct lightify_node *node)
int | lightify_node_set_nodeadr (struct lightify_node *node, uint64_t adr)
LIGHTIFY_EXPORT uint64_t | lightify_node_get_nodeadr (struct lightify_node *node)
int | lightify_node_set_zoneadr (struct lightify_node *node, uint16_t adr)
LIGHTIFY_EXPORT uint16_t | lightify_node_get_zoneadr (struct lightify_node *node)
int | lightify_node_set_grpadr (struct lightify_node *node, uint16_t adr)
LIGHTIFY_EXPORT uint16_t | lightify_node_get_grpadr (struct lightify_node *node)
int | lightify_node_set_lamptype (struct lightify_node *node, enum lightify_node_type type)
LIGHTIFY_EXPORT enum lightify_node_type | lightify_node_get_lamptype (struct lightify_node *node)
int | lightify_node_set_red (struct lightify_node *node, int red)
LIGHTIFY_EXPORT int | lightify_node_get_red (struct lightify_node *node)
int | lightify_node_set_blue (struct lightify_node *node, int blue)
LIGHTIFY_EXPORT int | lightify_node_get_blue (struct lightify_node *node)
int | lightify_node_set_green (struct lightify_node *node, int green)
LIGHTIFY_EXPORT int | lightify_node_get_green (struct lightify_node *node)
int | lightify_node_set_white (struct lightify_node *node, int white)
LIGHTIFY_EXPORT int | lightify_node_get_white (struct lightify_node *node)
int | lightify_node_set_cct (struct lightify_node *node, int cct)
LIGHTIFY_EXPORT int | lightify_node_get_cct (struct lightify_node *node)
int | lightify_node_set_brightness (struct lightify_node *node, int brightness)
LIGHTIFY_EXPORT int | lightify_node_get_brightness (struct lightify_node *node)
int | lightify_node_set_onoff (struct lightify_node *node, uint8_t on)
LIGHTIFY_EXPORT int | lightify_node_is_on (struct lightify_node *node)
int | lightify_node_set_online_status (struct lightify_node *node, uint8_t state)
LIGHTIFY_EXPORT int | lightify_node_get_onlinestate (struct lightify_node *node)
LIGHTIFY_EXPORT int | lightify_node_is_stale (struct lightify_node *node)
int | lightify_node_set_stale (struct lightify_node *node, int stale)

## Macro Definition Documentation

#define MAX_NODE_NANE_LEN (16)

Definition at line 39 of file node.c.

## Function Documentation

struct lightify_node* lightify_node_get_nextnode | ( | struct lightify_node * | node | ) |

Get the next node in the linked list

Parameters

  node |

Returns
  next node or NULL

Definition at line 140 of file node.c.

struct lightify_node* lightify_node_get_prevnode | ( | struct lightify_node * | node | ) |

Get the previous node in the linked list

Parameters

  node |

Returns
  next node or NULL

Definition at line 145 of file node.c.

int lightify_node_new | ( | struct lightify_ctx * | ctx,
|  | struct lightify_node ** | newnode
| ) |  |

Create new node entry and attach it to the ctx

Parameters

  ctx |
  newnode |

Returns

Definition at line 80 of file node.c.

int lightify_node_remove | ( | struct lightify_node * | node | ) |

Remove a node from its context and free its memory.

Parameters

  node | to be manipulated

Returns
  0 on success, <0 on errors, like ENOMEM, EINVAL

Definition at line 117 of file node.c.

int lightify_node_set_blue | ( | struct lightify_node * | node,
|  | int | blue
| ) |  |

Set the color component of the node

Parameters

  node |

Returns
  the value normalized from 0 to 255. negative numbers means: information not available.

Definition at line 224 of file node.c.

int lightify_node_set_brightness | ( | struct lightify_node * | node,
|  | int | brightness
| ) |  |

Set a new brightness value

Parameters

  node |
  brightness |

Returns
  negative on error

Definition at line 268 of file node.c.

int lightify_node_set_cct | ( | struct lightify_node * | node,
|  | int | cct
| ) |  |

Set the Correlated Color Temperature

Parameters

  node |
  cct | – normalized from 0 - 255 (negative values: not available)

Returns
  negative on error

Definition at line 257 of file node.c.

int lightify_node_set_green | ( | struct lightify_node * | node,
|  | int | green
| ) |  |

Set the color component of the node

Parameters

  node |
  red |

Returns

Definition at line 235 of file node.c.

int lightify_node_set_grpadr | ( | struct lightify_node * | node,
|  | uint16_t | adr
| ) |  |

Set the node's zone address

Parameters

  node |
  adr |

Returns

Note
  Only the cache's data will be modified, there is no way to modify the actual group address.

Definition at line 191 of file node.c.

int lightify_node_set_lamptype | ( | struct lightify_node * | node,
|  | enum | lightify_node_type
| ) |  |

Set node's ZLL lamp types

Parameters

  node |
  caps |

Returns

Definition at line 202 of file node.c.

int lightify_node_set_name | ( | struct lightify_node * | node,
|  | char * | name
| ) |  |

Gives a node a new name

Parameters

  node | to be manipulated
  name | to be set, NULL to clear the name.

Returns
  0 on success, <0 on errors, like EINVAL

A copy of the name will be allocated.

Definition at line 151 of file node.c.

int lightify_node_set_nodeadr | ( | struct lightify_node * | node,
|  | uint64_t | adr
| ) |  |

Set a new node address (MAC adress)

Parameters

  node |
  adr |

Returns

Note
  Only the cache's data will be modified, there is no way to modify the actual nodes' address.

Definition at line 169 of file node.c.

int lightify_node_set_online_status | ( | struct lightify_node * | node,
|  | uint8_t | state
| ) |  |

Set the online status

Parameters

  node |
  state |

Returns
  negative on error

Definition at line 291 of file node.c.

int lightify_node_set_onoff | ( | struct lightify_node * | node,
|  | uint8_t | on
| ) |  |

Set the ON/OFF status of the node

Parameters

  node | 0 means off, 1 means on (negative numbers are for "unknown")
  on |

Returns
  negative on error

Definition at line 280 of file node.c.

int lightify_node_set_red | ( | struct lightify_node * | node,
|  | int | red
| ) |  |

Set the color component of the node

Parameters

  node |
  red |

Returns

Definition at line 213 of file node.c.

int lightify_node_set_stale | ( | struct lightify_node * | node,
|  | int | stale
| ) |  |

Set stale information

Parameters

  node |
  stale | 0 active, 1 stale

Returns
  negative on error

Definition at line 307 of file node.c.

int lightify_node_set_white | ( | struct lightify_node * | node,
|  | int | white
| ) |  |

Set the color component of the node

Parameters

  node |

Returns
  the value normalized from 0 to 255. negative numbers means: information not available.

Definition at line 246 of file node.c.

int lightify_node_set_zoneadr | ( | struct lightify_node * | node,
|  | uint16_t | adr
| ) |  |

Set the node's zone address

Parameters

  node |
  adr |

Returns

Note
  Only the cache's data will be modified, there is no way to modify the actual zones' address.

Definition at line 180 of file node.c.