admin
base
com
developer
drivers
ds
adsi
dns
ds
edb500
ese98
inc
nameres
netapi
access
api
dosprint
inc
messages
netcmd
netdom
netlib
rap
rpcxlate
svcctrl
svcdlls
alrsvc
at
browser
dfs
idl
lls
logonsrv
msgsvc
nwsap
repl
seclogon
srvsvc
upssvc
apcsmart
_defs.h
apc.h
apcdrvr.cxx
apcdrvr.h
apcobj.cxx
apcobj.h
apcsemnt.cxx
apcsemnt.h
apcups.cxx
apcups.def
apcups.h
apcups.rc
attrib.cxx
attrib.h
backups.cxx
backups.h
badbatts.cxx
badbatts.h
batcalt.cxx
batcalt.h
batpacks.cxx
batpacks.h
battcaps.cxx
battcaps.h
battcond.cxx
battcond.h
battmgr.cxx
battmgr.h
battrep.cxx
battrep.h
bypmodes.cxx
bypmodes.h
cdefine.h
cdevice.cxx
cdevice.h
cfgcodes.h
cfgmgr.cxx
cfgmgr.h
chgsensr.cxx
chgsensr.h
codes.h
comctrl.cxx
comctrl.h
contrlr.cxx
contrlr.h
coprites.cxx
coprites.h
cwccons.h
datalog.h
datetime.cxx
datetime.h
dcfrmrev.cxx
dcfrmrev.h
dcomctrl.cxx
dcomctrl.h
devctrl.cxx
devctrl.h
device.cxx
device.h
dispatch.cxx
dispatch.h
eeprom.cxx
eeprom.h
err.h
errlog.h
errlogr.cxx
errlogr.h
event.cxx
event.h
eventime.cxx
eventime.h
evntlog.h
firmman.cxx
firmman.h
firmrevs.cxx
firmrevs.h
icodes.h
isa.h
itemcode.cxx
itemcode.h
list.cxx
list.h
litesnsr.cxx
litesnsr.h
lobatdur.cxx
lobatdur.h
mainapp.cxx
mainapp.h
makefile
manudate.cxx
manudate.h
matrix.cxx
matrix.h
message.cxx
message.h
mutexlck.h
mutexnt.cxx
mutexnt.h
node.cxx
node.h
ntcfgmgr.cxx
ntcfgmgr.h
ntport.cxx
ntsrvap.cxx
ntsrvap.h
ntthrd.cxx
nttimmn.cxx
nttimmn.h
pollparm.cxx
pollparm.h
protlist.cxx
protlist.h
proto.cxx
proto.h
protsimp.cxx
protsimp.h
protsmrt.cxx
protsmrt.h
regdefs.h
replbatt.cxx
replbatt.h
resource.h
runtrems.cxx
runtrems.h
scan.cxx
scan.h
semaphor.h
sensor.cxx
sensor.h
serport.cxx
serport.h
servapp.cxx
servapp.h
shutdel.cxx
shutdel.h
simpsens.h
slist.cxx
slist.h
smart_driver.rc
smartups.cxx
smartups.h
smboosen.cxx
smboosen.h
smrtsens.h
sortable.h
sources
stdcfg.cxx
stream.cxx
stream.h
stsensor.cxx
stsensor.h
sysstate.h
tattrib.cxx
tattrib.h
thrdable.cxx
thrdable.h
thread.h
thsensor.cxx
thsensor.h
timer.cxx
timer.h
timerman.cxx
timerman.h
tokenstr.cxx
tokenstr.h
towdels.cxx
towdels.h
trans.cxx
trans.h
trimsen.cxx
trimsen.h
tripregs.cxx
tripregs.h
turnoff.cxx
turnoff.h
ulinecon.cxx
ulinecon.h
ulinkdef.h
unssens.cxx
unssens.h
update.cxx
update.h
ups.cxx
ups.h
ups2slep.cxx
ups2slep.h
upsdev.cxx
upsdev.h
upsidsen.cxx
upsidsen.h
upsmodl.cxx
upsmodl.h
upsmsgs.h
upsrc.h
upsreg.c
upsreg.h
upssers.cxx
upssers.h
utils.cxx
utils.h
w32utils.cxx
w32utils.h
upsexe
dirs
wkssvc
dirs
svcimgs
xactsrv
dirs
nlrepl
nw
published
safealloca
security
win32
xpress
dirs
project.mk
enduser
inetcore
inetsrv
loc
mergedcomponents
multimedia
net
printscan
public
published
sdktools
shell
termsrv
tools
windows
dirs
makefil0
102 lines
4.7 KiB
C
102 lines
4.7 KiB
C
/*
|
|
* pcy08Jan93: Initial implementation taken from ups.h
|
|
* cad26Aug93: Bypass mode convenience
|
|
* srt02Feb96: Added UPS_STATE_NO_COMMUNICATION
|
|
* djs29Jul96: Added DarkStar states
|
|
* tjg03Dec97: Added bit for IM_NOT_INSTALLED
|
|
*/
|
|
|
|
#ifndef __SYSSTATE_H
|
|
#define __SYSSTATE_H
|
|
|
|
// The System State is implemented as a bit field as follows.
|
|
// Bit 0 - Utility Line Status 0=line good 1=line bad
|
|
// Bit 1 - Battery Status 0=battery good 1=battery bad
|
|
// Bit 2 - SmartBoost 0=smart boost off 1=smart boost on
|
|
// Bit 3 - BatteryCalibration 0=not in progress 1=in progress
|
|
// Bit 4 - BatteryReplacement 0=doesnt need replaceing 1=needs replacing
|
|
// Bit 5 - Self Test 0=not in progress 1=in progress
|
|
// Bit 6 - Line Fail Pending 0=no 1=no
|
|
// Bit 7 - Lights Test 0=not in progress 1=in progress
|
|
// Bit 8 - Overload 0=no overload 1=overload
|
|
// Bit 9 - Abnormal condition 0=no abnormal condition 1=abnormal condition
|
|
// Bit 10 - Shutdown in Progress 0=no abnormal condition 1=abnormal condition
|
|
// Bit 11 - Bypass, Maint. 0=not on bypass 1=on bypass
|
|
// Bit 12 - Bypass, Module Fail. 0=not on bypass 1=on bypass
|
|
// Bit 13 - Bypass, Supply Fail. 0=power supply ok 1=ps failed
|
|
// Bit 14 - Simulate power Fail 0=no simulation 1=simulated
|
|
// Bit 15 - Communications 0=comm ok 1=no comm
|
|
// Bit 16 - SmartTrim 0=smart trim off 1=smart trim on
|
|
// Bit 17 - Bypass Cont Fail. 0=not on bypass 1=on bypass
|
|
// Bit 18 - Redundancy 0=redundnacy ok 1=no redundancy
|
|
// Bit 19 - IM 0=IM ok 1=IM failed
|
|
// Bit 20 - RIM 0=RIM ok 1=RIM failed
|
|
// Bit 21 - IM Installation 0=Installed 1=Not Installed
|
|
// System State values
|
|
//
|
|
|
|
#define LINE_STATUS_BIT 0
|
|
#define BATTERY_STATUS_BIT 1
|
|
#define SMART_BOOST_BIT 2
|
|
#define BATTERY_CALIBRATION_BIT 3
|
|
#define BATTERY_REPLACEMENT_BIT 4
|
|
#define SELF_TEST_BIT 5
|
|
#define LINE_FAIL_PENDING_BIT 6
|
|
#define LIGHTS_TEST_BIT 7
|
|
#define OVERLOAD_BIT 8
|
|
#define ABNORMAL_CONDITION_BIT 9
|
|
#define SHUTDOWN_IN_PROGRESS_BIT 10
|
|
#define BYPASS_MAINT_BIT 11
|
|
#define BYPASS_MODULE_FAILED_BIT 12
|
|
#define BYPASS_SUPPLY_FAILED_BIT 13
|
|
#define SIMULATE_POWER_FAIL_BIT 14
|
|
#define COMMUNICATIONS_BIT 15
|
|
#define SMART_TRIM_BIT 16
|
|
#define BYPASS_CONT_FAILED_BIT 17
|
|
#define REDUNDANCY_LOST_BIT 18
|
|
#define IM_FAILED_BIT 19
|
|
#define RIM_FAILED_BIT 20
|
|
#define IM_NOT_INSTALLED_BIT 21
|
|
|
|
|
|
#define UPS_STATE_ON_BATTERY ( 1 << LINE_STATUS_BIT )
|
|
#define UPS_STATE_BATTERY_BAD ( 1 << BATTERY_STATUS_BIT )
|
|
#define UPS_STATE_ON_BOOST ( 1 << SMART_BOOST_BIT )
|
|
#define UPS_STATE_IN_CALIBRATION ( 1 << BATTERY_CALIBRATION_BIT )
|
|
#define UPS_STATE_BATTERY_NEEDED ( 1 << BATTERY_REPLACEMENT_BIT )
|
|
#define UPS_STATE_IN_SELF_TEST ( 1 << SELF_TEST_BIT )
|
|
#define UPS_STATE_LINE_FAIL_PENDING ( 1 << LINE_FAIL_PENDING_BIT )
|
|
#define UPS_STATE_IN_LIGHTS_TEST ( 1 << LIGHTS_TEST_BIT )
|
|
#define UPS_STATE_OVERLOAD ( 1 << OVERLOAD_BIT )
|
|
#define UPS_STATE_ABNORMAL_CONDITION ( 1 << ABNORMAL_CONDITION_BIT )
|
|
#define SHUTDOWN_IN_PROGRESS ( 1 << SHUTDOWN_IN_PROGRESS_BIT )
|
|
#define UPS_STATE_BYPASS_MAINT ( 1 << BYPASS_MAINT_BIT )
|
|
#define UPS_STATE_BYPASS_MODULE_FAILED ( 1 << BYPASS_MODULE_FAILED_BIT )
|
|
#define UPS_STATE_BYPASS_SUPPLY_FAILED ( 1 << BYPASS_SUPPLY_FAILED_BIT )
|
|
#define UPS_STATE_SIMULATED_POWER_FAIL ( 1 << SIMULATE_POWER_FAIL_BIT )
|
|
#define UPS_STATE_NO_COMMUNICATION ( 1 << COMMUNICATIONS_BIT )
|
|
|
|
// All bit masks greater than bit 15 cannot reliable use bit shifting
|
|
// across all platforms.
|
|
|
|
#define UPS_STATE_ON_TRIM 65536
|
|
#define UPS_STATE_BYPASS_CONT_FAILED 131072
|
|
#define UPS_STATE_LOST_REDUNDANCY 262144
|
|
#define UPS_STATE_IM_FAILED 524288
|
|
#define UPS_STATE_RIM_FAILED 1048576
|
|
#define UPS_STATE_IM_NOT_INSTALLED 2097152
|
|
|
|
|
|
#define UPS_STATE_ANY_BYPASS_MODE (UPS_STATE_BYPASS_MAINT|\
|
|
UPS_STATE_BYPASS_MODULE_FAILED|\
|
|
UPS_STATE_BYPASS_SUPPLY_FAILED)
|
|
|
|
#define UPS_STATE_LOW_BATTERY (UPS_STATE_ON_BATTERY & \
|
|
UPS_STATE_BATTERY_BAD)
|
|
|
|
#define SET_BIT(byte, bitnum) (byte |= ( 1L << bitnum ))
|
|
#define CLEAR_BIT(byte, bitnum) (byte &= ~( 1L << bitnum ))
|
|
#define IS_STATE(state) (theUpsState & (state) ? 1 : 0)
|
|
|
|
#endif
|