Changeset 3039
- Timestamp:
- 03/05/07 17:26:16 (6 years ago)
- Location:
- experimental/components/DataComparator
- Files:
-
- 3 modified
-
DataComparator.cpp (modified) (8 diffs)
-
DataComparator.h (modified) (1 diff)
-
main.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
experimental/components/DataComparator/DataComparator.cpp
r2980 r3039 97 97 CORBA::Object_ptr DataComparator_i::getPort( const char* portName ) throw (CORBA::SystemException, CF::PortSupplier::UnknownPort) 98 98 { 99 DEBUG(5, DataComparator, " DataComparator_i getPort called with : " << portName)99 DEBUG(5, DataComparator, "getPort() invoked with : " << portName) 100 100 101 101 CORBA::Object_var p; … … 117 117 void DataComparator_i::start() throw (CORBA::SystemException, CF::Resource::StartError) 118 118 { 119 DEBUG(5, DataComparator, "start invoked")119 DEBUG(5, DataComparator, "start() invoked") 120 120 } 121 121 122 122 void DataComparator_i::stop() throw (CORBA::SystemException, CF::Resource::StopError) 123 123 { 124 DEBUG(5, DataComparator, "stop invoked")124 DEBUG(5, DataComparator, "stop() invoked") 125 125 } 126 126 127 127 void DataComparator_i::releaseObject() throw (CORBA::SystemException, CF::LifeCycle::ReleaseError) 128 128 { 129 DEBUG(5, DataComparator, "releaseObject invoked")129 DEBUG(5, DataComparator, "releaseObject() invoked") 130 130 131 131 component_running->signal(); … … 134 134 void DataComparator_i::initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException) 135 135 { 136 DEBUG(5, DataComparator, "initialize invoked")136 DEBUG(5, DataComparator, "initialize() invoked") 137 137 } 138 138 139 139 void DataComparator_i::configure(const CF::Properties& props) throw (CORBA::SystemException, CF::PropertySet::InvalidConfiguration, CF::PropertySet::PartialConfiguration) 140 140 { 141 DEBUG(5, DataComparator, "configure invoked")141 DEBUG(5, DataComparator, "configure() invoked") 142 142 143 143 DEBUG(5, DataComparator, "props length : " << props.length()) … … 160 160 void DataComparator_i::run_loop() 161 161 { 162 DEBUG(5, DataComparator, " DataComparator's run_loopthread started")162 DEBUG(5, DataComparator, "run_loop() thread started") 163 163 164 164 #ifdef LOGGING … … 169 169 170 170 unsigned int i, N, num_errors; 171 unsigned int packet_id(0); 171 unsigned int packet_id(0), prev_packet_id(0); 172 signed int packet_index_diff(0); 173 unsigned int num_dropped_packets(0); 174 unsigned int num_packets_to_observe(100); 175 unsigned int num_received_packets(0); 172 176 unsigned int M(control_data_length); 177 178 bool first_packet(true); 179 173 180 packet_length = 400; 174 181 if ( packet != NULL ) … … 186 193 dataIn_0->getData(data_bits_in); 187 194 N = data_bits_in->length(); 188 DEBUG( 1, DataComparator, "received " << N << " data samples")195 DEBUG(7, DataComparator, "received " << N << " data samples") 189 196 190 197 dataIn_1->getData(control_bits_in); 191 198 M = control_bits_in->length(); 192 DEBUG( 1, DataComparator, "received " << M << " control samples")199 DEBUG(7, DataComparator, "received " << M << " control samples") 193 200 194 201 if ( N != packet_length ) … … 202 209 else 203 210 { 204 // TODO:compare control data205 if ( ossieDebugLevel >= 7)211 // compare control data 212 if ( true ) 206 213 { 207 214 packet_id = 0; 208 std::cout << "DataComparator: control: ";215 // std::cout << "DataComparator: control: "; 209 216 /* 210 217 for (i=0; i<M; i++) … … 251 258 ) > 2 ) ? 0x0001 : 0x0000; 252 259 253 std::cout << " " << packet_id << std::endl; 260 DEBUG(5, DataComparator, "packet id : " << packet_id); 261 262 if ( first_packet ) 263 first_packet = false; 264 else 265 { 266 // determine if packets have been dropped 267 if ( packet_id == 0 ) 268 packet_index_diff = 31 - prev_packet_id; 269 else 270 packet_index_diff = packet_id - prev_packet_id - 1; 271 272 while (packet_index_diff<0) 273 packet_index_diff += 31; 274 275 num_dropped_packets += (unsigned int) packet_index_diff; 276 } 277 278 num_received_packets++; 279 prev_packet_id = packet_id; 280 254 281 } 255 282 num_errors = 0; 256 283 257 // compare values284 // compare data values 258 285 for (i=0; i<N; i++) 259 286 num_errors += ( (signed char) (*data_bits_in)[i]==packet_tmp[i]) 260 287 ? 0 : 1; 261 288 262 DEBUG(1, DataComparator, "errors: " << num_errors << " / " << N) 289 DEBUG(5, DataComparator, "data errors : " << num_errors << " / " << N) 290 291 if ( (num_received_packets+num_dropped_packets) >= num_packets_to_observe ) 292 { 293 DEBUG(1, DataComparator, "------------------ dropped packets : " << num_dropped_packets << " / " << num_received_packets + num_dropped_packets) 294 num_received_packets = 0; 295 num_dropped_packets = 0; 296 } 263 297 #ifdef LOGGING 264 298 if ( log_size_counter < LOG_SIZE_MAX ) -
experimental/components/DataComparator/DataComparator.h
r2744 r3039 79 79 signed char * control_data; 80 80 unsigned int control_data_length; 81 81 82 82 }; 83 83 #endif -
experimental/components/DataComparator/main.cpp
r2744 r3039 32 32 33 33 { 34 ossieDebugLevel = 7;34 ossieDebugLevel = 4; 35 35 36 36 ossieSupport::ORB *orb = new ossieSupport::ORB;