A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
24
namespace
ns3
25
{
26
namespace
lrwpan
27
{
28
29
NS_OBJECT_ENSURE_REGISTERED
(LrWpanLqiTag);
30
31
TypeId
32
LrWpanLqiTag::GetTypeId
()
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),
41
MakeIntegerAccessor
(&
LrWpanLqiTag::Get
),
42
MakeIntegerChecker<uint8_t>());
43
return
tid;
44
}
45
46
TypeId
47
LrWpanLqiTag::GetInstanceTypeId
()
const
48
{
49
return
GetTypeId
();
50
}
51
52
LrWpanLqiTag::LrWpanLqiTag
()
53
: m_lqi(0)
54
{
55
}
56
57
LrWpanLqiTag::LrWpanLqiTag
(uint8_t lqi)
58
: m_lqi(lqi)
59
{
60
}
61
62
uint32_t
63
LrWpanLqiTag::GetSerializedSize
()
const
64
{
65
return
sizeof
(uint8_t);
66
}
67
68
void
69
LrWpanLqiTag::Serialize
(
TagBuffer
i)
const
70
{
71
i.
WriteU8
(
m_lqi
);
72
}
73
74
void
75
LrWpanLqiTag::Deserialize
(
TagBuffer
i)
76
{
77
m_lqi
= i.
ReadU8
();
78
}
79
80
void
81
LrWpanLqiTag::Print
(std::ostream& os)
const
82
{
83
os <<
"Lqi = "
<<
m_lqi
;
84
}
85
86
void
87
LrWpanLqiTag::Set
(uint8_t lqi)
88
{
89
m_lqi
= lqi;
90
}
91
92
uint8_t
93
LrWpanLqiTag::Get
()
const
94
{
95
return
m_lqi
;
96
}
97
98
}
// namespace lrwpan
99
}
// namespace ns3
ns3::IntegerValue
Hold a signed integer type.
Definition:
integer.h:45
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:52
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition:
tag-buffer.h:196
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:39
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:932
ns3::lrwpan::LrWpanLqiTag
Represent the LQI (Link Quality Estination).
Definition:
lr-wpan-lqi-tag.h:40
ns3::lrwpan::LrWpanLqiTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
lr-wpan-lqi-tag.cc:63
ns3::lrwpan::LrWpanLqiTag::Set
void Set(uint8_t lqi)
Set the LQI to the given value.
Definition:
lr-wpan-lqi-tag.cc:87
ns3::lrwpan::LrWpanLqiTag::LrWpanLqiTag
LrWpanLqiTag()
Create a LrWpanLqiTag with the default LQI 0.
Definition:
lr-wpan-lqi-tag.cc:52
ns3::lrwpan::LrWpanLqiTag::m_lqi
uint8_t m_lqi
The current LQI value of the tag.
Definition:
lr-wpan-lqi-tag.h:85
ns3::lrwpan::LrWpanLqiTag::Serialize
void Serialize(TagBuffer i) const override
Definition:
lr-wpan-lqi-tag.cc:69
ns3::lrwpan::LrWpanLqiTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
lr-wpan-lqi-tag.cc:47
ns3::lrwpan::LrWpanLqiTag::Print
void Print(std::ostream &os) const override
Definition:
lr-wpan-lqi-tag.cc:81
ns3::lrwpan::LrWpanLqiTag::Deserialize
void Deserialize(TagBuffer i) override
Definition:
lr-wpan-lqi-tag.cc:75
ns3::lrwpan::LrWpanLqiTag::Get
uint8_t Get() const
Get the LQI value.
Definition:
lr-wpan-lqi-tag.cc:93
ns3::lrwpan::LrWpanLqiTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
lr-wpan-lqi-tag.cc:32
uint32_t
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
lr-wpan-lqi-tag.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeIntegerAccessor
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition:
integer.h:46
src
lr-wpan
model
lr-wpan-lqi-tag.cc
Generated on Mon Aug 12 2024 11:16:15 for ns-3 by
1.9.6