#include <DTSpy.h>
Public Member Functions | |
DTSpy () | |
DTSpy (char *hostaddr, int port) | |
int | getBuffSize () |
const char * | getEventPointer () |
int | getNextBuffer () |
int | getRunNo () |
void | setlastPointer (char *data) |
~DTSpy () | |
Public Attributes | |
char * | lastpointer |
Protected Attributes | |
short | givenonce |
char * | spybuf |
DTSpy::DTSpy | ( | ) |
Definition at line 18 of file DTSpy.cc.
References DTSPY_MAX_MSG, givenonce, and spybuf.
:DTCtcp(0) { spybuf=(char *)malloc(DTSPY_MAX_MSG); givenonce=0; }
DTSpy::DTSpy | ( | char * | hostaddr, |
int | port | ||
) |
int DTSpy::getBuffSize | ( | ) |
Definition at line 67 of file DTSpy.cc.
References spybuf.
Referenced by getNextBuffer().
{ unsigned short *i2ohea = (unsigned short *) (spybuf+2); return *i2ohea; }
const char * DTSpy::getEventPointer | ( | ) |
Definition at line 83 of file DTSpy.cc.
References DTSPY_HEAD_SIZE, givenonce, lastpointer, and spybuf.
Referenced by DTSpyReader::fillRawData().
{ if (givenonce) return lastpointer; lastpointer = spybuf+DTSPY_HEAD_SIZE; givenonce = 1; return lastpointer; }
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().
{ if (!connected) return -1; if (givenonce) if ((lastpointer - spybuf) < getBuffSize()) return (getBuffSize() - (lastpointer - spybuf)); givenonce=0; memset(spybuf,0x0,DTSPY_MAX_MSG); /* init buffer */ int howm=Receive(spybuf,DTSPY_HEAD_SIZE); unsigned short *i2ohea = (unsigned short *) (spybuf+2); if (howm == DTSPY_HEAD_SIZE ) { howm = Receive(spybuf+DTSPY_HEAD_SIZE,((*i2ohea) * 4)-DTSPY_HEAD_SIZE); // for (int ii=0; ii<12; ii++) // printf("%d: %x %x %x %x \n",ii*4,spybuf[ii*4], // spybuf[ii*4+1],spybuf[ii*4+2],spybuf[ii*4+3]); return howm+DTSPY_HEAD_SIZE;; } else return -1; }
int DTSpy::getRunNo | ( | ) |
Definition at line 76 of file DTSpy.cc.
References spybuf.
Referenced by DTSpyReader::fillRawData().
{ unsigned short *i2ohea = (unsigned short *) (spybuf+28); return *i2ohea; }
void DTSpy::setlastPointer | ( | char * | data | ) |
Definition at line 92 of file DTSpy.cc.
References lastpointer.
Referenced by DTSpyReader::fillRawData().
{ lastpointer=thep; }
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().