Skip to content

Commit

Permalink
WiFiServer operator bool
Browse files Browse the repository at this point in the history
  • Loading branch information
JAndrassy committed Oct 5, 2023
1 parent 1634ec2 commit e05cae1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/WiFiServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ uint8_t WiFiServer::status() {
return 0;
}

WiFiServer::operator bool() {
return (_socket != -1 && WiFiSocket.listening(_socket));
}

size_t WiFiServer::write(uint8_t b)
{
return write(&b, 1);
Expand Down
1 change: 1 addition & 0 deletions src/WiFiServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class WiFiServer : public Server {
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
uint8_t status();
explicit operator bool();

using Print::write;

Expand Down

0 comments on commit e05cae1

Please sign in to comment.