43         if(startImmediately >=2 ) startImmediately = 1;
    89         int iRecorderStatus = (0x30000 & iStatusReg) >> 16;
    91         if(iRecorderStatus == 0) {
    92                 std::cout << 
"Recorder " << 
m_iDriveID << 
" inactive with no valid data to upload" << std::endl;
    94         } 
else if(iRecorderStatus == 1) {
    95                 std::cout << 
"Recorder " << 
m_iDriveID << 
" waiting for a trigger event" << std::endl;
    97         } 
else if(iRecorderStatus == 2) {
    98                 std::cout << 
"Recorder " << 
m_iDriveID << 
" finished, valid data ready for use" << std::endl;
   101         } 
else if(iRecorderStatus == 3) {
   102                 std::cout << 
"Recorder " << 
m_iDriveID << 
" is still recording" << std::endl;
   111         int iObjIndex = 0x2030;
   122         unsigned int iNumDataItems = 0;
   123         bool bCollectFloats = 
true;
   124         float fFloatingPointFactor = 0;
   126         std::vector<float> vfResData[2];
   141         switch ((SDOData.
data[0] >> 4) ) {
   143                         bCollectFloats = 
false;
   147                         bCollectFloats = 
true;
   151                         bCollectFloats = 
true;
   155                         bCollectFloats = 
false;
   159         std::cout << 
">>>>>ElmoRec: HEADER INFOS<<<<<\nData type is: " << (SDOData.
data[0] >> 4) << std::endl;
   165         iNumDataItems = (SDOData.
data[2] << 8 | SDOData.
data[1]);
   170         std::cout << 
"Floating point factor for recorded values is: " << fFloatingPointFactor << std::endl;
   174                 std::cout << 
"SDODataSize announced in SDO-Header" << ((SDOData.
numTotalBytes-7)/iItemSize) << 
" differs from NumDataItems by ElmoData-Header" <<  iNumDataItems << std::endl;
   178         vfResData[0].assign(iNumDataItems, 0.0);
   179         vfResData[1].assign(iNumDataItems, 0.0);
   183         for(
unsigned int i=7;i<=SDOData.
data.size() - iItemSize; i=i+iItemSize) {
   186                                 vfResData[1][iItemCount] = fFloatingPointFactor * 
convertBinaryToFloat( (SDOData.
data[i] << 0) | (SDOData.
data[i+1] << 8) | (SDOData.
data[i+2] << 16) | (SDOData.
data[i+3] << 24) );
   189                                 if(iItemCount == 120)
   190                                         std::cout << (
unsigned int)( (SDOData.
data[i] << 0) | (SDOData.
data[i+1] << 8) | (SDOData.
data[i+2] << 16) | (SDOData.
data[i+3] << 24) ) << std::endl;
   195                         vfResData[1][iItemCount] = fFloatingPointFactor * (float)( (SDOData.
data[i] << 0) | (SDOData.
data[i+1] << 8) | (SDOData.
data[i+2] << 16) | (SDOData.
data[i+3] << 24) );
   219         unsigned int iMantissa;
   220         float iNumMantissa = 0.0f;
   222         if((iBinaryRepresentation & (1 << 31)) == 0) 
   227         iExponent = ((iBinaryRepresentation >> 23) & 0xFF) - 127; 
   229         iMantissa = (iBinaryRepresentation & 0x7FFFFF); 
   233         for(
int i=1; i<=23; i++) { 
   234                 if((iMantissa & (1 << (23-i))) > 0) {
   235                         iNumMantissa = iNumMantissa + pow(2,(-1)*i);
   239         return iSign * pow(2,iExponent) * iNumMantissa;
   246         unsigned int iMantissa;
   247         float iNumMantissa = 0.0f;
   249         if((iBinaryRepresentation & (1 << 15)) == 0) 
   254         iExponent = ((iBinaryRepresentation >> 10) & 0x1F) - 15; 
   256         iMantissa = (iBinaryRepresentation & 0x3FF); 
   260         for(
int i=1; i<=10; i++) { 
   261                 if((iMantissa & (1 << (10-i))) > 0) {
   262                         iNumMantissa = iNumMantissa + pow(2,(-1)*i);
   266         return iSign * pow(2,iExponent) * iNumMantissa;
   271         std::stringstream outputFileName;
   276         pFile = fopen(outputFileName.str().c_str(), 
"w");
   281                 std::cout << 
"Error while writing file: " << outputFileName.str() << 
" Maybe the selected folder does'nt exist." << std::endl;
   286                 for (
unsigned int i = 0; i < vtValues[0].size(); i++)
   287                         fprintf(pFile, 
"%e %e\n", vtValues[0][i], vtValues[1][i]);
 std::string m_sLogFilename
bool isInitialized(bool initNow)
std::vector< unsigned char > data
float convertBinaryToFloat(unsigned int binaryRepresentation)
ElmoRecorder(CanDriveHarmonica *pParentHarmonicaDrive)
float m_fRecordingStepSec
int processData(segData &SDOData)
int m_iReadoutRecorderTry
unsigned int numTotalBytes
int logToFile(std::string filename, std::vector< float > vtValues[])
int configureElmoRecorder(int iRecordingGap, int driveID, int startImmediately=1)
int readoutRecorderTryStatus(int iStatusReg, segData &SDOData)
void IntprtSetInt(int iDataLen, char cCmdChar1, char cCmdChar2, int iIndex, int iData)
int setLogFilename(std::string sLogFileprefix)
int readoutRecorder(int iObjSubIndex)
void sendSDOUpload(int iObjIndex, int iObjSub)
CanDriveHarmonica * m_pHarmonicaDrive
float convertBinaryToHalfFloat(unsigned int iBinaryRepresentation)
int readoutRecorderTry(int iObjSubIndex)