mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Examples: Add more error reporting
This commit is contained in:
committed by
Kyle Schwarz
parent
c466d75dae
commit
5620c98eda
@@ -14,6 +14,13 @@ int main() {
|
||||
auto devices = icsneo::FindAllDevices(); // This is type std::vector<std::shared_ptr<icsneo::Device>>
|
||||
std::cout << "OK, " << devices.size() << " device" << (devices.size() == 1 ? "" : "s") << " found" << std::endl;
|
||||
|
||||
if(devices.empty()) {
|
||||
auto lastError = icsneo::GetLastError();
|
||||
if(lastError.getType() != icsneo::APIEvent::Type::NoErrorFound)
|
||||
std::cout << lastError << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// List off the devices
|
||||
for(auto& device : devices)
|
||||
std::cout << '\t' << device->describe() << " @ Handle " << device->getNeoDevice().handle << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user