dea.hc.jds
Class TimeCommanderPlus

java.lang.Object
  extended bydea.hc.jds.TimeCommanderPlus
All Implemented Interfaces:
Icontroller, IDebugLevels

public class TimeCommanderPlus
extends java.lang.Object
implements IDebugLevels, Icontroller

Title: Time Commander Plus Connector class
Description: Class for talking to the TimeCommander Plus via queue classes.
Copyright: Copyright (c) 2005
Company: RMRR

@author David Abigt
@version 1.0


Field Summary
static int CMD_BRIGHT
           
static int CMD_DIM
           
static int CMD_LIGHTS_OFF
           
static int CMD_LIGHTS_ON
           
static int CMD_MOTION_DET
           
static int CMD_OFF
           
static int CMD_ON
           
static int CMD_UNITS_OFF
           
static int CMD_WAIT
          millisecs to wait between sending commands
static char HC_OFFSET
           
static int VAL_OFF
           
static int VAL_ON
           
static int[] XCODES
          House code (stored at index = code - HC_OFFSET) and unit code as in C=3=0x04
 
Fields inherited from interface dea.common.IDebugLevels
BASIC, DEBUG_ALL, ERROR, METH_DETAIL, METH_ENTER, METH_EXIT, METH_EXT, METH_GET, METH_SET, METH_VARS, SHOW_PASS
 
Fields inherited from interface dea.hc.Icontroller
DEV_ANY, DEV_LIGHT
 
Constructor Summary
TimeCommanderPlus()
           
 
Method Summary
 java.lang.String getInfo(java.lang.String cmd, java.lang.String endKey)
          Send command to controller and read reply.
 boolean isLive()
          Returns true if the class can send commands and read directly from a controller.
static void main(java.lang.String[] args)
          Just for testing
 java.lang.String readStatus()
          get controller status
format is:
Ver 2.28
Sched Name: JUSTRAIN
Schedule status: running
02/12/05 22:42:45
Sunrise: 8:35 Sunset: 19:30
Lat: 33, Lon: 117, DST: 0
Mem Use = 7%
Refresh value: 15
Security seed: 15
Answer on Ring: 0
IO Status
1111111
12345678 90123456
-------- --------
Opto 00100110 00000000
Relay 00000000

Analog 1 2 3 4 5 6 7 8
030 076 081 079 073 073 039 067
##0
 java.lang.String readTime()
          read controller clock
 void sendCmd(java.lang.String cmd)
          Send a command but don't read reply
 void sendX10(char hc, int unit, int val)
          BRIGHT and DIM not currently supported
todo: add them
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XCODES

public static final int[] XCODES
House code (stored at index = code - HC_OFFSET) and unit code as in C=3=0x04


CMD_WAIT

public static final int CMD_WAIT
millisecs to wait between sending commands

See Also:
Constant Field Values

HC_OFFSET

public static final char HC_OFFSET
See Also:
Constant Field Values

VAL_ON

public static final int VAL_ON
See Also:
Constant Field Values

VAL_OFF

public static final int VAL_OFF
See Also:
Constant Field Values

CMD_ON

public static final int CMD_ON
See Also:
Constant Field Values

CMD_OFF

public static final int CMD_OFF
See Also:
Constant Field Values

CMD_DIM

public static final int CMD_DIM
See Also:
Constant Field Values

CMD_BRIGHT

public static final int CMD_BRIGHT
See Also:
Constant Field Values

CMD_LIGHTS_ON

public static final int CMD_LIGHTS_ON
See Also:
Constant Field Values

CMD_LIGHTS_OFF

public static final int CMD_LIGHTS_OFF
See Also:
Constant Field Values

CMD_UNITS_OFF

public static final int CMD_UNITS_OFF
See Also:
Constant Field Values

CMD_MOTION_DET

public static final int CMD_MOTION_DET
See Also:
Constant Field Values
Constructor Detail

TimeCommanderPlus

public TimeCommanderPlus()
                  throws UnsupportedCommOperationException
Method Detail

isLive

public boolean isLive()
Description copied from interface: Icontroller
Returns true if the class can send commands and read directly from a controller. Retunrs false if only interacts with the DB.

Specified by:
isLive in interface Icontroller
Returns:
boolean

readTime

public java.lang.String readTime()
read controller clock

Specified by:
readTime in interface Icontroller
Returns:
String with the time the Time Commander is set to.

readStatus

public java.lang.String readStatus()
get controller status
format is:
Ver 2.28
Sched Name: JUSTRAIN
Schedule status: running
02/12/05 22:42:45
Sunrise: 8:35 Sunset: 19:30
Lat: 33, Lon: 117, DST: 0
Mem Use = 7%
Refresh value: 15
Security seed: 15
Answer on Ring: 0
IO Status
1111111
12345678 90123456
-------- --------
Opto 00100110 00000000
Relay 00000000

Analog 1 2 3 4 5 6 7 8
030 076 081 079 073 073 039 067
##0

Specified by:
readStatus in interface Icontroller
Returns:
Sting containing status of Time Commander

getInfo

public java.lang.String getInfo(java.lang.String cmd,
                                java.lang.String endKey)
Send command to controller and read reply.
This is really a major hack to try and make sure you get something from the controller. We send the command and wait up to 5 secs for a response. If we get nothing or the AT S0= line then we resend the command up to 5 times since the controller does not seem to always respond. If endKey is provided we keep resetting the retries back to zero (on each good line received), without clearing the buffer, till we get it.

Specified by:
getInfo in interface Icontroller
Parameters:
cmd -
Returns:
the reply from the Time Commander

sendX10

public void sendX10(char hc,
                    int unit,
                    int val)
BRIGHT and DIM not currently supported
todo: add them

Specified by:
sendX10 in interface Icontroller
Parameters:
hc -
unit -
val -

sendCmd

public void sendCmd(java.lang.String cmd)
Send a command but don't read reply

Specified by:
sendCmd in interface Icontroller
Parameters:
cmd -

main

public static void main(java.lang.String[] args)
Just for testing

Parameters:
args -


Copyright © 2001-2005 Round Mountain Rescue Ranch. All Rights Reserved.