Changeset 11195
- Timestamp:
- 06/27/11 14:45:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fad.cc
r11179 r11195 28 28 class tcp_connection : public ba::ip::tcp::socket, public boost::enable_shared_from_this<tcp_connection> 29 29 { 30 p rivate:30 public: 31 31 const int fBoardId; 32 32 … … 85 85 void SendData() 86 86 { 87 if (!fTriggerEnabled)88 return;89 90 87 fHeader.fPackageLength = sizeof(EventHeader)/2+1; 91 88 fHeader.fEventCounter++; … … 147 144 148 145 // The deadline has passed. 149 SendData(); 146 if (fTriggerEnabled) 147 SendData(); 150 148 151 149 AsyncWait(fTriggerSendData, 1, &tcp_connection::TriggerSendData); … … 186 184 cout << "-> Trigger line" << endl; 187 185 fTriggerEnabled = fBufCommand[0]==kCmdTriggerLine; 186 fHeader.Enable(FAD::EventHeader::kTriggerLine, fTriggerEnabled); 188 187 break; 189 188 … … 205 204 break; 206 205 206 case kCmdBusy: 207 case kCmdBusy+0x100: 208 cout << "-> Busy" << endl; 209 fHeader.Enable(FAD::EventHeader::kBusy, fBufCommand[0]==kCmdBusy); 210 break; 211 207 212 case kCmdSocket: 208 213 case kCmdSocket+0x100: 209 214 cout << "-> Socket" << endl; 210 215 fCommandSocket = fBufCommand[0]==kCmdSocket; 216 fHeader.Enable(FAD::EventHeader::kSock17, fCommandSocket); 211 217 break; 212 218 213 219 case kCmdContTrigger: 214 220 case kCmdContTrigger+0x100: 215 if (fBufCommand[0]==kCmdContTrigger +0x100)221 if (fBufCommand[0]==kCmdContTrigger) 216 222 AsyncWait(fTriggerSendData, 1, &tcp_connection::TriggerSendData); 217 223 else 218 224 fTriggerSendData.cancel(); 225 fHeader.Enable(FAD::EventHeader::kContTrigger, fBufCommand[0]==kCmdContTrigger); 219 226 cout << "-> ContTrig" << endl; 220 227 break; 221 228 222 229 case kCmdResetTriggerId: 223 cout << "-> Reset " << endl;230 cout << "-> ResetId" << endl; 224 231 fHeader.fEventCounter = 0; 225 232 break; 226 233 227 234 case kCmdSingleTrigger: 228 cout << "-> Trigger "<< endl;235 cout << "-> Trigger " << fBoardId << endl; 229 236 SendData(); 230 237 break; … … 361 368 void handle_accept(boost::shared_ptr<ba::ip::tcp::socket> socket, int port, const boost::system::error_code&/* error*/) 362 369 { 363 cout << "Added one socket" << socket->remote_endpoint().address().to_v4().to_string();370 cout << this << " Added one socket[" << fBoardId << "] " << socket->remote_endpoint().address().to_v4().to_string(); 364 371 cout << ":"<< port << endl; 365 372 fSockets.push_back(socket); … … 406 413 boost::shared_ptr<ba::ip::tcp::socket> connection = 407 414 boost::shared_ptr<ba::ip::tcp::socket>(new ba::ip::tcp::socket(acc.io_service())); 415 408 416 acc.async_accept(*connection, 409 417 boost::bind(&tcp_connection::handle_accept, … … 415 423 void start_accept() 416 424 { 417 cout << "Start accept " << acc0.local_endpoint().port() << "..." << flush;425 cout << "Start accept[" << fBoardId << "] " << acc0.local_endpoint().port() << "..." << flush; 418 426 tcp_connection::shared_ptr new_connection = tcp_connection::create(/*acceptor_.*/acc0.io_service(), fBoardId); 427 428 cout << new_connection.get() << " "; 419 429 420 430 // This will accept a connection without blocking … … 441 451 442 452 // not installing a new handler will stop run() 443 cout << "Handle accept..." << flush;453 cout << new_connection.get() << " Handle accept[" << fBoardId << "]["<<new_connection->fBoardId<<"]..." << flush; 444 454 if (!error) 445 455 {
Note:
See TracChangeset
for help on using the changeset viewer.