-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create network client interface class
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include <Client.h> | ||
#include <WiFiClient.h> | ||
|
||
class NetworkClient : public Client { | ||
public: | ||
NetworkClient(); | ||
NetworkClient(WiFiClient wifi_client); | ||
virtual ~NetworkClient() = default; | ||
|
||
int connect(IPAddress ip, uint16_t port) final; | ||
int connect(const char * host, uint16_t port) final; | ||
int connect(const char * host, uint16_t port, int32_t timeout); | ||
size_t write(uint8_t) final; | ||
size_t write(const uint8_t * buf, size_t size) final; | ||
size_t write(const char * str); | ||
int available() final; | ||
int read() final; | ||
int read(uint8_t * buf, size_t size) final; | ||
int peek() final; | ||
void flush() final; | ||
void stop() final; | ||
uint8_t connected() final; | ||
operator bool() final; | ||
|
||
void setCACert(const char * rootCA); | ||
void setCACertBundle(const uint8_t * bundle); | ||
void setInsecure(); | ||
bool verify(const char * fingerprint, const char * domain_name); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters