FACT++  1.0
void ConnectionUSB::Connect ( )

Definition at line 272 of file ConnectionUSB.cc.

References Error(), Agilent::State::kConnected, BIAS::State::kConnecting, and Agilent::State::kDisconnected.

Referenced by ConnectionEstablished().

273 {
275 
276  Info("Connecting to "+URL()+".");
277 
278  bs::error_code ec;
279  open(URL(), ec);
280 
281  if (ec)
282  {
283  ostringstream msg;
284  msg << "Error opening " << URL() << "... " << ec.message() << " (" << ec << ")";
285  Error(msg);
287  return;
288  }
289 
290  Info("Connection established.");
291 
292  try
293  {
294  Info("Setting Baud Rate");
295  set_option(fBaudRate);
296  Info("Setting Character Size");
297  set_option(fCharacterSize);
298  Info("Setting Parity");
299  set_option(fParity);
300  Info("Setting Sop Bits");
301  set_option(fStopBits);
302  Info("Setting Flow control");
303  set_option(fFlowControl);
304  }
305  catch (const bs::system_error &erc)
306  {
307  Error(string("Setting connection options: ")+erc.what());
308  // CLOSE
309  return;
310  }
311 
312  fQueueSize = 0;
314 
316 }
std::string URL() const
boost::asio::serial_port_base::character_size fCharacterSize
Definition: ConnectionUSB.h:22
boost::asio::serial_port_base::flow_control fFlowControl
Definition: ConnectionUSB.h:25
boost::asio::serial_port_base::baud_rate fBaudRate
Definition: ConnectionUSB.h:21
size_t fQueueSize
Definition: ConnectionUSB.h:41
int Error(const std::string &str)
Definition: MessageImp.h:49
virtual void ConnectionEstablished()
Definition: ConnectionUSB.h:69
ConnectionStatus_t fConnectionStatus
Definition: ConnectionUSB.h:43
boost::asio::serial_port_base::stop_bits fStopBits
Definition: ConnectionUSB.h:24
boost::asio::serial_port_base::parity fParity
Definition: ConnectionUSB.h:23
int Info(const std::string &str)
Definition: MessageImp.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function: