MCPcopy Create free account
hub / github.com/ayushsharma82/WebSerial / _send

Method _send

src/WebSerial.cpp:191–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189
190#ifdef WSL_HIGH_PERF
191void WebSerialClass::_send(const uint8_t* buffer, size_t size) {
192 if (_ws && size > 0) {
193 _ws->cleanupClients(WSL_MAX_WS_CLIENTS);
194 if (_ws->count()) {
195 if (size > UINT16_MAX)
196 size = UINT16_MAX;
197 AsyncWebSocketMessageBuffer* wsbuffer = _ws->makeBuffer(WSL_HEAD_LEN + WSL_MSG_SIZE_LEN + size);
198 _write_row_packet(wsbuffer->get(), buffer, size);
199 _ws->binaryAll(wsbuffer);
200 }
201 }
202
203 // if buffer grew too much, free it, otherwise clear it
204 if (_initialBufferCapacity) {
205 if (_buffer.length() > _initialBufferCapacity) {
206 setBuffer(_initialBufferCapacity);
207 } else {
208 #if defined(TARGET_RP2040) || defined(TARGET_RP2350) || defined(PICO_RP2040) || defined(PICO_RP2350)
209 _buffer = "";
210 #else
211 _buffer.clear();
212 #endif
213 }
214 }
215}
216
217#else // WSL_HIGH_PERF
218

Callers

nothing calls this directly

Calls 1

makeBufferMethod · 0.80

Tested by

no test coverage detected