com.jpeterson.x10
Interface Transmitter

All Known Implementing Classes:
CM11AGateway, CM17A, CM11A

public interface Transmitter

Implementors of this interface are typically some sort of Gateway that bridge a software model with a physical implmentation. For example, the CM11A object is a gateway between a software representation and the physical X10 powerline interface via a serial connection.


Field Summary
static long QUEUE_EMPTY
          Bit of state that is set when the output queue of a Transmitter is empty.
static long QUEUE_NOT_EMPTY
          Bit of state that is set when the speech output queue of a Transmitter is not empty.
 
Method Summary
 void transmit(X10Event e)
          Transmit an event.
 

Field Detail

QUEUE_EMPTY

public static final long QUEUE_EMPTY
Bit of state that is set when the output queue of a Transmitter is empty. The QUEUE_EMPTY state is a sub-state of the ALLOCATED state. An allocated Transmitter is always in either the QUEUE_NO_EMPTY or QUEUE_EMPTY state.

A Transmitter is always allocated in the QUEUE_EMPTY state. The Transmitter transitions from the QUEUE_EMPTY state to the QUEUE_NOT_EMPTY state when a method places an object on the output queue. A QUEUE_UPDATED event is issued to indicate this change in state.

A Transmitter returns from the QUEUE_NOT_EMPTY state to the QUEUE_EMPTY state once the queue is emptied because of completion of transmitting all objects.

The queue status can be tested with the waitQueueEmpty, getEngineState and testEngineState methods. To block a thread until the queue is empty:

 Transmitter transmitter = ...;
 transmitter.waitGatewayState(QUEUE_EMPTY);
 
See Also:
QUEUE_NOT_EMPTY, ALLOCATED, getGatewayState, waitGatewayState, testGatewayState, QUEUE_UPDATED

QUEUE_NOT_EMPTY

public static final long QUEUE_NOT_EMPTY
Bit of state that is set when the speech output queue of a Transmitter is not empty. The QUEUE_NOT_EMPTY state is a sub-state of the ALLOCATED state. An allocated Transmitter is always in either the QUEUE_NOT_EMPTY or QUEUE_EMPTY state.

A Transmitter enters the QUEUE_NOT_EMPTY from the QUEUE_EMPTY state when the x10Transmission method is called to place an object on the output queue. A QUEUE_UPDATED event is issued to mark this change in state.

A Transmitter returns form the QUEUE_NOT_EMPTY state to the QUEUE_EMPTY state once the queue is emptied because of completion of transmitting all objects.

See Also:
QUEUE_EMPTY, ALLOCATED, getGatewayState, waitGatewayState, testGetwayState, QUEUEU_UPDATED
Method Detail

transmit

public void transmit(X10Event e)
              throws java.io.IOException
Transmit an event. This is typically done by an object that implements a gateway function to some physical media. For example, the CM11A object is a gateway between a software model and the physical X10 network via a serial interface.
Parameters:
X10Event - The event to send.