Skip to content

Commit c0a8802

Browse files
authored
Merge pull request #113 from open-ephys-plugins/issue-109
Added check for when hub IDs are not known
2 parents f88cb56 + 88565c1 commit c0a8802

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Source/OnixSource.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,16 @@ bool OnixSource::initializeDevices(device_map_t deviceTable, bool updateStreamIn
401401
return false;
402402
}
403403
}
404+
else
405+
{
406+
Onix1::showWarningMessageBoxAsync(
407+
"Unkown Hub ID",
408+
"Discovered hub ID " + std::to_string(hubId) + " (" + onix_hub_str(hubId) + ") on " + OnixDevice::getPortName(hubIndex) + " which does not match any currently implemented hubs."
409+
);
410+
devicesFound = false;
411+
sources.clear();
412+
return false;
413+
}
404414
}
405415

406416
// NB: Search for passthrough devices, and initialize any headstages found in passthrough mode
@@ -416,7 +426,7 @@ bool OnixSource::initializeDevices(device_map_t deviceTable, bool updateStreamIn
416426

417427
auto EEPROM = std::make_unique<HeadStageEEPROM>(index, context);
418428
uint32_t hsid = EEPROM->GetHeadStageID();
419-
LOGD("Detected headstage ", hsid);
429+
LOGD("Detected headstage ", onix_hub_str(hsid));
420430

421431
if (hsid == ONIX_HUB_HSNP2E)
422432
{
@@ -484,6 +494,16 @@ bool OnixSource::initializeDevices(device_map_t deviceTable, bool updateStreamIn
484494

485495
hubNames.insert({ OnixDevice::getOffset(polledBno->getDeviceIdx()), NEUROPIXELSV1E_HEADSTAGE_NAME });
486496
}
497+
else
498+
{
499+
Onix1::showWarningMessageBoxAsync(
500+
"Unkown Hub ID",
501+
"Discovered hub ID " + std::to_string(hsid) + " (" + onix_hub_str(hsid) + ") on " + OnixDevice::getPortName(OnixDevice::getHubIndexFromPassthroughIndex(index)) + " which does not match any currently implemented hubs."
502+
);
503+
devicesFound = false;
504+
sources.clear();
505+
return false;
506+
}
487507
}
488508
}
489509

0 commit comments

Comments
 (0)