source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/src/UpperTestAdapter/TriggerCommandsGUI/UEUserGuideClientMessages.cpp @ 48

Last change on this file since 48 was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#include "UEUserGuideClientMessages.h"
2
3namespace UpperTestAdapter {
4 
5namespace Processors {
6 
7namespace TriggerCommandsGUI {
8 
9void 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
16unsigned 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
27void 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
37bool 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
57void UEUserGuideClientReply::EncodePayload(unsigned int & nOffset)
58{
59        TrafficCaptureMessage::EncodePayload(nOffset);
60}
61
62bool 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
Note: See TracBrowser for help on using the repository browser.