MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/peripheral/ISerialPort.hh
2024-06-07 11:12:56 +03:00

38 lines
1.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* ISerialPort.h
*
* Created on: 10 июн. 2019 г.
* Author: krugliy
*/
#ifndef SOURCE_PERIPHERAL_ISERIALPORT_H_
#define SOURCE_PERIPHERAL_ISERIALPORT_H_
namespace peripheral {
//transmite - возвращает true, если фрэйм может быть немедленно отправлен.
//transmite можно вызвать несколько раз подряд, и с помощью функции receive прочитать данные
//полученные как ответ на последний transmite вернувший true.
//receive - прочитать данные, полученные как ответ на последний transmite вернувший true.
//Это означает, что прочитать данные без предшествующего transmite, вернувшего true, не получится
class ISerialPort {
public:
virtual bool transmite( const void * bit_stream, int bit_count ) = 0;
virtual bool receive( void * data ) = 0;
//поскольку реализация по любому должна знать сколько ожидает байт в ответ,
//то может реализовать и эту функцию
virtual bool isDataReady() = 0;
// virtual void reset() = 0;
virtual ~ISerialPort() {}
};
}
#endif /* SOURCE_PERIPHERAL_ISERIALPORT_H_ */