'Stream Function of Arduino equivalent in Free Rtos ESP-IDF
i am trying to find an equivalent function on ESP-IDF that will be like Stream() of arduino , what i am trying to do is to make an MSP function to communicate with the MSP protocol with the ESPs UART, i am using ESP-IDF and Free-Rtos in an Ubuntu environment and cmake to built
https://www.arduino.cc/reference/en/language/functions/communication/stream/ https://github.com/yajo10/MSP-Arduino/blob/master/MSP.cpp
i tryied to use std::ostringstream* but obviously doesnt make the same job
Solution 1:[1]
ostringstream is a specialised ostream where the "device" is a memory buffer. Stream is an unspecialised base class for a number of device sub-classes, and it is bi-directional. The standard library equivalent given a suitable stream I/O driver would be std::istream and std::ostream for input and output respectively, each opened on the specific device. In most cases you would use the derived std::ifstream and std::ofstream class s and open the device as a "file stream".
If you require an identical interface in order to use the code unmodified, then implementing Stream as a wrapper around iostream is feasible.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
