|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectBasicDrinkMachine
TINIDrinkMachine
Implements the DrinkMachineSpec interface for TINI-based hardware.
| Nested Class Summary | |
private class |
TINIDrinkMachine.ButtonLoop
A class to independantly handle the callbacks for the buttons. |
| Field Summary | |
private TINIExternalAdapter |
bus
The bus that we use to communicate to the TINI one-wire devices with. |
private ConfigMgr |
configMgr
The object we pull our configuration values from. |
private Vector |
drinkButtonListeners
The objects that want button events. |
private boolean[] |
lightStatus
The status's of the lights. |
private DrinkLoggerSpec |
log
The class we send all of our log information to. |
static int |
NUMRETRIES
|
static int |
POWERDOWNTIME
|
static int |
SLEEPTIME
The amount to run the slot motor for. |
| Fields inherited from class BasicDrinkMachine |
numSlots, slotArray, slotDataFileName, slotMgr |
| Constructor Summary | |
TINIDrinkMachine(ConfigMgr _configMgr,
DrinkLoggerSpec _log)
Construct the TINIDrinkMachine by saving the passed in parameters and reading in a few variables. |
|
| Method Summary | |
void |
addDrinkButtonListener(DrinkButtonListener dbl)
Add a listener to the list of objects requesting callbacks from the buttons |
private void |
calcTemp(String addie)
Tells the one-wire temperature sensor to begin calculating its temperature. |
void |
delDrinkButtonListener(DrinkButtonListener dbl)
Remove a listener from the list of objects requesting callbacks from the buttons |
String |
drop(int slot)
Drops a drink. |
TINIExternalAdapter |
getBus()
Returns the one-wire bus that is used by this TINIDrinkMachine |
private Float |
getTemp(String addie)
Retrieves the temperature from the temp sensor. |
Float |
getTempKey(String key)
Returns a Float object representing the temperature of the sensor specified by the key. |
void |
lightOff(int slot)
Turns the given slots [empty] light off. |
void |
lightOn(int slot)
Turns the given slots [empty] light on. |
private int |
readSwitch(String addie)
Reads the state of a one-wire switch. |
private boolean |
setSwitch(String addie,
boolean state)
Toggles the one-wire device on or off. |
void |
shutdown(boolean reboot)
Shuts down the drink server, but not the TINI. |
Vector |
slotTemp(int slot)
Returns a Vector of Float's, one for each temp sensor associated with the given slot. |
float |
slotTempAvg(int slot)
Returns the average temperature of the temp sensors listed for the given slot. |
long |
uptime()
Returns the uptime, in milliseconds. |
| 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 TINIExternalAdapter bus
private Vector drinkButtonListeners
private DrinkLoggerSpec log
private boolean[] lightStatus
private ConfigMgr configMgr
public static final int SLEEPTIME
public static final int POWERDOWNTIME
public static final int NUMRETRIES
| Constructor Detail |
public TINIDrinkMachine(ConfigMgr _configMgr,
DrinkLoggerSpec _log)
throws IOException
_configMgr - The ConfigMgr to use for config options._log - The DrinkLoggerSpec to use for printing log messages.| Method Detail |
public void shutdown(boolean reboot)
shutdown in interface DrinkMachineSpecshutdown in class BasicDrinkMachinereboot - If true, reboot the TINI.public long uptime()
uptime in interface DrinkMachineSpecuptime in class BasicDrinkMachinepublic TINIExternalAdapter getBus()
public String drop(int slot)
drop in interface DrinkMachineSpecdrop in class BasicDrinkMachineslot - The index of the slot to drop. The index is zero based.
private int readSwitch(String addie)
addie - The 64-bit address of the switch
private boolean setSwitch(String addie,
boolean state)
addie - The address of the switch to set.state - The state to set the switch to.
public void lightOn(int slot)
lightOn in interface DrinkMachineSpeclightOn in class BasicDrinkMachineslot - The slot index associated with the light to turn on.(int)public void lightOff(int slot)
lightOff in interface DrinkMachineSpeclightOff in class BasicDrinkMachineslot - The slot associated with the light to turn off.BasicDrinkMachine.lightOn(int)public Vector slotTemp(int slot)
slotTemp in interface DrinkMachineSpecslotTemp in class BasicDrinkMachineslot - The slot to retrieve the temp's of the sensors for.
public float slotTempAvg(int slot)
slotTempAvg in interface DrinkMachineSpecslotTempAvg in class BasicDrinkMachineslot - The slot to retrieve the average temperature for.
public Float getTempKey(String key)
getTempKey in interface DrinkMachineSpecgetTempKey in class BasicDrinkMachinekey - The sensors mnemonic key.
private void calcTemp(String addie)
addie - The address of the sensor to poke.getTemp( String )
private Float getTemp(String addie)
throws Exception
addie - The address of the sensor to retrieve.
Exceptionpublic void addDrinkButtonListener(DrinkButtonListener dbl)
addDrinkButtonListener in interface DrinkMachineSpecaddDrinkButtonListener in class BasicDrinkMachinedbl - The DrinkButtonListener to add to the list.delDrinkButtonListener( DrinkButtonListener )public void delDrinkButtonListener(DrinkButtonListener dbl)
delDrinkButtonListener in interface DrinkMachineSpecdelDrinkButtonListener in class BasicDrinkMachinedbl - The DrinkButtonListener to remove.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||