20
20
21
21
#include " CEspControl.h"
22
22
23
- extern int esp_host_perform_spi_communication ();
24
- extern int esp_host_spi_init (void );
25
-
26
-
27
23
/* -------------------------------------------------------------------------- */
28
24
/* GET INSTANCE SINGLETONE FUNCTION */
29
25
/* -------------------------------------------------------------------------- */
@@ -48,11 +44,6 @@ CEspControl::~CEspControl() {
48
44
49
45
}
50
46
51
-
52
-
53
-
54
-
55
-
56
47
/* process priv messages */
57
48
/* -------------------------------------------------------------------------- */
58
49
int CEspControl::process_priv_messages (CCtrlMsgWrapper* response) {
@@ -90,6 +81,25 @@ uint8_t *CEspControl::getStationRx(uint8_t &if_num, uint16_t &dim) {
90
81
return rv;
91
82
}
92
83
84
+ /* -------------------------------------------------------------------------- */
85
+ uint16_t CEspControl::getStationRx (uint8_t &if_num, uint8_t *buff, uint16_t dim) {
86
+ /* -------------------------------------------------------------------------- */
87
+ CMsg msg;
88
+ // __disable_irq();
89
+ bool res = CEspCom::getMsgForStation (msg);
90
+ if (!res) {
91
+ CEspCom::clearStationRx ();
92
+ return 0 ;
93
+ }
94
+ // __enable_irq();
95
+ if_num = msg.get_if_num ();
96
+ uint16_t len = msg.get_protobuf_dim ();
97
+ if (len > dim)
98
+ return -1 ;
99
+ memcpy (buff, msg.data (), len);
100
+ return len;
101
+ }
102
+
93
103
/* -------------------------------------------------------------------------- */
94
104
uint16_t CEspControl::peekStationRxMsgSize () {
95
105
/* -------------------------------------------------------------------------- */
@@ -100,6 +110,16 @@ uint16_t CEspControl::peekStationRxMsgSize() {
100
110
return res;
101
111
}
102
112
113
+ /* -------------------------------------------------------------------------- */
114
+ uint16_t CEspControl::peekStationRxPayloadLen () {
115
+ /* -------------------------------------------------------------------------- */
116
+ uint16_t res;
117
+ // __disable_irq();
118
+ res = CEspCom::peekPayloadLenForStation ();
119
+ // __enable_irq();
120
+ return res;
121
+ }
122
+
103
123
/* -------------------------------------------------------------------------- */
104
124
uint8_t *CEspControl::getSoftApRx (uint8_t &if_num, uint16_t &dim) {
105
125
/* -------------------------------------------------------------------------- */
@@ -122,6 +142,34 @@ uint8_t *CEspControl::getSoftApRx(uint8_t &if_num, uint16_t &dim) {
122
142
return rv;
123
143
}
124
144
145
+ /* -------------------------------------------------------------------------- */
146
+ uint16_t CEspControl::getSoftApRx (uint8_t &if_num, uint8_t *buff, uint16_t dim) {
147
+ /* -------------------------------------------------------------------------- */
148
+ CMsg msg;
149
+ // __disable_irq();
150
+ bool res = CEspCom::getMsgForSoftAp (msg);
151
+ if (!res) {
152
+ CEspCom::clearSoftApRx ();
153
+ return 0 ;
154
+ }
155
+ // __enable_irq();
156
+ if_num = msg.get_if_num ();
157
+ uint16_t len = msg.get_protobuf_dim ();
158
+ if (len > dim)
159
+ return -1 ;
160
+ memcpy (buff, msg.data (), len);
161
+ return len;
162
+ }
163
+
164
+ /* -------------------------------------------------------------------------- */
165
+ uint16_t CEspControl::peekSoftApRxPayloadLen () {
166
+ /* -------------------------------------------------------------------------- */
167
+ uint16_t res;
168
+ // __disable_irq();
169
+ res = CEspCom::peekPayloadLenForSoftAp ();
170
+ // __enable_irq();
171
+ return res;
172
+ }
125
173
126
174
/* -------------------------------------------------------------------------- */
127
175
/* PROCESS CONTROL MESSAGES */
0 commit comments