1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 06:23:07 +01:00

use GwBuffer::fillData for udp receive

This commit is contained in:
andreas
2024-11-11 20:28:57 +01:00
parent b4eaad4dbf
commit 098b9ba558
3 changed files with 12 additions and 22 deletions

View File

@@ -33,16 +33,6 @@ size_t GwBuffer::freeSpace()
}
return readPointer - writePointer - 1;
}
size_t GwBuffer::continousSpace() const{
if (readPointer <= writePointer){
return bufferSize-offset(writePointer);
}
return readPointer-writePointer-1;
}
void GwBuffer::moveWp(size_t offset){
if (offset > continousSpace()) return;
writePointer+=offset;
}
size_t GwBuffer::usedSpace()
{
if (readPointer <= writePointer)

View File

@@ -18,9 +18,9 @@ class GwMessageFetcher{
* buffer to safely inserte data if it fits
* and to write out data if possible
*/
typedef size_t (*GwBufferHandleFunction)(uint8_t *buffer, size_t len, void *param);
class GwBuffer{
public:
using GwBufferHandleFunction=std::function<size_t(uint8_t *buffer, size_t len, void *param)>;
static const size_t TX_BUFFER_SIZE=1620; // app. 20 NMEA messages
static const size_t RX_BUFFER_SIZE=600; // enough for 1 NMEA message or actisense message or seasmart message
typedef enum {
@@ -54,9 +54,6 @@ class GwBuffer{
* find the first occurance of x in the buffer, -1 if not found
*/
int findChar(char x);
uint8_t *getWp(){return writePointer;}
size_t continousSpace() const; //free space from wp
void moveWp(size_t offset); //move the wp forward
};
#endif