~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to models/belkin.h

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Quette
  • Date: 2004-05-28 13:10:01 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040528131001-yj2m9qcez4ya2w14
Tags: upstream-1.4.2
Import upstream version 1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* belkin.h - serial commands for Belkin smart protocol units
2
 
 
3
 
   Copyright (C) 2000 Marcus M�ller <marcus@ebootis.de>
4
 
 
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.
9
 
 
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.
14
 
 
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
18
 
*/
19
 
 
20
 
#include <sys/ioctl.h>
21
 
#include <sys/termios.h>
22
 
#include "timehead.h"
23
 
 
24
 
#define STATUS          'P'
25
 
#define CONTROL         'S'
26
 
 
27
 
#define MANUFACTURER    "MNU"
28
 
#define MODEL           "MOD"
29
 
#define VERSION         "VER"
30
 
#define RATING          "RAT"
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 */
39
 
 
40
 
/* The UPS Status "low battery" comes up 10s before the UPS actually stops.
41
 
   Therefore a shutdown is done at this battery % */
42
 
 
43
 
#define LOW_BAT         20
44
 
 
45
 
/* dangerous instant commands must be reconfirmed within a 12 second window */
46
 
#define CONFIRM_DANGEROUS_COMMANDS 1
47
 
#define MINCMDTIME      3
48
 
#define MAXCMDTIME      15
49
 
 
50
 
int init_communication (void);
51
 
void do_status(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);