Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

GTCamTimeSyncHandler Class Reference

#include <GTCamTimeSyncHandler.h>

Inheritance diagram for GTCamTimeSyncHandler:

Inheritance graph
[legend]
Collaboration diagram for GTCamTimeSyncHandler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GTCamTimeSyncHandler ()
 Constructor.

 ~GTCamTimeSyncHandler ()
void initGTCamTimeSyncHandler (GTCamWorldState *myState, Image *image)
 Init the handler.

virtual void onReceive (void *data, int size)
 Receive data.

void startTimeSync ()
 Start the syncing.

void calculateOffset ()
 calculate the offset


Public Attributes

long offset
long frameOffset
bool inSync
IPAddress timeServer
Imageimage

Private Attributes

TRingBufferWithSum< double, 25 > buffer
TRingBufferWithSum< long, 25 > frameNumberBuffer
GTCamWorldStatestate
long robotTimeRequestWasSent
long robotTimeRequestWasReceived
long serverTimeInResponse
long frameNumberTimeRequestWasSent
long frameNumberTimeRequestWasReceived
bool received2Packages

Constructor & Destructor Documentation

GTCamTimeSyncHandler::GTCamTimeSyncHandler  ) 
 

Constructor.

Definition at line 12 of file GTCamTimeSyncHandler.cpp.

References received2Packages, robotTimeRequestWasReceived, robotTimeRequestWasSent, serverTimeInResponse, and timeServer.

GTCamTimeSyncHandler::~GTCamTimeSyncHandler  )  [inline]
 

Definition at line 23 of file GTCamTimeSyncHandler.h.


Member Function Documentation

void GTCamTimeSyncHandler::initGTCamTimeSyncHandler GTCamWorldState myState,
Image myImage
 

Init the handler.

Definition at line 26 of file GTCamTimeSyncHandler.cpp.

References UDPEndpoint::bind(), InStream< InFile, InConfig >::eof(), InFile::exists(), GTCAMPORT, GTCAMSYNCPORT, and image.

Here is the call graph for this function:

void GTCamTimeSyncHandler::onReceive void *  data,
int  size
[virtual]
 

Receive data.

Reimplemented from UDPEndpoint.

Definition at line 70 of file GTCamTimeSyncHandler.cpp.

References calculateOffset(), Image::frameNumber, frameNumberTimeRequestWasReceived, SystemCall::getCurrentSystemTime(), image, received2Packages, robotTimeRequestWasReceived, and serverTimeInResponse.

Here is the call graph for this function:

void GTCamTimeSyncHandler::startTimeSync  ) 
 

Start the syncing.

Definition at line 114 of file GTCamTimeSyncHandler.cpp.

References Image::frameNumber, frameNumberTimeRequestWasSent, SystemCall::getCurrentSystemTime(), getPlayer(), Player::getPlayerNumber(), GTCAMSYNCPORT, image, robotTimeRequestWasSent, UDPEndpoint::send(), and timeServer.

Referenced by GTCamHandler::onReceive().

Here is the call graph for this function:

void GTCamTimeSyncHandler::calculateOffset  ) 
 

calculate the offset

Definition at line 88 of file GTCamTimeSyncHandler.cpp.

References TRingBufferWithSum< long, 25 >::add(), TRingBufferWithSum< double, 25 >::add(), buffer, frameNumberBuffer, frameNumberTimeRequestWasReceived, frameNumberTimeRequestWasSent, frameOffset, TRingBufferWithSum< long, 25 >::getNumberOfEntries(), TRingBufferWithSum< double, 25 >::getNumberOfEntries(), TRingBufferWithSum< long, 25 >::getSum(), TRingBufferWithSum< double, 25 >::getSum(), offset, robotTimeRequestWasReceived, robotTimeRequestWasSent, and serverTimeInResponse.

Referenced by onReceive().

Here is the call graph for this function:


Member Data Documentation

long GTCamTimeSyncHandler::offset
 

Definition at line 29 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), and GTCamHandler::onReceive().

long GTCamTimeSyncHandler::frameOffset
 

Definition at line 30 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), and GTCamHandler::onReceive().

bool GTCamTimeSyncHandler::inSync
 

Definition at line 31 of file GTCamTimeSyncHandler.h.

IPAddress GTCamTimeSyncHandler::timeServer
 

Definition at line 32 of file GTCamTimeSyncHandler.h.

Referenced by GTCamTimeSyncHandler(), GTCamHandler::onReceive(), and startTimeSync().

Image* GTCamTimeSyncHandler::image
 

Definition at line 33 of file GTCamTimeSyncHandler.h.

Referenced by initGTCamTimeSyncHandler(), onReceive(), and startTimeSync().

TRingBufferWithSum<double,25> GTCamTimeSyncHandler::buffer [private]
 

Definition at line 36 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset().

TRingBufferWithSum<long,25> GTCamTimeSyncHandler::frameNumberBuffer [private]
 

Definition at line 37 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset().

GTCamWorldState* GTCamTimeSyncHandler::state [private]
 

Definition at line 38 of file GTCamTimeSyncHandler.h.

long GTCamTimeSyncHandler::robotTimeRequestWasSent [private]
 

Definition at line 40 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), GTCamTimeSyncHandler(), and startTimeSync().

long GTCamTimeSyncHandler::robotTimeRequestWasReceived [private]
 

Definition at line 41 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), GTCamTimeSyncHandler(), and onReceive().

long GTCamTimeSyncHandler::serverTimeInResponse [private]
 

Definition at line 42 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), GTCamTimeSyncHandler(), and onReceive().

long GTCamTimeSyncHandler::frameNumberTimeRequestWasSent [private]
 

Definition at line 43 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), and startTimeSync().

long GTCamTimeSyncHandler::frameNumberTimeRequestWasReceived [private]
 

Definition at line 44 of file GTCamTimeSyncHandler.h.

Referenced by calculateOffset(), and onReceive().

bool GTCamTimeSyncHandler::received2Packages [private]
 

Definition at line 45 of file GTCamTimeSyncHandler.h.

Referenced by GTCamTimeSyncHandler(), and onReceive().


The documentation for this class was generated from the following files:
Generated on Mon Mar 20 22:15:58 2006 for GT2005 by doxygen 1.3.6