#include <iostream>
#include <sstream>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
#ifdef RSH_MSWINDOWS
#include <conio.h>
#endif
const char* BoardName = "LEONARDO2PCI" ;
const std::string screenDelimiter(80, '=');
const char* StringSuccess = "SUCCESS!";
{
cout<<endl<<screenDelimiter<<endl;
if(desc)
cout << "Error on " << desc << " call." << endl;
cout << endl << "Press 'Enter' key to end up the program.";
cin.ignore();
return st;
}
int main()
{
std::vector<std::string> allDevices;
{
cout << "List of registered device libraries:" << endl;
for(std::vector<std::string>::iterator it = allDevices.begin();
it != allDevices.end(); ++it)
{
cout << *it << endl;
}
}
cout << screenDelimiter << endl;
cout << "Loading device interface from dynamic library... ";
return SayGoodBye(Client, st, "Client.GetDeviceInterface(DevKey)");
else
cout << StringSuccess << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_LIBRARY_FILENAME)");
else
cout << "Library Name: "<< libname << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_LIBRARY_VERSION_STR)");
else
cout << "Library Version: " << libVersion << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_CORELIB_FILENAME)");
else
cout << "Core Library Name: " << libCoreName << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_CORELIB_VERSION_STR)");
else
cout << "Core Library Version: " << libCoreVersion << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_DEVICE_IS_CAPABLE)");
cout << "Connecting to device (it may take some time)... ";
return SayGoodBye(Client, st,"device->Connect()");
else
cout << StringSuccess << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_DEVICE_NAME_VERBOSE)");
else
cout << "The name of the connected device: " << fullDeviceName << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_DEVICE_SERIAL_NUMBER)");
else
cout << "Serial number of the connected device: " << serialNumber << endl;
return SayGoodBye(Client, st);
cout << screenDelimiter << endl;
cout << BoardName << " port configuration" << endl << endl;
{
std::cout << "Digital ports:" << endl;
std::cout << std::setw(10) << "Port Name" << std::setw(10) << "Bit Size" << std::setw(10) << "Address" << endl;
std::wcout << std::setw(10) << bpi.
ports[i].name << std::setw(10) << bpi.
ports[i].bitSize << std::setw(10) << bpi.
ports[i].address << endl;
}
else
{
cout << "There are no digital ports (bpi.ports is empty)!" << endl;
}
{
std::cout << "Configuration ports:" << endl;
std::cout << std::setw(10) << "Port Name" << std::setw(10) << "Bit Size" << std::setw(10) << "Address" << endl;
std::wcout << std::setw(10) << bpi.
confs[i].name << std::setw(10) << bpi.
confs[i].bitSize << std::setw(10) << bpi.
confs[i].address << endl;
}
cout << screenDelimiter << endl;
cout << "Press Esc key to exit, any other key to write data to digital port..." << endl;
#if defined(RSH_MSWINDOWS)
#else
#endif
return SayGoodBye(Client, st, "device->Init(&p);");
std::wcout <<
"0x" << std::hex << p.
portValue << L
" was successfully written to " << bpi.
ports[0].name << endl;
cout << screenDelimiter << endl;
cout << "Press Esc key to exit, any other key to read data from digital port..." << endl;
#if defined(RSH_MSWINDOWS)
#else
#endif
return SayGoodBye(Client, st, "device->Init(&p)");
std::wcout <<
"Read operation from " << bpi.
ports[0].name <<
" was successfull, value=0x" << std::hex << p.
portValue << endl;
}