Hi,
I am learning how to use the CVB SDK to create a GigE Vision Server to act as a Virtual Camera to send image over to an image acquisition client.
I am able to successfully use the C# CVB SDK to do so.
However, when trying to replicate the same thing in C++ SDK, I am unable to use the CVB Management Console to discover the Virtual Camera, much less acquiring it.
I used netstat -an -u udp, and is able to see that port 3956 is started by the GEV server. However, CVB management console is not able to discover it.
Below is a snippet of my main C++ code:
*My C++ CVB project can be compiled successfully, and there are no exceptions when running the console application.
Any help or enlightenment on why I am not able to discover the GEV Virtual Camera is appreciated.
int main(int argc, char* argv[])
{
cout << “start gev server\n”;
IMG img;
cvbres_t nResult = LoadImageFile("%CVB%\\Tutorial\\ClassicSwitch.emu", img);
if (nResult < 0)
throw std::exception();
TDriver nDriver = DT_Filter;
m_hGevServer = CreateGevServerEx(nDriver);
// configure server
nResult = GSSetImage(m_hGevServer, img);
if (nResult < 0)
throw std::exception();
// set acquisition mode
TAcquisitionMode acqMode = AM_Automatic;
GSSetAcquisitionMode(m_hGevServer, acqMode);
// register server events
if (IsGevServer(m_hGevServer))
{
GSRegisterEvent(m_hGevServer, SE_Connected, &Empty, NULL, m_nSERemoteEndpointConnectedEventID);
GSRegisterEvent(m_hGevServer, SE_Disconnected, &Empty, NULL, m_nSERemoteEndpointDisconnectedEventID);
GSRegisterEvent(m_hGevServer, SE_AcquisitionStart, &Empty, NULL, m_nSEAcquisitionStartEventID);
GSRegisterEvent(m_hGevServer, SE_AcquisitionStop, &Empty, NULL, m_nSEAcquisitionStopEventID);
GSRegisterEvent(m_hGevServer, SE_ImageSnapped, &Empty, NULL, m_nSENewImageEventID);
}
// add custom feature in category
AddGenICamFeatures();
// set custom version/id
nResult = GSSetInfoAsString(m_hGevServer, GSI_ServerUserVersion, "_C++-Example");
if (nResult < 0) throw std::exception();
nResult = GSSetInfoAsInteger(m_hGevServer, GSI_XMLVersionMajor, 1);
if (nResult < 0) throw std::exception();
nResult = GSSetInfoAsInteger(m_hGevServer, GSI_XMLVersionMinor, 0);
if (nResult < 0) throw std::exception();
nResult = GSSetInfoAsInteger(m_hGevServer, GSI_XMLVersionSubMinor, 0);
if (nResult < 0) throw std::exception();
// start server
std::vector<gsipv4> m_Interfaces;
GEVIFACELIST ifaceList = CreateInterfaceList();
size_t nIfaces = ILCount(ifaceList);
for (size_t nIndex = 0; nIndex < nIfaces; ++nIndex)
{
// add IP to interfaces list
gsipv4 nIP = 0;
ILIPv4Address(ifaceList, nIndex, nIP);
m_Interfaces.push_back(nIP);
}
gsipv4 nIP = m_Interfaces[2]; //for 172.29.54.161
nResult = GSStartIPv4(m_hGevServer, nIP);
if (nResult < 0)
throw std::exception();
cout << "gev server started " << nResult << "\n";
while (true)
{
}
return 0;
}