com.jpeterson.x10.module
Class CM11AStandardTransmission
java.lang.Object
|
+--com.jpeterson.x10.module.CM11AStandardTransmission
- Direct Known Subclasses:
- CM11AMacroDownloadTransmission, CM11AX10EventTransmission
- public class CM11AStandardTransmission
- extends java.lang.Object
- implements CM11ATransmissionEvent
Create a standard CM11 transmission event to transmit. Standard
transmission events are transmitted to the CM11 by a protocol
that provides safeguards to ensure that the message is sent
to the CM11 device correctly. The safeguards implemeted are
a checksum algorythm.
Field Summary |
protected byte[] |
packet
|
Constructor Summary |
CM11AStandardTransmission(byte[] packet)
Create a standard CM11 transmission event to transmit the specified
packet of bytes. |
Method Summary |
protected byte |
getChecksum()
Retrieve the checksum of the bytes in the message or the X10
transmission. |
int |
getNumAttempts()
Retrieve the number of transmission attempts. |
void |
setMaxAttempts(int maxAttempts)
Set the number of transmission attempts |
java.lang.String |
toString()
Create a string representation of the transmission. |
void |
transmit(java.io.InputStream in,
java.io.OutputStream out)
Transmit a standard CM11 command from the PC to the CM11 interface. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
packet
protected byte[] packet
CM11AStandardTransmission
public CM11AStandardTransmission(byte[] packet)
- Create a standard CM11 transmission event to transmit the specified
packet of bytes.
- Parameters:
packet
- The packet of bytes to transmit to the CM11 interface
transmit
public void transmit(java.io.InputStream in,
java.io.OutputStream out)
throws TooManyAttemptsException,
InterruptedTransmissionException,
java.io.EOFException,
java.io.IOException
- Transmit a standard CM11 command from the PC to the CM11 interface.
The standard transmission sends a packet of bytes, receives a
checksum, validates the checksum, then recieves a transmission
success message from the interface indicating successful completion
of the transmission. If validation of the checksum or reception
of a transmission success message fails, the transmission is retried.
- Specified by:
- transmit in interface CM11ATransmissionEvent
- Parameters:
in
- Input stream to read fromout
- Output stream to write to- Throws:
- TooManyAttemptsException - Too many retries have occurred
- InterruptedTransmissionException - An unsolicited interrupt
has been received during the transmission.
- java.io.IOException - Some sort of I/O or I/O protocol error has
occurred
getChecksum
protected byte getChecksum()
- Retrieve the checksum of the bytes in the message or the X10
transmission.
- Returns:
- the checksum
getNumAttempts
public int getNumAttempts()
- Retrieve the number of transmission attempts.
- Specified by:
- getNumAttempts in interface CM11ATransmissionEvent
- Returns:
- the number of transmission attempts
setMaxAttempts
public void setMaxAttempts(int maxAttempts)
- Set the number of transmission attempts
- Specified by:
- setMaxAttempts in interface CM11ATransmissionEvent
- Parameters:
maxAttempts
- the maximum number of transmission attempts
toString
public java.lang.String toString()
- Create a string representation of the transmission.
- Overrides:
- toString in class java.lang.Object
- Returns:
- String representation of the transmission.