Support scanning ANSVIS servers device

This commit is contained in:
2026-05-23 18:03:22 +10:00
parent 4678d87e33
commit a2fa2c8ceb
5 changed files with 568 additions and 4 deletions
@@ -386,6 +386,39 @@ int ANSLLMOllamaTest() {
return 0;
}
// Exercise ANSCENTER::ANSUtilities::ScanDevices — discovers AIBOX boxes and
// ANSVIS servers on the local LAN via UDP multicast + HTTP /ServerApi sweep.
// Run on a machine connected to the same subnet as at least one device.
// DebugView (filter "[ANSDISC]") shows per-device hits and per-interface joins.
int ScanDevicesTest()
{
std::cout << "\n===== ScanDevices (AIBOX / ANSVIS discovery) =====" << std::endl;
// 1) Direct static C++ call.
const int timeoutMs = 5000;
std::cout << "Scanning for " << timeoutMs << " ms ..." << std::endl;
auto devices = ANSCENTER::ANSUtilities::ScanDevices(timeoutMs);
std::cout << "Found " << devices.size() << " device(s):" << std::endl;
for (const auto& d : devices) {
const char* src = (d.source == 3) ? "both"
: (d.source == 2) ? "sweep"
: (d.source == 1) ? "multicast"
: "unknown";
std::cout << " " << d.ip
<< " name=\"" << d.name << "\""
<< " firmware=\"" << d.firmware << "\""
<< " source=" << src << std::endl;
}
// 2) Exercise the C extern entrypoint that LabVIEW uses.
std::string json;
int rc = ScanANSDevicesCpp(timeoutMs, json);
std::cout << "\nScanANSDevicesCpp rc=" << rc << " json=" << json << std::endl;
return static_cast<int>(devices.size());
}
int main()
{
//ANSLLMOllamaTest();
@@ -393,11 +426,13 @@ int main()
//std::cout << "===== MinIO (path-style) =====" << std::endl;
//ANSFTechMinIOTest();
std::cout << "\n===== AWS S3 (virtual-host) =====" << std::endl;
ANSAWSTest();
//std::cout << "\n===== AWS S3 (virtual-host) =====" << std::endl;
//ANSAWSTest();
//ANSLLMTest();
//SendEmailExample();
//uploadFileToGoogleStorage();
// EncrypyionExample();
// EncrypyionExample();
ScanDevicesTest();
}