#include <IORawData/DTCommissioning/src/DTSpy.h>
Public Member Functions | |
DTSpy (char *hostaddr, int port) | |
DTSpy () | |
int | getBuffSize () |
const char * | getEventPointer () |
int | getNextBuffer () |
int | getRunNo () |
void | setlastPointer (char *data) |
~DTSpy () | |
Public Attributes | |
char * | lastpointer |
Protected Attributes | |
short | givenonce |
char * | spybuf |
Definition at line 17 of file DTSpy.h.
DTSpy::DTSpy | ( | ) |
Definition at line 18 of file DTSpy.cc.
References DTSPY_MAX_MSG, givenonce, and spybuf.
00018 :DTCtcp(0) 00019 { 00020 spybuf=(char *)malloc(DTSPY_MAX_MSG); 00021 givenonce=0; 00022 }
DTSpy::DTSpy | ( | char * | hostaddr, | |
int | port | |||
) |
DTSpy::~DTSpy | ( | ) |
int DTSpy::getBuffSize | ( | ) |
Definition at line 67 of file DTSpy.cc.
References spybuf.
Referenced by getNextBuffer().
00068 { 00069 unsigned short *i2ohea = (unsigned short *) (spybuf+2); 00070 return *i2ohea; 00071 }
const char * DTSpy::getEventPointer | ( | ) |
Definition at line 83 of file DTSpy.cc.
References DTSPY_HEAD_SIZE, givenonce, lastpointer, and spybuf.
Referenced by DTSpyReader::fillRawData().
00084 { 00085 if (givenonce) return lastpointer; 00086 lastpointer = spybuf+DTSPY_HEAD_SIZE; 00087 givenonce = 1; 00088 return lastpointer; 00089 }
int DTSpy::getNextBuffer | ( | ) |
Definition at line 39 of file DTSpy.cc.
References DTCtcp::connected, DTSPY_HEAD_SIZE, DTSPY_MAX_MSG, getBuffSize(), givenonce, lastpointer, DTCtcp::Receive(), and spybuf.
Referenced by DTSpyReader::fillRawData().
00040 { 00041 00042 if (!connected) return -1; 00043 if (givenonce) 00044 if ((lastpointer - spybuf) < getBuffSize()) 00045 return (getBuffSize() - (lastpointer - spybuf)); 00046 givenonce=0; 00047 00048 memset(spybuf,0x0,DTSPY_MAX_MSG); /* init buffer */ 00049 00050 int howm=Receive(spybuf,DTSPY_HEAD_SIZE); 00051 00052 unsigned short *i2ohea = (unsigned short *) (spybuf+2); 00053 if (howm == DTSPY_HEAD_SIZE ) 00054 { 00055 howm = Receive(spybuf+DTSPY_HEAD_SIZE,((*i2ohea) * 4)-DTSPY_HEAD_SIZE); 00056 00057 // for (int ii=0; ii<12; ii++) 00058 // printf("%d: %x %x %x %x \n",ii*4,spybuf[ii*4], 00059 // spybuf[ii*4+1],spybuf[ii*4+2],spybuf[ii*4+3]); 00060 00061 return howm+DTSPY_HEAD_SIZE;; 00062 } 00063 else return -1; 00064 }
int DTSpy::getRunNo | ( | ) |
Definition at line 76 of file DTSpy.cc.
References spybuf.
Referenced by DTSpyReader::fillRawData().
00077 { 00078 unsigned short *i2ohea = (unsigned short *) (spybuf+28); 00079 return *i2ohea; 00080 }
void DTSpy::setlastPointer | ( | char * | data | ) |
Definition at line 92 of file DTSpy.cc.
References lastpointer.
Referenced by DTSpyReader::fillRawData().
00093 { 00094 lastpointer=thep; 00095 }
short DTSpy::givenonce [protected] |
Definition at line 21 of file DTSpy.h.
Referenced by DTSpy(), getEventPointer(), and getNextBuffer().
char* DTSpy::lastpointer |
Definition at line 25 of file DTSpy.h.
Referenced by getEventPointer(), getNextBuffer(), and setlastPointer().
char* DTSpy::spybuf [protected] |
Definition at line 20 of file DTSpy.h.
Referenced by DTSpy(), getBuffSize(), getEventPointer(), getNextBuffer(), getRunNo(), and ~DTSpy().