khoih-prog / EthernetWebServer_SSL

Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports HTTP/HTTPS GET and POST requests, provides argument parsing, handles one client at a time. It supports Arduino boards (SAM DUE, Atmel SAM3X8E ARM Cortex-M3, SAMD21, SAMD51, ESP8266, ESP32, Adafruit nRF52, Teensy boards) using Wiznet W5x00 or ENC28J60 network shields. Ethernet_Generic library is used as default for W5x00 with custom SPI
GNU General Public License v3.0
46 stars 10 forks source link

File 'Ethernet_HttpClient.cpp' doesn't compile for Teensy 4.1 on PlatformIO #3

Closed RoSchmiSec closed 3 years ago

RoSchmiSec commented 3 years ago

When compiling 'Ethernet_HttpClient.cpp' I get the following error message:

In file included from C:\Users\Roland.platformio\packages\framework-arduinoteensy\cores\teensy4/HardwareSerial.h:106:0, from C:\Users\Roland.platformio\packages\framework-arduinoteensy\cores\teensy4/WProgram.h:46, from C:\Users\Roland.platformio\packages\framework-arduinoteensy\cores\teensy4/Arduino.h:6, from .pio\libdeps\teensy41\EthernetWebServer_SSL\src/Ethernet_HTTPClient/Ethernet_HttpClient.h:31, from .pio\libdeps\teensy41\EthernetWebServer_SSL\src\Ethernet_HTTPClient\Ethernet_HttpClient.cpp:32: C:\Users\Roland.platformio\packages\framework-arduinoteensy\cores\teensy4/Stream.h:68:6: error: 'int Stream::timedRead()' is private
int timedRead();

This is the causing code segment:

// KH test
int c = timedRead();
//int c = iClient->read();

When I change to:

// KH test
//int c = timedRead();
int c = iClient->read();

it compiles. Can this be done without risk?

khoih-prog commented 3 years ago

Hi @RoSchmiSec

Thanks again to use the library.

I forgot to add in the README that you have to copy Stream.h to replace the original Stream.h located at ./arduino-1.8.xx/hardware/teensy/avr/cores/teensy4/Stream.h

Have a look at

Packages' Patches For Teensy boards

2. For Teensy boards

To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.13/hardware/teensy/avr/boards.txt).

Supposing the Arduino version is 1.8.13. These files must be copied into the directory:

  • ./arduino-1.8.13/hardware/teensy/avr/boards.txt
  • ./arduino-1.8.13/hardware/teensy/avr/cores/teensy/Stream.h
  • ./arduino-1.8.13/hardware/teensy/avr/cores/teensy3/Stream.h
  • ./arduino-1.8.13/hardware/teensy/avr/cores/teensy4/Stream.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:

  • ./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h

Will update README shortly.

Regards,

RoSchmi commented 3 years ago

Many thanks for your help, I have to apologize that I didn't read the README in detail, so I was not aware that you already had a fix for this issue. I assume, that on PlatformIO the right way is to replace the Stream.h file in C:/Users/thisUser/.platformio/packages/framework-arduinoteensy/cores/teensy4/Stream.h respectively. I searched some time for a way to overwrite Stream.h with a custom version through an entry in platformio.ini but I was not successful. Btw: I'm happy to confirm that EthernetHttpClient_SSL works reliable (in short term tests) using an ENC28 module with EthernetENC library on the Wio Terminal board. Actually I'm on the way to port my application on Teensy 4.1.

Many thanks again. You should definitely have a 'Donation.Button' on your page.

khoih-prog commented 3 years ago

I assume, that on PlatformIO the right way is to replace the Stream.h file in C:/Users/thisUser/.platformio/packages/framework-arduinoteensy/cores/teensy4/Stream.h respectively.

I think that is the correct place to change the cores' files. If that's not correct, please ask in PIO forum as I don't have good experience in PIO yet.

Many thanks again. You should definitely have a 'Donation.Button' on your page.

You're very welcome. Your success in using the library and nice words are so encouraging, and much better than any donation to me. Certainly, if you'd like to send me an extra new board to write a library for it or add support to the board, I'd still appreciate it to save me lots of time as there are too many new products on the market