|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.sim.Device<java.lang.Integer>
jmce.sim.Serial
jmce.sim.serial.PolledSerial
public abstract class PolledSerial
Abstract base class for serial polled device.
This base class is used for all Serial implemented in polling mode. One thread is created for each port and the sub class must implements only the method relative to the connection of the port. When connected automatically thru Input/Output stream this class delivery the data to and from the device.
Field Summary | |
---|---|
protected boolean |
connected
|
protected java.io.InputStream |
is
Input stream |
protected java.io.OutputStream |
os
Output stream |
protected long |
rcvd
|
protected long |
sent
|
Fields inherited from class jmce.sim.AbstractPeripheral |
---|
cpu |
Constructor Summary | |
---|---|
PolledSerial()
|
Method Summary | |
---|---|
protected void |
close()
Close the input and output stream and set the connection to false. |
protected abstract void |
connect()
Implemented by sub class. |
void |
consume(java.lang.Integer c)
Receive data from the input device if the device is connected the data are delivery to the output stream. |
protected void |
delay(int delay)
Wait for the specified number of ms. |
void |
init(Hardware parent)
Initialize the hardware. |
void |
run()
Thread to handle the connection and the input stream. |
Methods inherited from class jmce.sim.Serial |
---|
print, println, println, putchar |
Methods inherited from class jmce.sim.Device |
---|
addInputConsumer, addInputProducer, addOutputConsumer, addOutputProducer, getConnected, read, readOutput, readyRead, readyReadOutput, readyWrite, removeInputConsumer, removeOutputConsumer, setConnected, write, writeInput |
Methods inherited from class jmce.sim.AbstractPeripheral |
---|
idle, registerCPU, setIdle, setLive |
Methods inherited from class jmce.sim.AbstractHardware |
---|
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jmce.sim.Hardware |
---|
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
Field Detail |
---|
protected long sent
protected long rcvd
protected boolean connected
protected java.io.InputStream is
protected java.io.OutputStream os
Constructor Detail |
---|
public PolledSerial()
Method Detail |
---|
public void consume(java.lang.Integer c) throws SIMException
consume
in interface DeviceConsumer<java.lang.Integer>
SIMException
public void init(Hardware parent) throws SIMException
Hardware
init
in interface Hardware
init
in class AbstractHardware
parent
- Parent of this hardware.
SIMException
protected void delay(int delay)
protected void close()
public final void run()
run
in interface java.lang.Runnable
protected abstract void connect() throws java.lang.Exception
Must set the stream to the appropriated value and set connected true.
java.lang.Exception
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |