123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- #ifndef LIGHT_H
- #define LIGHT_H
-
- #include "helpers.h"
-
- #include <sys/types.h>
- #include <dirent.h>
-
- #define LIGHT_VER_MAJOR 0
- #define LIGHT_VER_MINOR 9
- #define LIGHT_VER_TYPE "beta"
- #define LIGHT_YEAR 2014
- #define LIGHT_AUTHOR "Fredrik Haikarainen"
-
- #define ASSERT_OPSET() \
- if(opSet)\
- {\
- printf("Operation arguments can not be used in conjunction.\n");\
- return FALSE;\
- }\
- opSet = TRUE;
-
- #define ASSERT_TARGETSET() \
- if(targetSet)\
- {\
- printf("Target arguments can not be used in conjunction.\n");\
- return FALSE;\
- }\
- targetSet = TRUE;
-
- #define ASSERT_CTRLSET()\
- if(ctrlSet)\
- {\
- printf("Controller arguments can not be used in conjunction.\n");\
- return FALSE;\
- }\
- ctrlSet = TRUE;
-
- #define ASSERT_VALSET()\
- if(valSet)\
- {\
- printf("Value arguments can not be used in conjunction.\n");\
- return FALSE;\
- }\
- valSet = TRUE;
-
-
- typedef enum LIGHT_TARGET {
- LIGHT_BRIGHTNESS = 0,
- LIGHT_MAX_BRIGHTNESS,
- LIGHT_MIN_CAP
- } LIGHT_TARGET;
-
- typedef enum LIGHT_CTRL_MODE {
- LIGHT_AUTO = 0,
- LIGHT_SPECIFY
- } LIGHT_CTRL_MODE;
-
- typedef enum LIGHT_OP_MODE {
- LIGHT_GET = 0,
- LIGHT_SET,
- LIGHT_ADD,
- LIGHT_SUB,
- LIGHT_PRINT_HELP,
- LIGHT_PRINT_VERSION,
- LIGHT_LIST_CTRL
- } LIGHT_OP_MODE;
-
- typedef enum LIGHT_VAL_MODE {
- LIGHT_RAW = 0,
- LIGHT_PERCENT
- } LIGHT_VAL_MODE;
-
- typedef struct light_runtimeArguments_s {
-
- LIGHT_CTRL_MODE controllerMode;
- char specifiedController[256];
-
-
- LIGHT_OP_MODE operationMode;
- LIGHT_VAL_MODE valueMode;
- unsigned long specifiedValueRaw;
- double specifiedValuePercent;
-
- LIGHT_TARGET target;
- } light_runtimeArguments, *light_runtimeArguments_p;
-
-
- struct dirent *light_iterator;
- DIR *light_iteratorDir;
- char light_currentController[256];
-
-
- light_runtimeArguments light_Configuration;
-
-
- void light_defaultConfig();
-
-
-
- LIGHT_BOOL light_parseArguments(int argc, char** argv);
-
-
- void light_printVersion(void);
-
-
- void light_printHelp(void);
-
-
-
-
- LIGHT_BOOL light_initialize(int argc, char** argv);
-
-
- LIGHT_BOOL light_execute(void);
-
-
- void light_free();
-
-
-
-
- LIGHT_BOOL light_genPath(char const *controller, LIGHT_TARGET type, char **buffer);
-
- LIGHT_BOOL light_getBrightness(char const *controller, unsigned long *v);
-
- LIGHT_BOOL light_getMaxBrightness(char const *controller, unsigned long *v);
-
- LIGHT_BOOL light_setBrightness(char const *controller, unsigned long v);
-
- LIGHT_BOOL light_controllerAccessible(char const *controller);
-
- LIGHT_BOOL light_iterateControllers(void);
-
-
- LIGHT_BOOL light_getBestController(char *controller);
-
- LIGHT_BOOL light_getMinCap(char const *controller, LIGHT_BOOL *hasMinCap, unsigned long *minCap);
-
- LIGHT_BOOL light_setMinCap(char const *controller, unsigned long v);
-
- LIGHT_BOOL light_listControllers();
-
- #endif
|