MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / process

Method process

src/Web/WebSocket.cpp:197–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void WebSocketSrv::process()
198{
199 if (true == m_isInitialized)
200 {
201 WebSocketMsg* msg = nullptr;
202
203 /* Handle all messages in the input queue. */
204 while (true == m_msgQueue.receive(&msg, 0U))
205 {
206 if (nullptr != msg)
207 {
208 if (nullptr != msg->cmd)
209 {
210 LOG_DEBUG("Websocket command: %s", msg->cmd->getCmd());
211
212 /* Parameter available? */
213 if (false == msg->parameters.isEmpty())
214 {
215 int beginIdx = 0;
216 int endIdx = msg->parameters.indexOf(DELIMITER);
217 String parStr;
218
219 while (0 <= endIdx)
220 {
221 parStr = msg->parameters.substring(beginIdx, endIdx);
222
223 LOG_DEBUG("Websocket parameter: %s", parStr.c_str());
224 msg->cmd->setPar(parStr.c_str());
225
226 beginIdx = endIdx + 1U; /* Overstep delimiter */
227 endIdx = msg->parameters.indexOf(DELIMITER, beginIdx);
228 }
229
230 parStr = msg->parameters.substring(beginIdx);
231 LOG_DEBUG("Websocket parameter: %s", parStr.c_str());
232 msg->cmd->setPar(parStr.c_str());
233 }
234
235 msg->cmd->execute(&m_webSocket, msg->clientId);
236 }
237
238 delete msg;
239 msg = nullptr;
240 }
241 }
242 }
243}
244
245/******************************************************************************
246 * Protected Methods

Callers 2

setupFunction · 0.45
loopFunction · 0.45

Calls 8

receiveMethod · 0.80
getCmdMethod · 0.80
indexOfMethod · 0.80
substringMethod · 0.80
c_strMethod · 0.80
isEmptyMethod · 0.45
setParMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected