1
/* belkin.h - serial commands for Belkin smart protocol units
3
Copyright (C) 2000 Marcus M�ller <marcus@ebootis.de>
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#include <sys/ioctl.h>
21
#include <sys/termios.h>
27
#define MANUFACTURER "MNU"
31
#define STAT_INPUT "STI"
32
#define STAT_OUTPUT "STO"
33
#define STAT_BATTERY "STB"
34
#define STAT_STATUS "STA"
35
#define POWER_ON "RON"
36
#define POWER_OFF "ROF"
37
#define POWER_SDTYPE "SDT" /* shutdown type? */
38
#define POWER_CYCLE "SDA" /* shutdown, then restore */
40
/* The UPS Status "low battery" comes up 10s before the UPS actually stops.
41
Therefore a shutdown is done at this battery % */
45
/* dangerous instant commands must be reconfirmed within a 12 second window */
46
#define CONFIRM_DANGEROUS_COMMANDS 1
50
int init_communication (void);
52
int init_ups_data (void);
53
void updateinfo (void);
54
void get_belkin_field (char *,char *,int);
55
int get_belkin_reply (char*);
56
void send_belkin_command (char, const char *, const char *);
57
int recvbinary (char *, int);
58
void set_serialDTR0RTS1(void);