question

Upvotes
Accepted
3 0 0 3

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 512.0 KiB each and 1.0 MiB total.

Monitored by @Warat B.

1 Answer

· Write an 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 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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