summaryrefslogtreecommitdiffstats
path: root/Master/Masterarbeit/src/common/inc/interface_manager.h
blob: be910d44a765d325c7e27c4ae8787b42623db435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*!
 * \file interface_manager.h
 *
 * \author S. Eisenhauer
 *
 * \date 31.08.2011
 *
 * \brief Interface for accessing XORAYA hardware
 *
 * This file defines the interface for accessing XORAYA Connect hardware interfaces
 *
 */

#ifndef INTERFACE_MANAGER_H_
#define INTERFACE_MANAGER_H_

#include "global.h"
#include "x2e/ReceiveQueue.hpp"

/*!
* \brief Pure virtual interface used by other components and plugins to access XORAYA hardware
*/
class IInterfaceManager
{
public:
	/*!
	* Sends a mesage on a hardware interface
	* \param[in] i32InterfaceHandle Interface handle
	* \param[in] u32MsgId ID of the message
	* \param[in] boIsExtended TRUE indicates an extended ID (29 bit long), FALSE a standard ID (11 bit long)
	* \param[in] boIsRtrFrame is this an RTR frame
	* \param[in] pu8Data pointer to the buffer for the message payload
	* \param[in] u32DataLength Length of message payload in byte (DLC)
	* \return status code
	*/
	virtual x2e::status_t enWriteCanMessage(
			int32_t i32InterfaceHandle,
			uint32_t u32MsgId,
			bool boIsExtended,
			bool boIsRtrFrame,
			const uint8_t* pu8Data,
			uint32_t u32DataLength) = 0;

	/*!
	* Retrieve the fill level of the receive queue
	* \param[out] stFillLevel Reference to a queueFillLevel object
	* \return status code
	*/
	virtual x2e::status_t enGetQueueFillLevel(x2e::Log::queueFillLevel& stFillLevel) = 0;

	/*!
	* Get a message from the receive queue
	* \param[out] stFillLevel Reference to a queueFillLevel object
	* \param[out] pstMsgDescr Pointer to a message description object
	* \param[out] pstMsgPayload Pointer to framePayload object as buffer for the message content
	* \return status code
	*/
	virtual x2e::status_t enPeekMessage(
			x2e::Log::queueFillLevel& stFillLevel,
			x2e::Log::messageDescription* pstMsgDescr,
			x2e::Log::framePayload* pstMsgPayload) = 0;
	
	/*!
	* Enable an Hardware interface
	* \param[in] i32RequestedIntereface Interface handle
	* \return status code
	*/
	virtual x2e::status_t enEnableInterface( int32_t i32RequestedIntereface ) = 0;

	/*!
	* Enable all Hardware interface
	* \return status code
	*/
	virtual x2e::status_t enEnableAllInterfaces( void ) = 0;

	/*!
	* Gets the current 100 nanosecond timestamp of the system
	* \param[out] pu32TsHigh Upper 32 bit of the timestamp
	* \param[out] pu32TsLow Lower 32 bit of the timestamp
	* \return status code
	*/
	virtual x2e::status_t enGetTimestamp( uint32_t* pu32TsHigh, uint32_t* pu32TsLow ) = 0;

	/*!
	* wait on the internal hardware timer
	* \return status code
	*/
	virtual x2e::status_t enWait() = 0;

	/*!
	* get interface handle by a log interface id
	* \param[in] u16LogIfId log interface id
	* \return interface handle
	*/
	virtual int32_t i32GetInterfaceByLogIfId(x2e::Log::InterfaceId::ifid_t u16LogIfId) = 0;
};


#endif /* INTERFACE_MANAGER_H_ */