#include <conio.h>
#define PYTHON_CALIBRATOR_TIME_PULSE 1
#define PYTHON_CALIBRATOR_TIME_PERIOD 2
#define PYTHON_CALIBRATOR_AMPLITUDE_POSITIVE 3
#define PYTHON_CALIBRATOR_AMPLITUDE_NEGATIVE 4
#define SAVE_DATA
#define __ERROR_LANGUAGE__ RSH_LANGUAGE_RUSSIAN
#define BOARD_NAME "Python"
#define DEVICE_ID 1
#define SAMPLE_FREQ 1.0e+9
#define CHANNEL_NUMBER 2
{
std::cout<<"\n============================================================="<<std::endl;
std::cout<<"\n\nPress any key to end up the program.";
_getch();
return st;
}
int main()
{
RSH_S8P libname, libVersion, libCoreName, libCoreVersion;
return SayGoodBye(Client, st);
return SayGoodBye(Client, st);
else
std::cout<<
"\nLibrary Name: "<<libname.
data<<std::endl;
return SayGoodBye(Client, st);
else
std::cout<<
"\nLibrary Version: "<<libVersion.
data<<std::endl;
std::cout<<"Connecting now..."<<std::endl;
S8* connectString = (
S8*)
"TCP:192.168.0.1:1024;UDP:8000";
return SayGoodBye(Client, st);
std::cout<<"Connected successfully!"<<std::endl;
{
return SayGoodBye(Client, st);
else
std::cout<<
"\nGPS data: "<<gps.
data<<std::endl;
return SayGoodBye(Client, st);
else
std::wcout<<L
"\nGPS data utf16: "<<(
wchar_t*)gpsutf.
data<<std::endl;
}
else
{
std::cout<<"GPS data is not available!"<<std::endl;
}
return SayGoodBye(Client, st);
std::cout<<
"Power supply voltage: "<<powerVoltage.
data<<std::endl;
std::cout<<"\n-->Python performance test <--\n\n";
return SayGoodBye(Client, st);
U32 blockSize=sizeList[sizeList.
Size()-1];
std::cout<<"\nEnter buffer size {"<<sizeList[0]<<", ";
for(
U32 i = 1;i<sizeList.Size()-1;++i)
{
std::cout<<sizeList[i]<<", ";
if(i%4 == 0)
std::cout<<std::endl;
}
std::cout<<sizeList[sizeList.Size()-1]<<"}[default="<<blockSize<<"]:"<<std::endl;
std::string input;
std::getline( std::cin, input );
if ( !input.empty() )
{
std::istringstream stream( input );
stream >> blockSize;
}
blockSize = CutV(blockSize, sizeList[0], sizeList[sizeList.Size()-1]);
std::cout<<"\nEnter time interval(ms) [default=100]:";
std::getline( std::cin, input );
if ( !input.empty() )
{
std::istringstream stream( input );
stream >> timeinterval;
}
std::cout<<"\nEnter timeout (ms) [default=5000]:";
std::getline( std::cin, input );
if ( !input.empty() )
{
std::istringstream stream( input );
stream >> timeout;
}
std::cout<<"\nEnter averaging window size [default=100]:";
std::getline( std::cin, input );
if ( !input.empty() )
{
std::istringstream stream( input );
stream >> window;
}
window = CutV(window,1UL,10000UL);
return SayGoodBye(Client, st);
calibParam.
offset = PYTHON_CALIBRATOR_AMPLITUDE_POSITIVE;
return SayGoodBye(Client, st);
calibParam.
offset = PYTHON_CALIBRATOR_AMPLITUDE_NEGATIVE;
return SayGoodBye(Client, st);
calibParam.
offset = PYTHON_CALIBRATOR_TIME_PULSE;
return SayGoodBye(Client, st);
calibParam.
offset = PYTHON_CALIBRATOR_TIME_PERIOD;
return SayGoodBye(Client, st);
for(int i=0;i<CHANNEL_NUMBER;++i)
{
}
return SayGoodBye(Client, st);
RSH_U32 activeChanNumber, serialNumber;
return SayGoodBye(Client, st);
return SayGoodBye(Client, st);
return SayGoodBye(Client, st);
std::cout<<
"\nThe name of the connected device: "<<libname.
data<<std::endl;
std::cout<<
"nSerial number of the connected device: "<<serialNumber.
data<<std::endl;
std::cout<<
"nData to be collected: "<<p.
bufferSize*activeChanNumber.
data<<
"samples"<<std::endl;
std::cout<<
"nADC frequency: "<<p.
frequency<<
"Hz"<<std::endl;
std::cout<<
"nThe number of active channels: "<<activeChanNumber.
data<<std::endl;
std::cout<<"\n=============================================================\n";
std::cout<<"\n\nPress Esc key to exit, any other key to start "<<BOARD_NAME<<"..."<<std::endl;
if(_getch() == 27)
return 0;
return SayGoodBye(Client, st);
int lastPacket = 0;
int curPacket = 0;
int totalPackets = 0;
int goodPackets = 0;
double* percents = new double[window];
DWORD* timerIntervals = new DWORD[window];
DWORD curTimer, lastTimer;
double averagePercent = 0.0;
double averageSpeed = 0.0;
int maxpercent=0;
loopNum = 0;
std::cout<<"\n--> Press ESC to stop"<<std::endl;
return SayGoodBye(Client, st);
curTimer = lastTimer = GetTickCount();
do
{
return SayGoodBye(Client, st);
st = device->
GetData( &userBuffer );
return SayGoodBye(Client, st);
curTimer = GetTickCount();
return SayGoodBye(Client, st);
if(loopNum == 0 )
{
lastPacket = curPacket = reg.
value;
goodPackets = 1;
totalPackets = 1;
}
else
{
goodPackets = 1;
totalPackets = (curPacket-lastPacket+255)%255;
if(totalPackets == 0)
totalPackets = 1;
}
percents[loopNum%window] = (double)goodPackets*100.0/(double)totalPackets;
timerIntervals[loopNum%window] = curTimer - lastTimer;
lastPacket = curPacket;
lastTimer = curTimer;
if(loopNum+1<window)
maxpercent = loopNum+1;
else
maxpercent = window;
averagePercent = 0.0;
averageSpeed = 0.0;
for(int i=0;i<maxpercent;++i)
{
averagePercent+=percents[i];
averageSpeed += (double)timerIntervals[i];
}
averageSpeed = 1000.0*(maxpercent*dataSizeBytes)/averageSpeed/1048576.0;
averagePercent /= maxpercent;
printf("\rCnt: %5d; frm: %5d; Stats: %5.1f%% (%5.1f%% lost); speed: %3.2fMb/s", ++loopNum, curPacket, averagePercent,100.0-averagePercent,averageSpeed);
#ifdef SAVE_DATA
std::ostringstream ln;
ln << loopNum;
std::string fn_tmp =
std::string(BOARD_NAME) +
std::string("_auto") +
std::string(ln.str()) +
std::string(".dat");
std::wstring FileName = std::wstring( fn_tmp.begin(), fn_tmp.end());
st = userBuffer.WriteDataToFile(FileName.c_str());
return SayGoodBye(Client, st);
#endif
if(_kbhit())
{
if( _getch() == 27)
{
break;
}
}
}while(1);
}