|
|
When specifying the needed include files we have included the gxsdldr.cpp loader file directly:
#include <stdio.h> #include <iostream> #include <iomanip> #include "gxsd.h" #include "gxsdldr.cpp"
Specifying the used namespaces:
gx for to reach the API functions if the GX_NAMESPACES define is globally setstd for the display functions
/* Specifying the used namespaces */ #ifdef GX_NAMESPACES using namespace gx; #endif using namespace std;
Starting the main function:
int main(void) { try {
Getting the device list:
gxDeviceInfo filter; vector<gxDeviceInfo> devices = gxSystem::ListDevices(0, filter);
If no devices found then displaying message and ending the sample program:
if(devices.size() == 0) {
wcout << L"No GX devices." << endl;
return 0;
}
If one or more devices found then displaying general informations and ending the sample program:
wcout << L"GX devices in the system:\n";
for(size_t i = 0; i < devices.size(); i++) {
wcout << i+1 << L". Name: " << devices[i].GetName() << \
L", Type: " << devices[i].GetType() << \
L", Serial: " << devices[i].GetSerial() << \
L", Prio: " << devices[i].GetPriority() << endl;
}
wcout << L"Found " << devices.size() << L" devices." << endl;
return 0;
Exception handling section, catching the exception and displaying the error code and message:
} catch(gxException &e) {
wcerr << L"Error (0x" << hex << setw(8) << setfill(L'0') << e.GetErrorCode() << L"): " << e.GetErrorString() << endl;
return 1;
}
}
When specifying the needed include files we have included the gxsdldr.cpp loader file directly:
#include <stdio.h> #include <iostream> #include <iomanip> #include "gxsd.h" #include "gxsdldr.cpp"
Specifying the used namespaces:
gx for to reach the API functions if the GX_NAMESPACES define is globally setstd for the display functions
/* Specifying the used namespaces */ #ifdef GX_NAMESPACES using namespace gx; #endif using namespace std;
Starting the main function:
/* * Main function. */ int main(void) { try {
Getting and displaying system informations:
/* Displays the informations */ wcout << L"GX licences in the system:\n"; wcout << L"Freeflow licences: " << gxSystem::GetSystemInfo(GX_SYSINFO_FLAG_FREEFLOW) << L"\n"; wcout << L"Parking licences: " << gxSystem::GetSystemInfo(GX_SYSINFO_FLAG_PARKING) << L"\n"; wcout << L"Container licences: " << gxSystem::GetSystemInfo(GX_SYSINFO_FLAG_ACCR) << L"\n"; wcout << L"Parking Lane licences: " << gxSystem::GetSystemInfo(GX_SYSINFO_FLAG_PARKINGLANE) << L"\n"; wcout << L"Face ident licences: " << gxSystem::GetSystemInfo(GX_SYSINFO_FLAG_FACE) << L"\n"; wcout << L"Passport Reader licences: " << gxSystem::GetSystemInfo(GX_SYSINFO_FLAG_PR) << L"\n"; return 0;
Exception handling section, catching the exception and displaying the error code and message:
} catch(gxException &e) { wcerr << L"Error (0x" << hex << setw(8) << setfill(L'0') << e.GetErrorCode() << L"): " << e.GetErrorString() << endl; return 1; } }