-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathTCPClientMock.h
More file actions
45 lines (36 loc) · 1.4 KB
/
TCPClientMock.h
File metadata and controls
45 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright (c) 2020 Arduino. All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef TCPCLIENT_MOCK_H_
#define TCPCLIENT_MOCK_H_
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <api/Client.h>
/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/
/*
* The purpose of this class is currently to highlight the effects of lacking virtual destructor
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
class TCPClientMock : public arduino::Client {
public:
virtual int connect(IPAddress ip, uint16_t port) { return 0; }
virtual int connect(const char *host, uint16_t port) { return 0; }
virtual size_t write(uint8_t) { return 0; }
virtual size_t write(const uint8_t *buf, size_t size) { return 0;}
virtual int available() { return 0; }
virtual int read() { return 0; }
virtual int read(uint8_t *buf, size_t size) { return 0;}
virtual int peek() { return 0; }
virtual void flush() {}
virtual void stop() {}
virtual uint8_t connected() { return 0;}
virtual operator bool() { return true; }
};
#pragma GCC diagnostic pop
#endif /* TCPCLIENT_MOCK_H_ */