Changeset 18194
- Timestamp:
- 06/10/15 12:13:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fscctrl.cc
r18189 r18194 31 31 32 32 bool fIsVerbose; 33 bool fIsAutoReconnect; 33 34 34 35 size_t fNumConsecutiveErrors; // Number of consecutive messages with errors 35 36 size_t fNumConsecutiveMessages; // Number of consecutive message which are ok 36 37 38 boost::asio::deadline_timer fReconnectTimeout; 37 39 38 40 protected: … … 126 128 } 127 129 128 voidProcessMessage()130 bool ProcessMessage() 129 131 { 130 132 if (fIsVerbose) … … 132 134 133 135 if (!CheckChecksum()) 134 return ;136 return false; 135 137 136 138 // That looks a bit odd because it copies the values twice for no reason. … … 247 249 humidities.push_back((volt[*ph]-offrh[idx])*0.0313); 248 250 251 //1019=4.8 252 //1005=1.3 253 //970=-7.6 254 //1300=76 249 255 for (int *pt=mapt; *pt>=0; pt++) 250 256 //temperatures.push_back(resist[*pt]>800&&resist[*pt]<2000 ? GetTempPT1000(resist[*pt]) : 0); 251 257 temperatures.push_back(resist[*pt]>970&&resist[*pt]<1300 ? GetTempPT1000(resist[*pt]) : 0); 258 //temperatures.push_back(resist[*pt]>1019&&resist[*pt]<1300 ? GetTempPT1000(resist[*pt]) : 0); 252 259 253 260 // 0 = 3-(3+0)%4 … … 435 442 //if (resist[i]>800 && resist[i]<2000) 436 443 if (resist[i]>970 && resist[i]<1300) 444 //if (resist[i]>1019 && resist[i]<1300) 437 445 Out() << setw(2) << i << " - " << setw(4) << (int)resist[i] << ": " << setprecision(1) << fixed << GetTempPT1000(resist[i]) << endl; 438 446 else … … 447 455 fNumConsecutiveErrors = 0; 448 456 fNumConsecutiveMessages++; 457 458 return true; 449 459 } 450 460 … … 480 490 } 481 491 482 ProcessMessage(); 492 if (!ProcessMessage()) 493 { 494 fIsAutoReconnect = true; 495 fReconnectTimeout.expires_from_now(boost::posix_time::seconds(10)); 496 fReconnectTimeout.async_wait(boost::bind(&ConnectionFSC::HandleReconnectTimeout, 497 this, dummy::error)); 498 PostClose(true); 499 return; 500 } 501 483 502 StartRead(); 484 503 } … … 488 507 fNumConsecutiveErrors = 0; 489 508 fNumConsecutiveMessages = 0; 509 fIsAutoReconnect = false; 490 510 491 511 StartRead(); 512 } 513 514 void HandleReconnectTimeout(const bs::error_code &) 515 { 516 fIsAutoReconnect = false; 492 517 } 493 518 … … 529 554 public: 530 555 ConnectionFSC(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()), 531 fIsVerbose(false) 556 fIsVerbose(false), fIsAutoReconnect(false), fReconnectTimeout(ioservice) 532 557 { 533 558 SetLogStream(&imp); … … 547 572 { 548 573 fPositionsBias = vec; 574 } 575 576 bool IsOpen() const 577 { 578 return IsConnected() || fIsAutoReconnect; 549 579 } 550 580 }; … … 758 788 int Execute() 759 789 { 760 return fFSC.Is Connected() ? State::kConnected : State::kDisconnected;790 return fFSC.IsOpen() ? State::kConnected : State::kDisconnected; 761 791 } 762 792
Note:
See TracChangeset
for help on using the changeset viewer.