i am looking at ELM327 library and to make a wrapper for B4R seem simple except for a stream.
when it is in arduino, it is simple :
case stream from serial :
and it is OK... with Serial stream and with wifi stream
but when serial is open in B4R, i am not able to send stream from B4R::Serial to this function.
i tested to send object "Serial"
i tested to send B4RStream* "Serial.Stream"
my B4R code is :
wrapper and arduino libray are:
How we can send a stream from B4R object to Arduino library ? i didn't find the solution....
issue seems to convert B4R::B4RStream to stream.
thanks for your help
when it is in arduino, it is simple :
case stream from serial :
B4X:
SoftwareSerial mySerial(2, 3); // RX, TX
#define ELM_PORT mySerial
ELM327 myELM327;
ELM_PORT.begin(115200);
myELM327.begin(ELM_PORT);
//original library
bool begin(Stream& stream, char protocol='0', uint16_t payloadLen = 40);
and it is OK... with Serial stream and with wifi stream
but when serial is open in B4R, i am not able to send stream from B4R::Serial to this function.
i tested to send object "Serial"
i tested to send B4RStream* "Serial.Stream"
my B4R code is :
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private ELM As ELM327
Private ELMserial As SoftwareSerial
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
ELMserial.Initialize(33000, 2, 3)
Log("AppStart")
'example of connecting to a local network
' ELM.begin(ELMserial,0,40)
ELM.begin1(ELMserial.Stream,0,40)
End Sub
B4X:
//case wrapper and object sent by B4R project
// bool B4RELM327::begin(Object* ELMstream, byte protocol, uint16_t payloadLen)
// {
// return elm327.begin(ELMstream, protocol, payloadLen);
// }
//case wrapper and stream sent by B4R project
bool B4RELM327::begin1(B4RStream* ELMstream, byte protocol, uint16_t payloadLen)
{
return elm327.begin(ELMstream, protocol, payloadLen);
}
//original library
bool begin(Stream& stream, char protocol='0', uint16_t payloadLen = 40);
How we can send a stream from B4R object to Arduino library ? i didn't find the solution....
issue seems to convert B4R::B4RStream to stream.
thanks for your help