MCPcopy Create free account
hub / github.com/crayzeewulf/libserial / SetFlowControl

Method SetFlowControl

src/SerialStream.cpp:385–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383 }
384
385 void
386 SerialStream::SetFlowControl(const FlowControl& flowControlType)
387 try
388 {
389 auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ;
390
391 // Make sure that we are dealing with a SerialStreamBuf before
392 // proceeding. This check also makes sure that we have a non-NULL
393 // buffer associated with this stream.
394 if (my_buffer != nullptr)
395 {
396 // Try to set the flow control. If the corresponding function of the
397 // SerialStreamBuf class returns FLOW_CONTROL_INVALID, then we have a
398 // problem and the stream is no longer valid for I/O.
399 my_buffer->SetFlowControl(flowControlType) ;
400 }
401 else
402 {
403 // If the dynamic_cast above failed then we either have a NULL
404 // streambuf associated with this stream or we have a buffer of
405 // class other than SerialStreamBuf. In either case, we have a
406 // problem and we should stop all I/O using this stream.
407 setstate(badbit) ;
408 }
409 }
410 catch (const std::exception&)
411 {
412 setstate(std::ios_base::failbit) ;
413 throw ;
414 }
415
416 FlowControl
417 SerialStream::GetFlowControl()

Callers 1

SerialStreamMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected