Hope this question finds you well, I am a software engineer and I am currently working on a headend project. I am having trouble understanding the purpose of the GXSynchronousMediaBase class in the media classes like GXSerial, GXNet, and GXMqtt. I saw the javadoc but the information it provides is not enough.
GXSynchronousMediaBase is used to send data synchronously. Bytes that are received from the serial port are saved there until all data has been received. You can define the number of bytes to read or set the End Of Packet that will cause bytes to be read for the buffer until eop byte has been received.
When you send data asynchronously data is coming from IGXMediaListener.onReceived method as soon as it's read from the serial port.
//Send data synchronously.
synchronized (Media.getSynchronous())
{
Media.send(data, null);
succeeded = Media.receive(p);
//Data is stored to p.getReply().
}
//Send data asynchronously
Media.send(data, null);
Hello Adonay Eshetu,
Hello Adonay Eshetu,
GXSynchronousMediaBase is used to send data synchronously. Bytes that are received from the serial port are saved there until all data has been received. You can define the number of bytes to read or set the End Of Packet that will cause bytes to be read for the buffer until eop byte has been received.
When you send data asynchronously data is coming from IGXMediaListener.onReceived method as soon as it's read from the serial port.
//Send data synchronously.
synchronized (Media.getSynchronous())
{
Media.send(data, null);
succeeded = Media.receive(p);
//Data is stored to p.getReply().
}
//Send data asynchronously
Media.send(data, null);
BR,
Mikko
Hello Mikko Kurunsaari,
Hello Mikko Kurunsaari,
Thank you for your instant reply.
Sincerely,
Adonay Eshetu.