Skip to content

Commit 49048cf

Browse files
fixing imports and variable names
1 parent 02d1627 commit 49048cf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libraries/lwIpWrapper/src/lwipClient.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ extern "C" {
55
#include "Arduino.h"
66

77
#include "lwipClient.h"
8-
8+
#include "CNetIf.h"
9+
#include "utils.h"
910
// FIXME understand hos to syncronize the interrupt thread and "userspace"
1011
// TODO look into tcp_bind_netif for Ethernet and WiFiClient classes
1112
// TODO generalize the functions for extracting and inserting data into pbufs, they may be reused in UDP
@@ -203,7 +204,7 @@ size_t lwipClient::write(uint8_t b) {
203204
return write(&b, 1);
204205
}
205206

206-
size_t lwipClient::write(const uint8_t* buf, size_t size) {
207+
size_t lwipClient::write(const uint8_t* buffer, size_t size) {
207208
arduino::lock();
208209

209210
uint8_t* buffer_cursor = (uint8_t*)buffer;
@@ -244,23 +245,23 @@ int lwipClient::read() {
244245
return res == 1 ? c : res;
245246
}
246247

247-
int lwipClient::read(uint8_t* buf, size_t size) {
248-
if(buffer_size==0 || buffer==nullptr || this->pbuf_head==nullptr) {
248+
int lwipClient::read(uint8_t* buffer, size_t size) {
249+
if(size==0 || buffer==nullptr || this->pbuf_head==nullptr) {
249250
return 0; // TODO extend checks
250251
}
251252
// copy data from the lwip buffer to the app provided buffer
252253
// TODO look into pbuf_get_contiguous(this->pbuf_head, buffer_cursor, len);
253-
// pbuf_get_contiguous: returns the pointer to the payload if buffer_size <= pbuf.len
254+
// pbuf_get_contiguous: returns the pointer to the payload if size <= pbuf.len
254255
// otherwise copies data in the user provided buffer. This can be used in a callback paradigm,
255256
// in order to avoid memcpy data
256257

257258
/*
258-
* a chain of pbuf is not granted to have a size multiple of buffer_size length
259+
* a chain of pbuf is not granted to have a size multiple of size length
259260
* meaning that across different calls of this function a pbuf could be partially copied
260261
* we need to account that
261262
*/
262263
arduino::lock();
263-
uint16_t copied = pbuf_copy_partial(this->pbuf_head, buffer, buffer_size, this->pbuf_offset);
264+
uint16_t copied = pbuf_copy_partial(this->pbuf_head, buffer, size, this->pbuf_offset);
264265

265266
this->free_pbuf_chain(copied);
266267
// __enable_irq();

0 commit comments

Comments
 (0)