git-svn-id: svn://db.shs.com.ru/pip@673 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-12-18 19:13:09 +00:00
parent 5df8ae18a3
commit 8d37dc453e
9 changed files with 157 additions and 29 deletions

View File

@@ -20,6 +20,7 @@
#include "piserial.h"
#include "piconfig.h"
#include "pidir.h"
#include "pipropertystorage.h"
#include <errno.h>
#ifdef WINDOWS
# include <winreg.h>
@@ -716,6 +717,28 @@ void PISerial::configureFromFullPathDevice(const PIString & full_path) {
}
PIPropertyStorage PISerial::constructVariantDevice() const {
PIPropertyStorage ret;
ret.addProperty("path", path());
ret.addProperty("speed", (int)inSpeed());
ret.addProperty("bits", dataBitsCount());
ret.addProperty("parity", parameters()[ParityControl]);
ret.addProperty("parityEven", !parameters()[ParityOdd]);
ret.addProperty("twoStopBits", parameters()[TwoStopBits]);
return ret;
}
void PISerial::configureFromVariantDevice(const PIPropertyStorage & d) {
setPath(d.propertyValueByName("path").toString());
setSpeed((Speed)d.propertyValueByName("speed").toInt());
setDataBitsCount(d.propertyValueByName("bits").toInt());
setParameter(ParityControl, d.propertyValueByName("parity").toBool());
setParameter(ParityOdd , !d.propertyValueByName("parityEven").toBool());
setParameter(TwoStopBits , d.propertyValueByName("twoStopBits").toBool());
}
PIVector<int> PISerial::availableSpeeds() {
PIVector<int> spds;
spds << 50 << 75 << 110 << 300 << 600 << 1200 << 2400 << 4800 <<