form corrections

This commit is contained in:
Robin Müller 2021-06-21 16:56:41 +02:00
parent ab01c22b60
commit fe661fff85
No known key found for this signature in database
GPG Key ID: FC76078F520434A5
2 changed files with 51 additions and 51 deletions

View File

@ -11,15 +11,15 @@ UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes
UartCookie::~UartCookie() {} UartCookie::~UartCookie() {}
uint32_t UartCookie::getBaudrate() const { uint32_t UartCookie::getBaudrate() const {
return baudrate; return baudrate;
} }
size_t UartCookie::getMaxReplyLen() const { size_t UartCookie::getMaxReplyLen() const {
return maxReplyLen; return maxReplyLen;
} }
std::string UartCookie::getDeviceFile() const { std::string UartCookie::getDeviceFile() const {
return deviceFile; return deviceFile;
} }
void UartCookie::setParityOdd() { void UartCookie::setParityOdd() {

View File

@ -32,12 +32,12 @@ enum class UartModes {
class UartCookie: public CookieIF { class UartCookie: public CookieIF {
public: public:
/** /**
* @brief Constructor for the uart cookie. * @brief Constructor for the uart cookie.
* @param deviceFile The device file specifying the uart to use, e.g. "/dev/ttyPS1" * @param deviceFile The device file specifying the uart to use, e.g. "/dev/ttyPS1"
* @param uartMode Specify the UART mode. The canonical mode should be used if the * @param uartMode Specify the UART mode. The canonical mode should be used if the
* messages are separated by a delimited character like '\n'. See the * messages are separated by a delimited character like '\n'. See the
* termios documentation for more information * termios documentation for more information
* @param baudrate The baudrate to use for input and output. Possible Baudrates are: 50, * @param baudrate The baudrate to use for input and output. Possible Baudrates are: 50,
* 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, B19200, * 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, B19200,
* 38400, 57600, 115200, 230400, 460800 * 38400, 57600, 115200, 230400, 460800
@ -46,67 +46,67 @@ public:
* Default configuration: No parity * Default configuration: No parity
* 8 databits (number of bits transfered with one uart frame) * 8 databits (number of bits transfered with one uart frame)
* One stop bit * One stop bit
*/ */
UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode, UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode,
uint32_t baudrate, size_t maxReplyLen); uint32_t baudrate, size_t maxReplyLen);
virtual ~UartCookie(); virtual ~UartCookie();
uint32_t getBaudrate() const; uint32_t getBaudrate() const;
size_t getMaxReplyLen() const; size_t getMaxReplyLen() const;
std::string getDeviceFile() const; std::string getDeviceFile() const;
Parity getParity() const; Parity getParity() const;
uint8_t getBitsPerWord() const; uint8_t getBitsPerWord() const;
StopBits getStopBits() const; StopBits getStopBits() const;
UartModes getUartMode() const; UartModes getUartMode() const;
object_id_t getHandlerId() const; object_id_t getHandlerId() const;
/** /**
* The UART ComIF will only perform a specified number of read cycles for the canonical mode. * The UART ComIF will only perform a specified number of read cycles for the canonical mode.
* The user can specify how many of those read cycles are performed for one device handler * The user can specify how many of those read cycles are performed for one device handler
* communication cycle. An example use-case would be to read all available GPS NMEA strings * communication cycle. An example use-case would be to read all available GPS NMEA strings
* at once. * at once.
* @param readCycles * @param readCycles
*/ */
void setReadCycles(uint8_t readCycles); void setReadCycles(uint8_t readCycles);
uint8_t getReadCycles() const; uint8_t getReadCycles() const;
/** /**
* Allows to flush the data which was received but has not been read yet. This is useful * Allows to flush the data which was received but has not been read yet. This is useful
* to discard obsolete data at software startup. * to discard obsolete data at software startup.
*/ */
void setToFlushInput(bool enable); void setToFlushInput(bool enable);
bool getInputShouldBeFlushed(); bool getInputShouldBeFlushed();
/** /**
* Functions two enable parity checking. * Functions two enable parity checking.
*/ */
void setParityOdd(); void setParityOdd();
void setParityEven(); void setParityEven();
/** /**
* Function two set number of bits per UART frame. * Function two set number of bits per UART frame.
*/ */
void setBitsPerWord(uint8_t bitsPerWord_); void setBitsPerWord(uint8_t bitsPerWord_);
/** /**
* Function to specify the number of stopbits. * Function to specify the number of stopbits.
*/ */
void setTwoStopBits(); void setTwoStopBits();
void setOneStopBit(); void setOneStopBit();
private: private:
const object_id_t handlerId; const object_id_t handlerId;
std::string deviceFile; std::string deviceFile;
const UartModes uartMode; const UartModes uartMode;
bool flushInput = false; bool flushInput = false;
uint32_t baudrate; uint32_t baudrate;
size_t maxReplyLen = 0; size_t maxReplyLen = 0;
Parity parity = Parity::NONE; Parity parity = Parity::NONE;
uint8_t bitsPerWord = 8; uint8_t bitsPerWord = 8;
uint8_t readCycles = 1; uint8_t readCycles = 1;
StopBits stopBits = StopBits::ONE_STOP_BIT; StopBits stopBits = StopBits::ONE_STOP_BIT;
}; };
#endif #endif