libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
Packet.h
Go to the documentation of this file.
1 /* Copyright 2013-2019 Homegear GmbH
2  *
3  * libhomegear-base is free software: you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation, either version 3 of the
6  * License, or (at your option) any later version.
7  *
8  * libhomegear-base is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with libhomegear-base. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  * In addition, as a special exception, the copyright holders give
18  * permission to link the code of portions of this program with the
19  * OpenSSL library under certain conditions as described in each
20  * individual source file, and distribute linked combinations
21  * including the two.
22  * You must obey the GNU Lesser General Public License in all respects
23  * for all of the code used other than OpenSSL. If you modify
24  * file(s) with this exception, you may extend this exception to your
25  * version of the file(s), but you are not obligated to do so. If you
26  * do not wish to do so, delete this exception statement from your
27  * version. If you delete this exception statement from all source
28  * files in the program, then also delete it here.
29 */
30 
31 #ifndef PACKET_H_
32 #define PACKET_H_
33 
34 #include "../Variable.h"
35 
36 namespace BaseLib::Systems {
37 
38 class Packet {
39  public:
40  Packet() = default;
41  virtual ~Packet() = default;
42 
43  virtual int32_t getTag() { return _tag; };
44  virtual void setTag(int32_t tag) { _tag = tag; }
45  virtual int64_t getTimeReceived() { return _timeReceived; }
46  virtual int64_t getTimeSending() { return _timeSending; }
47  virtual void setTimeReceived(int64_t time) { _timeReceived = time; }
48  virtual void setTimeSending(int64_t time) { _timeSending = time; }
49 
54  virtual BaseLib::PVariable toVariable() { return std::make_shared<BaseLib::Variable>(); }
55  protected:
56  int32_t _tag = 0;
57  int64_t _timeReceived = 0;
58  int64_t _timeSending = 0;
59 };
60 
61 }
62 
63 #endif /* PACKET_H_ */
Definition: Packet.h:38
virtual void setTimeReceived(int64_t time)
Definition: Packet.h:47
int64_t _timeSending
Definition: Packet.h:58
virtual int32_t getTag()
Definition: Packet.h:43
int32_t _tag
Definition: Packet.h:56
virtual void setTag(int32_t tag)
Definition: Packet.h:44
int64_t _timeReceived
Definition: Packet.h:57
std::shared_ptr< Variable > PVariable
Definition: PhysicalInterfaceSettings.h:41
virtual void setTimeSending(int64_t time)
Definition: Packet.h:48
Definition: Acl.h:42
virtual ~Packet()=default
virtual BaseLib::PVariable toVariable()
Required by raw packet events.
Definition: Packet.h:54
virtual int64_t getTimeReceived()
Definition: Packet.h:45
virtual int64_t getTimeSending()
Definition: Packet.h:46