Group manipulation and state

## Functions

struct lightify_group * | lightify_group_get_next (struct lightify_ctx *ctx, struct lightify_group *current)
struct lightify_group * | lightify_group_get_previous (struct lightify_ctx *ctx, struct lightify_group *current)
const char * | lightify_group_get_name (struct lightify_group *grp)
int | lightify_group_get_id (struct lightify_group *grp)
int | lightify_group_request_scan (struct lightify_ctx *ctx)
struct lightify_node * | lightify_group_get_next_node (struct lightify_group *grp, struct lightify_node *lastnode)
int | lightify_group_request_onoff (struct lightify_ctx *ctx, struct lightify_group *group, int onoff)
int | lightify_group_request_cct (struct lightify_ctx *ctx, struct lightify_group *group, unsigned int cct, unsigned int fadetime)
int | lightify_group_request_rgbw (struct lightify_ctx *ctx, struct lightify_group *group, unsigned int r, unsigned int g, unsigned int b, unsigned int w, unsigned int fadetime)
int | lightify_group_request_brightness (struct lightify_ctx *ctx, struct lightify_group *group, unsigned int level, unsigned int fadetime)

## Detailed Description

## Function Documentation

int lightify_group_get_id | ( | struct lightify_group * | grp | ) |

Get the ID of the group

Parameters

  grp |

Returns
  group id or negative on error.

Definition at line 128 of file groups.c.

const char* lightify_group_get_name | ( | struct lightify_group * | grp | ) |

Get the name associated with the group

Parameters

  grp | Group pointer

Returns
  pointer to a string with the name

Definition at line 117 of file groups.c.

struct lightify_group* lightify_group_get_next | ( | struct lightify_ctx * | ctx,
|  | struct lightify_group * | current
| ) |  |

Get next known group

Parameters

  ctx | context
  current | last group queried

Returns
  next group in list or NULL if there isn't one

Definition at line 134 of file groups.c.

struct lightify_node* lightify_group_get_next_node | ( | struct lightify_group * | grp,
|  | struct lightify_node * | lastnode
| ) |  |

Get the next node ptr associated with the group

Parameters

  grp | group the node must be in
  lastnode | last node asked for, NULL if the first

Returns
  NULL is not found, else pointer.

Note
  you must scan for nodes to be able to associate nodes with the groups.

Definition at line 147 of file groups.c.

struct lightify_group* lightify_group_get_previous | ( | struct lightify_ctx * | ctx,
|  | struct lightify_group * | current
| ) |  |

Get previous known group

Parameters

  ctx | context
  current | last group queried

Returns
  previous group in list or NULL if there isn't one

Definition at line 140 of file groups.c.

int lightify_group_request_brightness | ( | struct lightify_ctx * | ctx,
|  | struct lightify_group * | group,
|  | unsigned int | level,
|  | unsigned int | fadetime
| ) |  |

Set Group brightness

Parameters

  ctx |
  group |
  level |
  fadetime |

Returns
  >=0 on success. negative on error.

Definition at line 1223 of file context.c.

int lightify_group_request_cct | ( | struct lightify_ctx * | ctx,
|  | struct lightify_group * | group,
|  | unsigned int | cct,
|  | unsigned int | fadetime
| ) |  |

Set group CCT

Parameters

  ctx | context
  group | group
  cct | CCT
  fadetime | time in 1/10 secs

Returns
  >=0 on success. negative on error.

Definition at line 1192 of file context.c.

int lightify_group_request_onoff | ( | struct lightify_ctx * | ctx,
|  | struct lightify_group * | group,
|  | int | onoff
| ) |  |

Request group to be turned off or on

Parameters

  ctx | context
  group | group ptr
  onoff | on or off ( true or false)

Returns
  >=0 on success. negative on error.

Definition at line 1178 of file context.c.

int lightify_group_request_rgbw | ( | struct lightify_ctx * | ctx,
|  | struct lightify_group * | group,
|  | unsigned int | r,
|  | unsigned int | g,
|  | unsigned int | b,
|  | unsigned int | w,
|  | unsigned int | fadetime
| ) |  |

Set RGBW values

Note
  some lamps cannot set white, also white and rgb might be exclusive.

Parameters

  ctx | context
  group |
  r | red
  g | green
  b | blue
  w | white
  fadetime |

Returns
  >=0 on success. negative on error.

Definition at line 1205 of file context.c.

int lightify_group_request_scan | ( | struct lightify_ctx * | ctx | ) |

Request the list of known groups

Parameters

  ctx | context

Returns
  negative on error, else number of retrieved groups (might be zero)

Definition at line 1082 of file context.c.