00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 This file is part of Phission. 00010 00011 Phission is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU Lesser General Public License as published by 00013 the Free Software Foundation; either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Phission is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public License 00022 along with Phission; if not, write to the Free Software 00023 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 00025 ---------------------------------------------------------------------------*/ 00026 #ifndef _PHNETCLIENTTHREAD_H 00027 #define _PHNETCLIENTTHREAD_H 00028 00029 /* 1.) Display header files here */ 00030 /* ---------------------------- */ 00031 #include <phConditionCounter.h> 00032 #include <phServerSocket.h> 00033 #include <phImage.h> 00034 #include <phImageWindow.h> 00035 00036 /* ---------------------------------------------------------------------- */ 00042 PHAPI(class) phNetClientRecvThread : public phThread 00043 { 00044 private: 00045 volatile uint32_t *m_server_running; 00046 phSocket *m_comms; 00047 00048 phRWLock m_jitter_rwlock; 00049 00050 uint32_t m_last_host_time[2]; 00051 uint32_t m_last_client_time[2]; 00052 00053 uint32_t m_client_jitter_us; 00054 uint32_t m_client_end_jitter_us; 00055 uint32_t m_client_recv_time_us; 00056 00057 uint32_t m_rtt_us; /* Round Trip Time */ 00058 uint32_t m_half_rtt_us; /* half of the Round Trip Time */ 00059 uint32_t m_half_rtt_avg_us; 00060 uint32_t m_rtt_samples; 00061 00062 uint32_t m_jitter_us; 00063 uint32_t m_jitter_avg_us; 00064 uint32_t m_jitter_samples; 00065 00066 protected: 00067 int run(); 00068 00069 public: 00070 phNetClientRecvThread(); 00071 ~phNetClientRecvThread(); 00072 00073 int set( phSocket *comms, 00074 volatile uint32_t *server_running ); 00075 00076 int setComms ( phSocket *comms ); 00077 int setRunningVar ( volatile uint32_t *server_running ); 00078 00079 int setData ( uint32_t host_time[2], 00080 uint32_t client_time[2], 00081 uint32_t data_size ); 00082 00083 int resetData(); 00084 00085 uint32_t getClientJitter (); 00086 uint32_t getClientEndJitter (); 00087 uint32_t getClientRecvTime (); 00088 uint32_t getRoundTrip (); 00089 00090 uint32_t getHalfRoundTrip (); 00091 uint32_t getHalfRoundTripAvg(); 00092 int setRttAvgSamples ( uint32_t samples ); 00093 uint32_t getRttAvgSamples (); 00094 00095 uint32_t getJitter (); 00096 uint32_t getJitterAvg (); 00097 00098 int setJitterAvgSamples ( uint32_t samples ); 00099 uint32_t getJitterAvgSamples (); 00100 }; 00101 00102 /* ---------------------------------------------------------------------- */ 00109 PHAPI(class) phNetClientThread : public phThread 00110 { 00111 private: 00112 volatile uint32_t *m_server_running; 00113 char *m_title; 00114 phSocket *m_comms; 00115 phImage *m_image; 00116 phConditionCounter *m_condVar; 00117 00118 phNetClientRecvThread *m_recv_thread; 00119 00120 protected: 00121 int run(); 00122 00123 public: 00124 phNetClientThread(); 00125 ~phNetClientThread(); 00126 00127 int set( phConditionCounter *counter, 00128 phSocket *comms, 00129 phImage *image, 00130 const char *title, 00131 volatile uint32_t *server_running ); 00132 00133 int setConditionVar ( phConditionCounter *counter ); 00134 int setComms ( phSocket *comms ); 00135 int setLiveObject ( phImage *image ); 00136 int setTitle ( const char *title ); 00137 int setRunningVar ( volatile uint32_t *server_running ); 00138 }; 00139 00140 #endif /* _PHNETCLIENTTHREAD_H */ 00141
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |