Skip to content

Commit

Permalink
CellularConnectionHandler: Generate runtime error if getUDP() is called
Browse files Browse the repository at this point in the history
__attribute__((error)) not working on virtual functions
  • Loading branch information
pennam committed Jun 3, 2024
1 parent 3ac5c05 commit 075c689
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/Arduino_CellularConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ unsigned long CellularConnectionHandler::getTime()
return _cellular.getCellularTime().getUNIXTimestamp();
}

UDP & CellularConnectionHandler::getUDP()
{
Debug.print(DBG_ERROR, F("CellularConnectionHandler has no UDP support"));
while(1) {};
}

/******************************************************************************
PROTECTED MEMBER FUNCTIONS
******************************************************************************/
Expand Down
3 changes: 1 addition & 2 deletions src/Arduino_CellularConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include "Arduino_ConnectionHandler.h"


#ifdef BOARD_HAS_CELLULAR /* Only compile if the board has Cellular */

/******************************************************************************
Expand All @@ -34,7 +33,7 @@ class CellularConnectionHandler : public ConnectionHandler

virtual unsigned long getTime() override;
virtual Client & getClient() override { return _gsm_client; };
virtual UDP & getUDP() override { } __attribute__((error("CellularConnectionHandler has no UDP support")));
virtual UDP & getUDP() override;


protected:
Expand Down

0 comments on commit 075c689

Please sign in to comment.