Wait on the correct netid for the correct time for serial numbers

Serial number decoding not implemented yet
This commit is contained in:
Paul Hollinsky
2018-09-24 18:54:45 -04:00
parent da4d9e46be
commit 6284223650
4 changed files with 14 additions and 10 deletions
+6 -1
View File
@@ -122,6 +122,9 @@ bool Device::open() {
if(!com)
return false;
if(settings)
settings->refresh();
return com->open();
}
@@ -129,12 +132,14 @@ bool Device::close() {
if(!com)
return false;
settings = nullptr;
return com->close();
}
bool Device::goOnline() {
std::string serial;
while(!com->getSerialNumberSync(serial, std::chrono::milliseconds(500))) {
while(!com->getSerialNumberSync(serial)) {
std::cout << "Serial number not here yet" << std::endl;
}
+3 -5
View File
@@ -13,13 +13,11 @@ class IDeviceSettings {
public:
static uint16_t CalculateGSChecksum(const std::vector<uint8_t>& settings);
IDeviceSettings(std::shared_ptr<Communication> com) : com(com) {
refresh();
}
IDeviceSettings(std::shared_ptr<Communication> com) : com(com) {}
virtual void refresh();
virtual void commit() = 0;
//virtual void commit() = 0;
virtual void* getStructure() { return settings.data(); }
virtual bool setBaudrate(int baud) = 0;
//virtual bool setBaudrate(int baud) = 0;
protected:
bool settingsLoaded = false;
std::vector<uint8_t> settings;