|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectBasicDrinkMachine
FakeDrinkMachine
A DrinkMachineSpec implementation designed to simulate the environment drink would run in when on the TINI to allow for testing on any machine. Most methods return false data or do nothing.
| Nested Class Summary | |
private class |
FakeDrinkMachine.ButtonLoop
A private class to do the callbacks for the buttons. |
| Field Summary | |
private Object |
bus
The 'bus' object that is used to communicate to the hardware with. |
private FakeDrinkMachine.ButtonLoop |
buttonloop
The inner class that handles Button Event processing and dispatching. |
private ConfigMgr |
configMgr
The object that we use to manipulate the configuration database. |
private Vector |
drinkButtonListeners
The Vector of objects that want to be notified of button events. |
private DrinkLoggerSpec |
log
The Object that we send our log messages to. |
| Fields inherited from class BasicDrinkMachine |
numSlots, slotArray, slotDataFileName, slotMgr |
| Constructor Summary | |
FakeDrinkMachine(ConfigMgr _configMgr,
DrinkLoggerSpec _log)
Takes a string for the configfile to user. |
|
| Method Summary | |
void |
addDrinkButtonListener(DrinkButtonListener dbl)
Adds a listener to the list of objects requesting callbacks from the buttons. |
private void |
calcTemp(String addie)
Pretends to tell a temperature sensor to calculate its current temperature. |
void |
delDrinkButtonListener(DrinkButtonListener dbl)
Removes a listen from the list of objects requesting callbacks from the buttons. |
String |
drop(int slot)
Drops a drink by pretending to activate the appropriate one-wire switches |
private Float |
getTemp(String addie)
Pretends to fetch the temperature of a temperature sensor. |
Float |
getTempKey(String key)
Returns the celsius temperature of a temperature sensor, given the name of the temp sensor. |
void |
lightOff(int slot)
Pretends to turn a slots (empty) light off |
void |
lightOn(int slot)
Pretends to turn a slots (empty) light on. |
void |
shutdown(boolean reboot)
Shuts down the entire system. |
Vector |
slotTemp(int slot)
Returns a Vector of Float objects that represent the temperatures of a given slot. |
float |
slotTempAvg(int slot)
Returns a primitive float (not Float) for the average slot temp or -127 if there is no data available. |
private boolean |
toggle(String addie)
Pretends to toggles the one-wire device indicated by the given address The address is just printed to standard error, and the method always returns true. |
long |
uptime()
Pretends to return the TINI's uptime. |
| Methods inherited from class BasicDrinkMachine |
drinksDropped, drinksLeft, formatSlotLine, getDrinkNames, getName, getNumSlots, getPrice, getSlot, getSlotArray, getSlotPrintout, isEnabled, setSlot |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Vector drinkButtonListeners
private FakeDrinkMachine.ButtonLoop buttonloop
private Object bus
private DrinkLoggerSpec log
private ConfigMgr configMgr
| Constructor Detail |
public FakeDrinkMachine(ConfigMgr _configMgr,
DrinkLoggerSpec _log)
throws IOException
_configMgr - The ConfigMgr to use._log - The DrinkLoggerSpec to use| Method Detail |
public void shutdown(boolean reboot)
shutdown in interface DrinkMachineSpecshutdown in class BasicDrinkMachinereboot - Ignored.TINIDrinkMachine.shutdown(boolean)public long uptime()
uptime in interface DrinkMachineSpecuptime in class BasicDrinkMachinepublic String drop(int slot)
drop in interface DrinkMachineSpecdrop in class BasicDrinkMachineslot - The slot to drop
public void lightOn(int slot)
lightOn in interface DrinkMachineSpeclightOn in class BasicDrinkMachineslot - The slot/drink/button associated with the light.lightOff(int)public void lightOff(int slot)
lightOff in interface DrinkMachineSpeclightOff in class BasicDrinkMachineslot - The slot associated with the lightlightOn(int)public Float getTempKey(String key)
getTempKey in interface DrinkMachineSpecgetTempKey in class BasicDrinkMachinekey - The name (key) of the temp sensor to query.
public Vector slotTemp(int slot)
slotTemp in interface DrinkMachineSpecslotTemp in class BasicDrinkMachineslot - The slot index associated with the temperature sensor
getTempKey(String)public float slotTempAvg(int slot)
slotTempAvg in interface DrinkMachineSpecslotTempAvg in class BasicDrinkMachineslot - The slot to determine the average temperature
public void addDrinkButtonListener(DrinkButtonListener dbl)
addDrinkButtonListener in interface DrinkMachineSpecaddDrinkButtonListener in class BasicDrinkMachinedbl - The DrinkButtonListener to add.public void delDrinkButtonListener(DrinkButtonListener dbl)
delDrinkButtonListener in interface DrinkMachineSpecdelDrinkButtonListener in class BasicDrinkMachinedbl - The DrinkButtonListener to removeprivate boolean toggle(String addie)
addie - The address to pretend to toggle
private void calcTemp(String addie)
addie - The address of the temperature sensor to poke.
private Float getTemp(String addie)
throws Exception
addie - The address of the temperature sensor to read.
Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||