question

Upvotes
Accepted
3 0 0 2

How to encode / decode? Create RespMsg objects from Buffer?

Once we log RSSL messages to a file using confilg parameter
Connections\Name\traceMsgToFile = True

Or manually writing a message to file through buffer
respMsg.getEncodedBuffer()

How to create the original objects (RespMsg, in this case) from these buffers / Files?
I want to recreate original messages for playback / replaying / testing etc..

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
4.4k 10 6 9

Hi @nblp

You can use setEncodedBuffer() to create the response message from the buffer you got from getEncodedBuffer().

So, in your recorder app you can save the encoded buffer:

const rfa::common::Msg& msg = event.getMsg();
rfa::common::Buffer tempBuffer = msg.getEncodedBuffer();
//Save tempBuffer.c_buf() and tempBuffer.size()

Then when you want to playback:

//Load saved tempBuffer.c_buf() and tempBuffer.size() to _str and _size
rfa::common::Buffer tempBuffer;
tempBuffer.setFrom(_str, _size);

RespMsg respMsg;
respMsg.setEncodedBuffer(tempBuffer);

Playing back from the RFA trace file is trickier.

The API does not have any function that helps you read the XML trace file. You have to parse the XML trace file and construct the message yourself.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea