Skip to content

Commit 9dc1f40

Browse files
committed
return Port to pure virtual class
1 parent 46a3a84 commit 9dc1f40

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

MavLinkCom/src/serial_com/Port.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@
99
class Port {
1010
public:
1111
// write to the port, return number of bytes written or -1 if error.
12-
virtual int write(const uint8_t *ptr, int count){};
12+
virtual int write(const uint8_t *ptr, int count) = 0;
1313

1414
// read a given number of bytes from the port (blocking until the requested bytes are available).
1515
// return the number of bytes read or -1 if error.
16-
virtual int read(uint8_t *buffer, int bytesToRead){};
16+
virtual int read(uint8_t *buffer, int bytesToRead) = 0;
1717

1818
// close the port.
19-
virtual void close(){};
19+
virtual void close() = 0;
2020

21-
virtual bool isClosed(){};
21+
virtual bool isClosed() = 0;
2222

23-
virtual int getRssi(const char *ifaceName){};
23+
virtual int getRssi(const char *ifaceName) = 0;
2424

25-
Port() = default;
2625
virtual ~Port() = default;
2726
};
2827

MavLinkCom/src/serial_com/UdpClientPort.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "SocketInit.hpp"
66
#include "Utils.hpp"
77
#include "wifi.h"
8-
#include <stdio.h>
9-
#include <string.h>
8+
#include <cstdio>
9+
#include <cstring>
1010

1111
using namespace mavlink_utils;
1212

MavLinkCom/src/serial_com/UdpClientPort.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#define SERIAL_COM_UDPCLIENTPORT_HPP
66

77
#include "Port.h"
8+
#include <memory>
9+
#include <string>
810

911
class UdpClientPort : public Port {
1012
public:

0 commit comments

Comments
 (0)