Header Header

Examples
[Device handling]

Table of contents

gxdevices01 - List devices example

Shows the way of listing the GX system devices.

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:

/* 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;
    }
}

gxdevices02 - System information example

Shows the way of getting system information about the GX devices.

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:

/* 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;
    }
}


Generated  for GX
(c) ARH Inc.