2

I found this fine line of code:

serial_port_base::flow_control FLOW( serial_port_base::flow_control::none );

Now, I need flow_control to be set to hardware flow control - how can I do this?

There is no documentation on that so far, and I am already quite sad, that I had to use windows headers to solve my problem with sending a break signal.

Please tell me there is at least a way to setup all serial-port options without using windows headers.

If there is no way without windows headers, I'll take the dirty road here too, so please post dirty examples too.

Jook
  • 4,564
  • 3
  • 26
  • 53
  • interesetingly this `boost::asio::serial_port_base::flow_control::hardware` does not produce an error, but I have a hard time figuring out, if it works - however my break signal still results in an incorrect response of my device - maybe i'll have to look somewhere else too. – Jook Oct 22 '12 at 12:21
  • Sorry, I think I jumped the gun on that.. are you passing FLOW in somewhere to the socket? It looks like you're just creating the option. – Collin Oct 22 '12 at 12:31
  • @collin no, you did not, I have a followup line `serialPort.set_option(FLOW);` - however, I think the flow option was set, but this did not help my main situation - but still, thanks for the quick help – Jook Oct 22 '12 at 12:54

1 Answers1

2

If you check out the header file itself in the boost documentation, you'll find the class flow_control:

class flow_control
  {
  public:
    enum type { none, software, hardware };
    BOOST_ASIO_DECL explicit flow_control(type t = none);
    type value() const;
    BOOST_ASIO_DECL boost::system::error_code store(
        BOOST_ASIO_OPTION_STORAGE& storage,
        boost::system::error_code& ec) const;
    BOOST_ASIO_DECL boost::system::error_code load(
        const BOOST_ASIO_OPTION_STORAGE& storage,
        boost::system::error_code& ec);
  private:
    type value_;
  };

You should be able to use serial_port_base::flow_control::hardware in that function call you have to enable hardware flow control.

Collin
  • 11,977
  • 2
  • 46
  • 60
  • thanks for this, it was a puzzle-pice of the whole solution to by break-signal problem - I've had to extend it with the other options, to make a sound setup of my serial port. It is somewhat strange, that this is not documented, but at least now there is one way more to find out about it. This post helped too: http://stackoverflow.com/questions/267752/boost-asio-serial-port-need-help-with-io – Jook Oct 22 '12 at 14:43