#include <iostream>
#include <sstream>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
#if defined(RSH_MSWINDOWS)
#include <conio.h>
const char* FilePath = "";
#elif defined(RSH_LINUX)
const char* FilePath ="";
#endif
const char* BoardName = "Python" ;
const double SampleFreq = 1.0e+9;
const U32 ChannelNumber = 2;
const U32 BufferSize = 16332;
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;
cout << screenDelimiter << endl;
cout << "--> Start-Stop data acquisition mode <--"<<endl;
cout << screenDelimiter << endl;
for(int i=0;i<ChannelNumber;++i)
{
}
cout << "Initializing device with Init structure... ";
return SayGoodBye(Client, st, "device->Init(&p)");
else
cout <<StringSuccess << endl;
return SayGoodBye(Client, st, "device->Get(RSH_GET_DEVICE_ACTIVE_CHANNELS_NUMBER)");
if(activeChanNumber == 0)
{
cout << "ActiveChanNumber is zero, something is wrong!" << endl;
}
cout << endl << "Initialization parameters:" << endl << p << endl;
cout << "The number of active channels: " << activeChanNumber << endl;
cout <<
"The estimated time of gathering completion: " << (p.
bufferSize / p.
frequency ) <<
"s"<< endl;
do
{
cout << screenDelimiter << endl;
cout << "Press Esc key to exit, any other key to start data acquisition..." << endl;
#if defined(RSH_MSWINDOWS)
if(_getch() == 27) break;
#else
if (getc(stdin) == 27) break;
#endif
return SayGoodBye(Client, st, "device->Start()");
cout << "Collecting buffer... ";
return SayGoodBye(Client, st, "device->Get(RSH_GET_WAIT_BUFFER_READY_EVENT)");
cout << StringSuccess << endl;
cout << "Interrupt has taken place!" << endl;
st = device->
GetData( &userBuffer );
return SayGoodBye(Client, st, "device->GetData( &userBuffer )");
st = device->
GetData(&userBufferD);
{
userBufferD.Print(10);
}
std::ostringstream nameStream;
nameStream << FilePath << BoardName << "_StartStop_" << std::setw(4) << std::setfill('0') << ++loopNum << ".dat";
std::string fileName = nameStream.str();
st = userBuffer.WriteBufferToFile(fileName);
{
cout <<"Data was successfully collected and saved to " << fileName << endl;
cout <<"File size: " << userBuffer.ByteSize()/1024.0 << "kilobytes" << endl;
}
else
{
cout << "Couldn't write to file " << fileName << endl;
}
}while(true);
}