Fix throw error in udp, fix default SPI device (#198)

* Fix throw error so it correctly fails on invalid output hostnames

* Fixed broken default /dev/spidev0.0 string

* UDP devices now use "host" and "port" rather than "output"
This commit is contained in:
penfold42 2016-08-24 14:05:00 +10:00 committed by redPanther
parent 2cc107842a
commit cea4db8e60
2 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ LedSpiDevice::~LedSpiDevice()
bool LedSpiDevice::setConfig(const Json::Value &deviceConfig)
{
_deviceName = deviceConfig.get("output","/dev/spidev.0.0").asString();
_deviceName = deviceConfig.get("output","/dev/spidev0.0").asString();
_baudRate_Hz = deviceConfig.get("rate",1000000).asInt();
_latchTime_ns = deviceConfig.get("latchtime",0).asInt();
_spiMode = deviceConfig.get("spimode",SPI_MODE_0).asInt();

View File

@ -30,10 +30,10 @@ LedUdpDevice::~LedUdpDevice()
bool LedUdpDevice::setConfig(const Json::Value &deviceConfig)
{
QHostInfo info = QHostInfo::fromName( QString::fromStdString(deviceConfig["output"].asString()) );
QHostInfo info = QHostInfo::fromName( QString::fromStdString(deviceConfig["host"].asString()) );
if (info.addresses().isEmpty())
{
throw("invalid target address");
throw std::runtime_error("invalid target address");
}
_address = info.addresses().first();
_port = deviceConfig["port"].asUInt();