// -------------------------------------------------------------------------------------------------------------------- /// \file ISerialBus.h /// \brief File description // -------------------------------------------------------------------------------------------------------------------- // // vbchaos software design // // -------------------------------------------------------------------------------------------------------------------- /// $Revision: $ /// $Author: $ /// $Date: $ // (c) 2023 vbchaos // -------------------------------------------------------------------------------------------------------------------- #ifndef MAIN_HAL_INC_ISERIALBUS_H_ #define MAIN_HAL_INC_ISERIALBUS_H_ /** * ISerialBus implementation * \defgroup ISerialBus * \brief {group_description} * \addtogroup {Layer} * * Detailed description * @{ */ // -------------------------------------------------------------------------------------------------------------------- // Include files // -------------------------------------------------------------------------------------------------------------------- // CompilerIncludes // All include files that are provided by the compiler directly #include // ProjectIncludes // All include files that are provided by the project #include "FunctionStatus.h" // -------------------------------------------------------------------------------------------------------------------- // Constant and macro definitions // -------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------- // Type definitions. // -------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------- // Function declarations // -------------------------------------------------------------------------------------------------------------------- template class ISerialBus { // ----------------------------------------------------------------------------------------------------------------- // Public Section // ----------------------------------------------------------------------------------------------------------------- public: // Virtual Class Destructor (required for absolute virtual classes) virtual ~ISerialBus() {} FunctionStatus open() {status = OPEN; return FUNCTION_STATUS_OK;} FunctionStatus close() {status = CLOSED; return FUNCTION_STATUS_OK;} virtual FunctionStatus read(T* buffer, uint32_t length, uint32_t* actualLength) = 0; virtual FunctionStatus write(T* buffer, uint32_t length) = 0; // ----------------------------------------------------------------------------------------------------------------- // Protected Section // ----------------------------------------------------------------------------------------------------------------- protected: typedef enum { CLOSED = 0, OPEN } Status_t; // The current open/close status of the interface Status_t status; // ----------------------------------------------------------------------------------------------------------------- // Private Section // ----------------------------------------------------------------------------------------------------------------- private: }; /** @} */ #endif /* MAIN_HAL_INC_ISERIALBUS_H_ */