[22] | 1 | #include "UEUserGuideClientMessages.h"
|
---|
| 2 |
|
---|
| 3 | namespace UpperTestAdapter {
|
---|
| 4 |
|
---|
| 5 | namespace Processors {
|
---|
| 6 |
|
---|
| 7 | namespace TriggerCommandsGUI {
|
---|
| 8 |
|
---|
| 9 | void UEUserGuideClientRequest::SetTriggerCommand(const std::string & sTrigger, const std::vector<std::string> & vsParamsList)
|
---|
| 10 | {
|
---|
| 11 | DisposeEncodedData();
|
---|
| 12 | m_sTrigger = sTrigger;
|
---|
| 13 | m_vsParamsList = vsParamsList;
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | unsigned int UEUserGuideClientRequest::CalculateDataLength()
|
---|
| 17 | {
|
---|
| 18 | int nLen = TrafficCaptureMessage::CalculateDataLength() +
|
---|
| 19 | CalculateStringLength(m_sTrigger) +
|
---|
| 20 | sizeof(unsigned int);
|
---|
| 21 | int nCount = m_vsParamsList.size();
|
---|
| 22 | for (int i = 0; i < nCount; ++i)
|
---|
| 23 | nLen += CalculateStringLength(m_vsParamsList[i]);
|
---|
| 24 | return nLen;
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | void UEUserGuideClientRequest::EncodePayload(unsigned int & nOffset)
|
---|
| 28 | {
|
---|
| 29 | TrafficCaptureMessage::EncodePayload(nOffset);
|
---|
| 30 | EncodeString(m_sTrigger, nOffset);
|
---|
| 31 | unsigned int nCount = m_vsParamsList.size();
|
---|
| 32 | EncodeUInt(nCount, nOffset);
|
---|
| 33 | for (unsigned int i = 0; i < nCount; ++i)
|
---|
| 34 | EncodeString(m_vsParamsList[i], nOffset);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | bool UEUserGuideClientRequest::DecodePayload(const char * pPayload, unsigned int nPayloadLength,
|
---|
| 38 | unsigned int & nOffset)
|
---|
| 39 | {
|
---|
| 40 | if (!TrafficCaptureMessage::DecodePayload(pPayload, nPayloadLength, nOffset))
|
---|
| 41 | return false;
|
---|
| 42 | if (!DecodeString(m_sTrigger, pPayload, nPayloadLength, nOffset))
|
---|
| 43 | return false;
|
---|
| 44 | unsigned int nCount = 0;
|
---|
| 45 | if (!DecodeUInt(nCount, pPayload, nPayloadLength, nOffset))
|
---|
| 46 | return false;
|
---|
| 47 | m_vsParamsList.clear();
|
---|
| 48 | for (unsigned int i = 0; i < nCount; ++i)
|
---|
| 49 | {
|
---|
| 50 | m_vsParamsList.push_back("");
|
---|
| 51 | if (!DecodeString(m_vsParamsList[i], pPayload, nPayloadLength, nOffset))
|
---|
| 52 | return false;
|
---|
| 53 | }
|
---|
| 54 | return true;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | void UEUserGuideClientReply::EncodePayload(unsigned int & nOffset)
|
---|
| 58 | {
|
---|
| 59 | TrafficCaptureMessage::EncodePayload(nOffset);
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | bool UEUserGuideClientReply::DecodePayload(const char * pPayload, unsigned int nPayloadLength, unsigned int & nOffset)
|
---|
| 63 | {
|
---|
| 64 | if (!TrafficCaptureMessage::DecodePayload(pPayload, nPayloadLength, nOffset))
|
---|
| 65 | return false;
|
---|
| 66 | return true;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | } } } // namespaces
|
---|