6 import gnu.io.PortInUseException;
7 import gnu.io.UnsupportedCommOperationException;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired;
17 import java.io.IOException;
35 private String portName;
44 private static final Integer deviceAddress = 6;
49 private static Logger log = LoggerFactory.getLogger(
50 "kernel.models.TDKLambdaPowerSupplyFactory");
73 this.portName = portName;
79 IOException, UnsupportedCommOperationException,
88 writeEntryForSupply(supply);
96 assertPowerSupplyDoesNotExist();
97 writeEntryForNoPowerSupply();
99 kernel.controllers.DeviceRegistry registry = kernel
100 .getDeviceRegistryController();
104 registry.setPowerSupply(supply);
107 private PowerSupply createPowerSupplyInstance()
throws PortInUseException,
108 IOException, UnsupportedCommOperationException
110 SerialPort port = kernel.getPortDriver().getPortByName(this.portName);
119 kernel.getVariableProvidersController().setVoltageProvider(
130 private void assertPowerSupplyDoesNotExist()
throws 135 "A power supply has already been made" 140 private static void writeEntryForNoPowerSupply(){
141 log.debug(
"No Power Supply. Creating a new one");
144 private static void writeEntryForSupply(
PowerSupply supply){
146 String.format(
"Found Power supply %s", supply.toString())
152 public int getStopBits(){
157 public int getBaudRate(){
158 return BAUD_RATE_9600;
162 public int getParityBits(){
167 public int getDataBits(){
PortCommunicator getCommunicator()
void setKernel(Kernel kernel)
PowerSupply getPowerSupply()
void setConfig(PortConfiguration newConfig)
void setPortName(String portName)
PowerSupply getPowerSupply()