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

Method GetStopBits

src/SerialStream.cpp:536–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534 }
535
536 StopBits
537 SerialStream::GetStopBits()
538 try
539 {
540 auto my_buffer = dynamic_cast<SerialStreamBuf *>(this->rdbuf()) ;
541
542 // Make sure that we are dealing with a SerialStreamBuf before
543 // proceeding. This check also makes sure that we have a non-NULL
544 // buffer associated with this stream.
545 if (my_buffer != nullptr)
546 {
547 // Try to get the number of stop bits. If the corresponding function of the
548 // SerialStreamBuf class returns STOP_BITS_INVALID, then we have a
549 // problem and the stream is no longer valid for I/O.
550 return my_buffer->GetStopBits() ;
551 }
552 // If the dynamic_cast above failed then we either have a NULL
553 // streambuf associated with this stream or we have a buffer of
554 // class other than SerialStreamBuf. In either case, we have a
555 // problem and we should stop all I/O using this stream.
556 setstate(badbit) ;
557 return StopBits::STOP_BITS_INVALID;
558 }
559 catch (const std::exception&)
560 {
561 setstate(std::ios_base::failbit) ;
562 throw ;
563 }
564
565 void
566 SerialStream::SetVMin(const short vmin)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected