2010-03-25 23:20:59 +00:00
|
|
|
/*
|
|
|
|
* powercom.h - defines for the newpowercom.c driver
|
|
|
|
*
|
|
|
|
* Copyrights:
|
|
|
|
* (C) 2002 Simon Rozman <simon@rozman.net>
|
|
|
|
* (C) 1999 Peter Bieringer <pb@bieringer.de>
|
|
|
|
*
|
|
|
|
* 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 2 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-06-29 10:37:36 +00:00
|
|
|
#ifndef NUT_POWERCOM_H_SEEN
|
|
|
|
#define NUT_POWERCOM_H_SEEN 1
|
|
|
|
|
2010-03-25 23:20:59 +00:00
|
|
|
/* C-libary includes */
|
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
/* nut includes */
|
2022-06-29 10:37:36 +00:00
|
|
|
#include "serial.h"
|
|
|
|
#include "nut_stdint.h"
|
2010-03-25 23:20:59 +00:00
|
|
|
#include "timehead.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* supported types */
|
|
|
|
struct type {
|
|
|
|
const char *name;
|
|
|
|
unsigned char num_of_bytes_from_ups;
|
2022-06-29 10:37:36 +00:00
|
|
|
|
2010-03-25 23:20:59 +00:00
|
|
|
struct method_of_flow_control {
|
2022-06-29 10:37:36 +00:00
|
|
|
const char *name;
|
|
|
|
void (*setup_flow_control)(void);
|
2010-03-25 23:20:59 +00:00
|
|
|
} flowControl;
|
2022-06-29 10:37:36 +00:00
|
|
|
|
2010-03-25 23:20:59 +00:00
|
|
|
struct validation_byte {
|
2022-06-29 10:37:36 +00:00
|
|
|
unsigned int index_of_byte, required_value;
|
|
|
|
/* An example might explain the intention better then prose.
|
|
|
|
* Suppose we want to validate the data with:
|
|
|
|
* powercom_raw_data[5] == 0x80
|
|
|
|
* then we will set index_of_byte to 5U and required_value to
|
|
|
|
* 0x80U: { 5U, 0x80U }.
|
|
|
|
*/
|
2010-03-25 23:20:59 +00:00
|
|
|
} validation[3];
|
2022-06-29 10:37:36 +00:00
|
|
|
/* The validation array is of length 3 because 3 is longest
|
2010-03-25 23:20:59 +00:00
|
|
|
* validation sequence for any type.
|
|
|
|
*/
|
2022-06-29 10:37:36 +00:00
|
|
|
|
|
|
|
/* Some UPSs must have a minutes and a seconds arguments for
|
2010-03-25 23:20:59 +00:00
|
|
|
* the COUNTER commands while others are known to work with the
|
|
|
|
* seconds argument alone.
|
|
|
|
*/
|
2011-06-01 20:31:49 +00:00
|
|
|
struct delay_for_power_kill {
|
2022-06-29 10:37:36 +00:00
|
|
|
unsigned char delay[2]; /* { minutes, seconds } */
|
|
|
|
unsigned char minutesShouldBeUsed;
|
|
|
|
/* 'n' in case the minutes value, which is delay[0], should
|
|
|
|
* be skipped and not sent to the UPS.
|
2010-03-25 23:20:59 +00:00
|
|
|
*/
|
|
|
|
} shutdown_arguments;
|
2022-06-29 10:37:36 +00:00
|
|
|
|
2011-06-01 20:31:49 +00:00
|
|
|
/* parameters to calculate input and output freq., one pair used for
|
|
|
|
* both input and output functions:
|
|
|
|
* The pair [0],[1] defines parameters for 1/(A*x+B) to calculate freq.
|
|
|
|
* from raw data 'x'.
|
2010-03-25 23:20:59 +00:00
|
|
|
*/
|
|
|
|
float freq[2];
|
2022-06-29 10:37:36 +00:00
|
|
|
|
2010-03-25 23:20:59 +00:00
|
|
|
/* parameters to calculate load %, two pairs for each type:
|
2011-06-01 20:31:49 +00:00
|
|
|
* First pair [0],[1] defines the parameters for A*x+B to calculate load
|
|
|
|
* from raw data when offline and the second pair [2],[3] is used when
|
2010-03-25 23:20:59 +00:00
|
|
|
* online
|
|
|
|
*/
|
|
|
|
float loadpct[4];
|
2022-06-29 10:37:36 +00:00
|
|
|
|
2010-03-25 23:20:59 +00:00
|
|
|
/* parameters to calculate battery %, five parameters for each type:
|
2011-06-01 20:31:49 +00:00
|
|
|
* First three params [0],[1],[2] defines the parameters for A*x+B*y+C to calculate
|
2010-03-25 23:20:59 +00:00
|
|
|
* battery % (x is raw data, y is load %) when offline.
|
2011-06-01 20:31:49 +00:00
|
|
|
* Fourth and fifth parameters [3],[4] are used to calculate D*x+E when online.
|
2010-03-25 23:20:59 +00:00
|
|
|
*/
|
|
|
|
float battpct[5];
|
|
|
|
|
|
|
|
/* parameters to calculate utility and output voltage, two pairs for
|
|
|
|
* each type:
|
2011-06-01 20:31:49 +00:00
|
|
|
* First pair [0],[1] defines the parameters for A*x+B to calculate utility
|
|
|
|
* from raw data when line voltage is >=220 and the second pair [2],[3]
|
2010-03-25 23:20:59 +00:00
|
|
|
* is used otherwise.
|
|
|
|
*/
|
|
|
|
float voltage[4];
|
|
|
|
};
|
2022-06-29 10:37:36 +00:00
|
|
|
|
|
|
|
#endif /* NUT_POWERCOM_H_SEEN */
|