mFrame
載入中...
搜尋中...
無符合項目
SerialBusDevice.h
1
7#ifndef MFRAME_883AFE3A_63E9_470C_B1ED_2E02C0817EF2
8#define MFRAME_883AFE3A_63E9_470C_B1ED_2E02C0817EF2
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15#include "./../io/SerialBus.h"
16#include "./../lang/Object.h"
17//----------------------------------------------------------------------------------------
18
19/* ***************************************************************************************
20 * Namespace
21 */
22namespace ufm::io {
23 class SerialBusDevice;
24} // namespace ufm::io
25
26/* ***************************************************************************************
27 * Class/Interface/Struct/Enum
28 */
29
40 /* *************************************************************************************
41 * Status
42 */
43 public:
44 enum struct State : uint8_t {
45 IDLE = 0,
46 COMPLETE = 1,
47 NO_RESPONSE = 2,
48 BUS_ERROR = 3,
49 CANCEL = 4
50 };
51 /* *************************************************************************************
52 * Variable
53 */
54 private:
55 int vCompletedQuantity;
56 State vState;
57
58 /* *************************************************************************************
59 * Abstract Method
60 */
61
62 /* *************************************************************************************
63 * Construct Method
64 */
65 public:
71
76 virtual ~SerialBusDevice(void) override;
77
78 /* *************************************************************************************
79 * Operator Method
80 */
81
82 /* *************************************************************************************
83 * Override Method - hal::serial::SerialBusEvent
84 */
85 public:
86 virtual void onComplete(void) override;
87
88 virtual void onNoResponseEvent(int completedQuantity) override;
89
90 virtual void onBusErrorEvent(int completedQuantity) override;
91
92 virtual void onCancel(int completedQuantity) override;
93
94 /* *************************************************************************************
95 * Public Method
96 */
97 public:
98 void flush(void);
99
100 inline int getCompletedQuantity(void) const {
101 return this->vCompletedQuantity;
102 }
103
104 inline State getStatus(void) const {
105 return this->vState;
106 }
107
108 inline bool isIdle(void) const {
109 return (this->vState == State::IDLE);
110 }
111
112 inline bool isComplete(void) const {
113 return (this->vState == State::COMPLETE);
114 }
115
116 inline bool isNoResponse(void) const {
117 return (this->vState == State::NO_RESPONSE);
118 }
119
120 inline bool isBusError(void) const {
121 return (this->vState == State::BUS_ERROR);
122 }
123
124 inline bool isCancel(void) const {
125 return (this->vState == State::CANCEL);
126 }
127
128 /* *************************************************************************************
129 * Protected Method
130 */
131
132 /* *************************************************************************************
133 * Private Method
134 */
135
136 /* *************************************************************************************
137 * Static Variable
138 */
139
140 /* *************************************************************************************
141 * Static Method
142 */
143};
144
145/* ***************************************************************************************
146 * End of file
147 */
148
149#endif /* MFRAME_883AFE3A_63E9_470C_B1ED_2E02C0817EF2 */
序列總線裝置類別
Definition SerialBusDevice.h:39
virtual void onComplete(void) override
當傳輸完成時調用
virtual ~SerialBusDevice(void) override
Destroy the object.
virtual void onCancel(int completedQuantity) override
當傳輸被取消時調用
virtual void onNoResponseEvent(int completedQuantity) override
當發生無回應事件時調用
SerialBusDevice(void)
Construct a new object.
virtual void onBusErrorEvent(int completedQuantity) override
當發生總線忙碌事件時調用
物件基底類別
Definition Object.h:63
Definition Buffer.h:24
[Interface] 序列總線事件監聽器
Definition SerialBus.h:56