4 #ifndef _DMXDEVICEPATCH_H_
5 #define _DMXDEVICEPATCH_H_
10 #include <unordered_map>
30 static unordered_map<int, string> convTypeToString = {
37 static unordered_map<string, int> stringToConvType = {
47 else if (t ==
ENUM) {
return "ENUM"; }
48 else if (t ==
RGB_REPEAT2) {
return "RGB_REPEAT2"; }
49 else if (t ==
RGB_REPEAT3) {
return "RGB_REPEAT3"; }
50 else if (t ==
RGB_REPEAT4) {
return "RGB_REPEAT4"; }
51 else if (t ==
COLOR_RGB) {
return "COLOR_RGB"; }
52 else if (t ==
COLOR_RGBW) {
return "COLOR_RGBW"; }
53 else if (t ==
ORI_TO_FINE) {
return "ORI_TO_FINE"; }
56 Logger::log(
WARN,
"Unknown conversion type. Defaulting to float to single.");
57 return "FLOAT_TO_SINGLE";
64 else if (t ==
"ENUM") {
return ENUM; }
65 else if (t ==
"RGB_REPEAT2") {
return RGB_REPEAT2; }
66 else if (t ==
"RGB_REPEAT3") {
return RGB_REPEAT3; }
67 else if (t ==
"RGB_REPEAT4") {
return RGB_REPEAT4; }
68 else if (t ==
"COLOR_RGB") {
return COLOR_RGB; }
69 else if (t ==
"COLOR_RGBW") {
return COLOR_RGBW; }
70 else if (t ==
"ORI_TO_FINE") {
return ORI_TO_FINE; }
73 Logger::log(
WARN,
"Unknown conversion type. Defaulting to float to single.");
118 patchData(
unsigned int addr,
string t) : startAddress(addr) {
147 DMXDevicePatch(
string mapKey,
unsigned int baseAddress,
unsigned int universe);
160 void updateDMX(
unsigned char* data,
Device* device, map<string, patchData>& dmxMap);
237 void floatToFine(
unsigned char* data,
unsigned int address,
float val);
301 inline void setDMXVal(
unsigned char* data,
unsigned int address,
unsigned char val);
Defines an enumeration in Lumiverse.
Definition: LumiverseEnum.h:43
unsigned int m_universe
Universe number for the device (zero-indexed)
Definition: DMXDevicePatch.h:196
void ColorToLustrPlus(unsigned char *data, unsigned int address, LumiverseColor *val)
Converts a LumiverseColor to 7 channels of DMX data.
Definition: DMXDevicePatch.cpp:155
unsigned int m_numAddresses
Number of addresses this device uses on a DMX network.
Definition: DMXDevicePatch.h:199
void setDMXVal(unsigned char *data, unsigned int address, unsigned char val)
Helper for setting DMX values.
Definition: DMXDevicePatch.cpp:165
Definition: DMXDevicePatch.h:27
This class describes a color.
Definition: LumiverseColor.h:83
string getDMXMapKey()
Gets the key for the DMX map this device should use to translate its Lumiverse values to DMX values...
Definition: DMXDevicePatch.h:189
Definition: DMXDevicePatch.h:26
conversionType
Enumeration maps to a function that performs the appropriate conversion from Lumiverse value to DMX v...
Definition: DMXDevicePatch.h:17
void ColorToRGBW(unsigned char *data, unsigned int address, LumiverseColor *val)
Converts a LumiverseColor to 4 channels of DMX data.
Definition: DMXDevicePatch.cpp:143
patchData()
Constructs a default patch entry.
Definition: DMXDevicePatch.h:105
Definition: DMXDevicePatch.h:21
Definition: DMXDevicePatch.h:18
void ColorToRGB(unsigned char *data, unsigned int address, LumiverseColor *val)
Converts a LumiverseColor to 3 channels of DMX data.
Definition: DMXDevicePatch.cpp:132
~DMXDevicePatch()
Destroys the patch object.
Definition: DMXDevicePatch.cpp:11
DMXDevicePatch(string mapKey, unsigned int baseAddress, unsigned int universe)
Constructs an empty patch.
Definition: DMXDevicePatch.cpp:5
Definition: DMXDevicePatch.h:22
void setUniverse(unsigned char newUniverse)
Sets the universe the device is patched to.
Definition: DMXDevicePatch.h:170
This class includes information on how to translate the device properties for a given device to DMX v...
Definition: DMXDevicePatch.h:137
void floatToSingle(unsigned char *data, unsigned int address, LumiverseFloat *val)
Converts a float value to a single DMX channel of data. min-max -> 0-255.
Definition: DMXDevicePatch.cpp:105
Definition: DMXDevicePatch.h:25
unsigned int startAddress
Starting address for the parameter.
Definition: DMXDevicePatch.h:93
unsigned int getBaseAddress()
Gets the base address for the device.
Definition: DMXDevicePatch.h:176
Definition: DMXDevicePatch.h:23
Definition: DMXDevicePatch.h:24
void RGBRepeat(unsigned char *data, unsigned int address, LumiverseFloat *val, int repeats)
Converts a float value to a single DMX channel of data. min-max -> 0-255 and repeats it a number of t...
Definition: DMXDevicePatch.cpp:125
void toEnum(unsigned char *data, unsigned int address, LumiverseEnum *val)
Converts an enum to a single DMX channel of data.
Definition: DMXDevicePatch.cpp:118
void log(LOG_LEVEL level, string message)
Logs a meesage to the output file.
Definition: Logger.cpp:46
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
void updateDMX(unsigned char *data, Device *device, map< string, patchData > &dmxMap)
Given a universe of DMX, update the device.
Definition: DMXDevicePatch.cpp:15
Definition: DMXDevicePatch.h:20
Defines a float in Lumiverse.
Definition: LumiverseFloat.h:21
conversionType type
How the LumiverseType should be converted to DMX.
Definition: DMXDevicePatch.h:99
void floatToFine(unsigned char *data, unsigned int address, float val)
Converts a float value to two DMX channels of data. min-max -> 0 - 65535.
Definition: DMXDevicePatch.cpp:110
unsigned int getUniverse()
Gets the universe the device is patched to.
Definition: DMXDevicePatch.h:164
A Device in Lumiverse maintains information about a lighting device.
Definition: Device.h:55
Definition: DMXDevicePatch.h:19
patchData(unsigned int addr, string t)
Constructs a patch entry from a string conversionType.
Definition: DMXDevicePatch.h:118
string m_dmxMapKey
Key to get the map that maps device parameters to a start DMX address.
Definition: DMXDevicePatch.h:210
patchData(unsigned int addr, conversionType t)
Constructs a patch entry.
Definition: DMXDevicePatch.h:112
Small struct containing information on where the DMX parameter starts and how to convert it to the ri...
Definition: DMXDevicePatch.h:84
unsigned int m_baseAddress
Base address for the device (zero-indexed)
Definition: DMXDevicePatch.h:193
void setBaseAddress(unsigned int newAddress)
Sets the base address for the device.
Definition: DMXDevicePatch.h:182