|
fplayer
C99 Falcon Sequence (fseq) file player for Light-O-Rama hardware (like xLights)
|
Channel range map implementation. More...
#include "crmap.h"#include <assert.h>#include <stdlib.h>#include <cjson/cJSON.h>#include "std2/errcode.h"#include "std2/fc.h"
Data Structures | |
| struct | cr_s |
| Channel range node that maps sequence channel indices to unit and circuit numbers. More... | |
Functions | |
| int | CR_parseOne (const cJSON *item, struct cr_s *cr) |
Parses a single channel range map object into the given cr struct. The object is expected to have the following structure: | |
| static int | CR_parse (const char *s, struct cr_s **cr) |
Parses the given channel range map string into a linked list of struct cr_s nodes. The string is expected to be JSON formatted with the following structure: | |
| int | CMap_read (const char *fp, struct cr_s **cr) |
Reads a channel range map from the given file path. The channel range map is a linked list of channel range nodes that map sequence channel indices to unit and circuit numbers. The caller is responsible for freeing the returned channel range map using CMap_free. | |
| void | CMap_free (struct cr_s *cr) |
| Frees the given channel range map by walking the linked list and freeing each node. | |
| int | CMap_lookup (const struct cr_s *cr, const uint32_t id, uint8_t *unit, uint16_t *circuit) |
Remaps the given sequence channel index to a unit and circuit number using the channel range mapping. The result is written to the given unit and circuit pointers. | |
Channel range map implementation.
| void CMap_free | ( | struct cr_s * | cr | ) |
Frees the given channel range map by walking the linked list and freeing each node.
| cr | channel range map to free |

| int CMap_lookup | ( | const struct cr_s * | cr, |
| uint32_t | id, | ||
| uint8_t * | unit, | ||
| uint16_t * | circuit ) |
Remaps the given sequence channel index to a unit and circuit number using the channel range mapping. The result is written to the given unit and circuit pointers.
| cr | channel range map to use for remapping |
| id | sequence channel index to remap |
| unit | pointer to write the unit number to |
| circuit | pointer to write the circuit number to |

| int CMap_read | ( | const char * | fp, |
| struct cr_s ** | cr ) |
Reads a channel range map from the given file path. The channel range map is a linked list of channel range nodes that map sequence channel indices to unit and circuit numbers. The caller is responsible for freeing the returned channel range map using CMap_free.
| fp | file path to read from |
| cr | pointer to write the channel range map to |


|
static |
Parses the given channel range map string into a linked list of struct cr_s nodes. The string is expected to be JSON formatted with the following structure:
| s | channel range map string to parse |
| cr | pointer to write the channel range map to |


| int CR_parseOne | ( | const cJSON * | item, |
| struct cr_s * | cr ) |
Parses a single channel range map object into the given cr struct. The object is expected to have the following structure:
| item | cJSON object to parse |
| cr | pointer to write the parsed channel range map to |
