A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lr-wpan-lqi-tag.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Fraunhofer FKIE
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program 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 General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author:
18 * Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
19 */
20#include "lr-wpan-lqi-tag.h"
21
22#include <ns3/integer.h>
23
24namespace ns3
25{
26namespace lrwpan
27{
28
30
31TypeId
33{
34 static TypeId tid = TypeId("ns3::LrWpanLqiTag")
35 .SetParent<Tag>()
36 .SetGroupName("LrWpan")
37 .AddConstructor<LrWpanLqiTag>()
38 .AddAttribute("Lqi",
39 "The lqi of the last packet received",
40 IntegerValue(0),
42 MakeIntegerChecker<uint8_t>());
43 return tid;
44}
45
48{
49 return GetTypeId();
50}
51
53 : m_lqi(0)
54{
55}
56
58 : m_lqi(lqi)
59{
60}
61
64{
65 return sizeof(uint8_t);
66}
67
68void
70{
71 i.WriteU8(m_lqi);
72}
73
74void
76{
77 m_lqi = i.ReadU8();
78}
79
80void
81LrWpanLqiTag::Print(std::ostream& os) const
82{
83 os << "Lqi = " << m_lqi;
84}
85
86void
88{
89 m_lqi = lqi;
90}
91
92uint8_t
94{
95 return m_lqi;
96}
97
98} // namespace lrwpan
99} // namespace ns3
Hold a signed integer type.
Definition: integer.h:45
Introspection did not find any typical Config paths.
read and write tag data
Definition: tag-buffer.h:52
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition: tag-buffer.h:196
tag a set of bytes in a packet
Definition: tag.h:39
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Represent the LQI (Link Quality Estination).
uint32_t GetSerializedSize() const override
void Set(uint8_t lqi)
Set the LQI to the given value.
LrWpanLqiTag()
Create a LrWpanLqiTag with the default LQI 0.
uint8_t m_lqi
The current LQI value of the tag.
void Serialize(TagBuffer i) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Print(std::ostream &os) const override
void Deserialize(TagBuffer i) override
uint8_t Get() const
Get the LQI value.
static TypeId GetTypeId()
Get the type ID.
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition: integer.h:46
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.