I am trying to discover a camera that is on a different subnet (reason is to get macAdress of camera and then force ip inside correct subnet), but no camera is shown.
I tested using BroadcastDiscovery.cpp example from cvb 13.04 for windows
that i then compiled for linux arm.
With this I am able to discover cameras only if they are already in my subnet eg.
my network card has ip 10.0.0.1 (subnet 255.255.255.0) and camera has ip 10.0.0.x
as soon as i force camera ip to 10.0.1.x then it is no more discovered.
this is code I used:
/****************************************************************************
STEMMER IMAGING
----------------------------------------------------------------------------
Program : VCGEVBroadcastDiscovery
Date : 01/2017
Purpose : C++ Console example which shows how to list all GEV devices
seen by a broadcast discovery
Revision : 1.0
****************************************************************************/
#include <iostream>
#include <iomanip>
#include <vector>
#include <iCVCDriver.h>
#include <iCVCImg.h>
#include <iCVGenApi.h>
#include <CVCError.h>
#include <iCVCUtilities.h>
using namespace std;
// function to retrieve information on a discovered node
std::wstring RetriveInfo(ATLIST discoverList, size_t index, DODiscoverInfoCommands cmd)
{
// Inquire the size of the needed buffer to receive the information
size_t sizeBuf = 0;
cvbres_t res = DOEntryGetInfoW(discoverList, index, cmd, NULL, sizeBuf);
if (res < 0)
{
wcout << "Error retrieving info cmd " << cmd << endl;
return std::wstring();
}
// allocate the buffer
sizeBuf+=2;
std::vector<wchar_t> buf(sizeBuf);
// retrieve the information
res = DOEntryGetInfoW(discoverList, index, cmd, const_cast<wchar_t *>(&buf[0]), sizeBuf);
if (res < 0)
{
wcout << "Error retrieving info cmd " << cmd << endl;
return std::wstring();
}
return std::wstring(&buf[0]);
}
void DiscoverOnSingleInterface(const wchar_t *Seed)
{
ATLIST discoverListBCD = NULL;
cvbres_t res = DODiscoverW(Seed,
DO_DISCOVER_FLAG_IGNORE_VINS |
DO_DISCOVER_FLAG_LEVEL_DEVICE |
DO_DISCOVER_FLAG_IGNORE_ACCESS_STATUS,
0, discoverListBCD, 0);
// Retrieve the number of found entries
size_t numEntries = 0;
res = DOGetNumEntries(discoverListBCD, numEntries);
if (res < 0)
{
wcout << "Failure executing discover: " << hex << showbase << res << endl;
return;
}
if (numEntries > 0)
{
wcout << numEntries << " Device(s) found @ Iface-ID: " << RetriveInfo(discoverListBCD, 0, DO_DISCOVER_INFO_INTERFACE_ID).c_str() << endl;
for (size_t devIdx = 0; devIdx < numEntries; devIdx++)
wcout << "\t" << "Device " << devIdx << " -> " << RetriveInfo(discoverListBCD, devIdx, DO_DISCOVER_INFO_DEVICE_ID).c_str() << endl;
wcout << endl;
}
ReleaseObject(discoverListBCD);
}
// entry function
int main(int argc, char* argv[])
{
// Execute a simple discovery
ATLIST discoverList = NULL;
std::wcout << "Execute Discovery" << std::endl;
cvbres_t res = DODiscoverW(L"", DO_DISCOVER_FLAG_IGNORE_VINS | DO_DISCOVER_FLAG_LEVEL_INTERFACE, 0, discoverList, 0);
// Retrieve the number of found entries
size_t numEntries = 0;
res = DOGetNumEntries(discoverList, numEntries);
if (res < 0)
{
wcout << "Failure executing discover: " << hex << showbase << res << endl;
exit(0);
}
// In case there is no device found .. return
if (numEntries == 0)
{
std::wcout << "No device found." << std::endl;
ReleaseObject(discoverList);
exit(0);
}
std::wcout << "Found " << numEntries << " interfaces." << endl;
wcout << std::endl;
for (size_t i = 0 ; i < numEntries; i++)
{
if (RetriveInfo(discoverList, i, DO_DISCOVER_INFO_INTERFACE_TLTYPE).compare(L"GEV") == 0)
{
DOSetFeature(discoverList, i, NMH2_ID_INTERFACE, "Cust::DisableSubnetMatch", "1");
DOSetFeature(discoverList, i, NMH2_ID_INTERFACE, "Cust::AllowBroadcastDiscoveryResponse", "1");
wstring jat = RetriveInfo(discoverList, i, DO_DISCOVER_INFO_ACCESS_TOKEN);
DiscoverOnSingleInterface(jat.c_str());
}
}
wcout << std::endl;
// Free Resources
ReleaseObject(discoverList);
return 0;
}