diff --git a/build b/build index 565f1b0..f937f7e 100644 --- a/build +++ b/build @@ -1 +1 @@ -231 \ No newline at end of file +233 \ No newline at end of file diff --git a/src/AutoDiscovery.cpp b/src/AutoDiscovery.cpp index 8e613df..f2b1e82 100644 --- a/src/AutoDiscovery.cpp +++ b/src/AutoDiscovery.cpp @@ -58,7 +58,7 @@ namespace OpenWifi { } } if(!SerialNumber.empty()) { - std::cout << "SerialNUmber: " << SerialNumber << " CID: " << ConnectedIP << " DeviceType: " << DeviceType << std::endl; + // std::cout << "SerialNUmber: " << SerialNumber << " CID: " << ConnectedIP << " DeviceType: " << DeviceType << std::endl; Storage()->InventoryDB().CreateFromInventory(SerialNumber,ConnectedIP,DeviceType); } } diff --git a/src/orm.h b/src/orm.h index 231f3b7..5113214 100644 --- a/src/orm.h +++ b/src/orm.h @@ -407,8 +407,6 @@ namespace ORM { (Where.empty() ? "" : " where " + Where) + ComputeRange(Offset, HowMany) ; - // std::cout << "GetRecords: " << St << std::endl; - Select << St , Poco::Data::Keywords::into(RL); diff --git a/src/storage_inventory.cpp b/src/storage_inventory.cpp index 4545088..f817f0c 100644 --- a/src/storage_inventory.cpp +++ b/src/storage_inventory.cpp @@ -73,22 +73,19 @@ namespace OpenWifi { NewDevice.info.notes.push_back(SecurityObjects::NoteInfo{.created=Now,.createdBy="*system",.note="Auto discovered"}); NewDevice.serialNumber = SerialNumber; NewDevice.deviceType = DeviceType; - std::string UUID; if(!IP.empty()) { - Storage()->VenueDB().GetByIP(IP,UUID); - if(!UUID.empty()) { - NewDevice.venue = UUID; - } else { - Storage()->EntityDB().GetByIP(IP,UUID); - NewDevice.entity = UUID; + Storage()->VenueDB().GetByIP(IP,NewDevice.venue); + if(NewDevice.venue.empty()) { + Storage()->EntityDB().GetByIP(IP,NewDevice.entity); } } if(CreateRecord(NewDevice)) { - std::cout << "Added " << SerialNumber << " to DB with IP=" << IP << " and UUID=" << UUID << std::endl; - if(!IP.empty()) { - Logger().information(Poco::format("Adding %s to inventory.",SerialNumber)); - } + if(!NewDevice.entity.empty()) + Storage()->EntityDB().AddDevice("id",NewDevice.entity,NewDevice.info.id); + else if(!NewDevice.venue.empty()) + Storage()->VenueDB().AddDevice("id",NewDevice.venue,NewDevice.info.id); + Logger().information(Poco::format("Adding %s to inventory.",SerialNumber)); return true; } else { Logger().information(Poco::format("Could not add %s to inventory.",SerialNumber)); diff --git a/src/storage_venue.cpp b/src/storage_venue.cpp index 0a13a3f..0daf2c5 100644 --- a/src/storage_venue.cpp +++ b/src/storage_venue.cpp @@ -87,8 +87,6 @@ namespace OpenWifi { }; Iterate(Function); uuid=UUID; - if(!uuid.empty()) - std::cout << "Found venue: " << uuid << std::endl; } catch (const Poco::Exception &E) { Logger().log(E); }