72 lines
1.7 KiB
C

/**
rexbacklight
Copyright (C) 2018 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RECBACKLIGHT_CMD_H
#define REXBACKLIGHT_CMD_H
#define OP_INC 1
#define OP_DEC 2
#define OP_SET 4
#define OP_LIST 8
#define OP_GET 128
#define OP_NONE 0
#define GET_LONG_OPT "--get"
#define GET_SHORT_OPT "-g"
#define FADE_LONG_OPT "--fade"
#define FADE_SHORT_OPT "-f"
#define DEVICE_LONG_OPT "--device"
#define DEVICE_SHORT_OPT "-d"
#define LIST_LONG_OPT "--list"
#define LIST_SHORT_OPT "-l"
#define HELP_LONG_OPT "--help"
#define HELP_SHORT_OPT "-h"
struct cmd_arg{
const char* lopt;
const char* sopt;
const char* desc;
};
extern struct cmd_arg rexbacklight_args[];
extern int rexbacklight_args_length;
struct arg_values{
struct arg_values* next;
//Specific device to control
//NULL means all devices
const char* device;
//What value to put in the backlight file
float delta;
//How many seconds to transition
int fade_duration;
unsigned char operation;
};
void free_cmd_args(struct arg_values* a);
struct arg_values process_cmd_args(int argc, char** argv);
int process_op(struct arg_values* arg, float min, float current, float max);
#endif