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

« back to all changes in this revision

Viewing changes to models/powercom.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
 
/* Written to work with Advice Partner/King PR750.
2
 
   See http://www.advice.co.il/product/inter/ups.html for its specifications.
3
 
   This model is based on PowerCom (www.powercom.com) models.
4
 
   Read docs/powercom.txt for other models and manufactures for which
5
 
   I believe this model program might work. 
6
 
    
7
 
   Copyright (C) 2000  Shaul Karl <shaulk@israsrv.net.il>
8
 
 
9
 
   Heavily based on 
10
 
    ups-trust425+625.c - model specific routines for Trust UPS 425/625
11
 
    Copyright (C) 1999  Peter Bieringer <pb@bieringer.de> 
12
 
 
13
 
   A technical description of the interface to the UPS that this program
14
 
   implements is found in docs/\*trust* files. 
15
 
    
16
 
   This program is free software; you can redistribute it and/or modify
17
 
   it under the terms of the GNU General Public License as published by
18
 
   the Free Software Foundation; either version 2 of the License, or
19
 
   (at your option) any later version.
20
 
 
21
 
   This program is distributed in the hope that it will be useful,
22
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 
   GNU General Public License for more details.
25
 
 
26
 
   You should have received a copy of the GNU General Public License
27
 
   along with this program; if not, write to the Free Software
28
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
 
*/
30
 
 
31
 
 
32
 
#include <sys/file.h>
33
 
#include <sys/stat.h>
34
 
#include <sys/ioctl.h>
35
 
#include <sys/types.h>
36
 
#include <sys/termios.h>
37
 
#include "time.h"
38
 
#include <limits.h>
39
 
 
40
 
#define INFO_MAX 12
41
 
 
42
 
#include "config.h"
43
 
#include "proto.h"
44
 
#include "shared.h"
45
 
#include "version.h"
46
 
#include "upscommon.h"
47
 
#include "common.h"
48
 
 
49
 
enum general {SHMOK = 1U, SEC_FOR_POWERKILL = 10U, 
50
 
              NUM_OF_BYTES_FROM_UPS = 11U, MAINS_VOLTAGE = 230U};
51
 
enum commands {SEND_DATA = 0x01U, BATTERY_TEST = 0x03U, SHUTDOWN = 0xbcU};
52
 
enum data {LOAD_LEVEL = 0U, BAT_LEVEL = 1U, IN_AC_VOLT = 2U, OUT_AC_VOLT = 3U,
53
 
           IN_AC_FREQ = 4U};
54
 
enum status {STATUS_A = 9U,
55
 
                SUMMARY = 0U, MAINS_FAILURE = 1U, LOW_BAT = 2U, 
56
 
                AVR_ON = 8U, OVERLOAD = 32U, OFF = 128U,
57
 
             STATUS_B = 10U,
58
 
                BAD_BAT = 2U, TEST = 4U};
59
 
 
60
 
/* The following vars must be global because other parts of the NUT package
61
 
 * use them as well. */
62
 
 
63
 
        /* 9 entries in the info array for: 
64
 
         * ACFREQ, BATTPCT, LOADPCT, MFR, MODEL, 
65
 
         *      SERIAL, STATUS, UPSIDENT, UTILITY.
66
 
         * One for BTEST1,
67
 
         * Other 2 are for MEMBERS and MSGID. */