source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/src/Messages/CapturedData.h @ 53

Last change on this file since 53 was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/**
2 * @file CapturedData.h
3 * This header file defines the CapturedData class.
4 * @author Tomas Urban
5 * @version 0.1
6 * @date 16/07/2009
7 */
8#ifndef CAPTURED_DATA_H
9#define CAPTURED_DATA_H
10
11#include "TrafficCaptureMessage.h"
12#include "TrafficCaptureMessageId.h"
13
14/**
15 * This class describes a message used for passing captured data to the lower tester.
16 */
17class CapturedData : public TrafficCaptureMessage
18{
19private:
20        char * m_pCapturedData;
21        unsigned int m_nCapturedLen;
22        struct timeval m_timestamp;
23        ECaptureType m_captureType;
24protected:
25        virtual unsigned int CalculateDataLength();
26        virtual void EncodePayload(unsigned int & nOffset);
27        virtual bool DecodePayload(const char * pPayload, unsigned int nPayloadLength, unsigned int & nOffset);
28public:
29        CapturedData(void);
30        virtual ~CapturedData(void);
31        virtual unsigned short GetId() const { return CAPTURED_PACKET_IND; }
32        /**
33         * Stores captured data.
34         * @param nLen Length of the captured data
35         * @param pData Buffer containing the captured data
36         */
37        void SetData (int nLen, const char * pData);
38        /**
39         * Returns the length of captured data.
40         * @return Length of the captured data
41         */
42        int GetDataLength() const { return m_nCapturedLen; };
43        /**
44         * Return a pointer to the buffer containing captured data.
45         * @return Pointer to captured data
46         */
47        const char * GetData() const { return m_pCapturedData; }
48        /**
49         * Sets the time when capture has occurred.
50         * @param timestamp Time of capture
51         */
52        void SetTimestamp(struct timeval timestamp);
53        /**
54         * Returns time of capture.
55         * @return Time of capture
56         */
57        struct timeval GetTimestamp() const { return m_timestamp; }
58        /**
59         * Sets a type of device that captured the data
60         * @param captureType Type of capturing device
61         */
62        void SetCaptureType(ECaptureType captureType);
63        /**
64         * Returns a type of device that captured the data
65         * @return Type of capturing device
66         */
67        ECaptureType GetCaptureType() const { return m_captureType; }
68        /**
69         * Converts the object to a string. Used for logging purposes
70         * @return String representation of the object.
71         */
72        std::string ToString();
73};
74
75#endif
Note: See TracBrowser for help on using the repository browser.