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
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author:
7
* Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
8
*/
9
#include "
lr-wpan-lqi-tag.h
"
10
11
#include <ns3/integer.h>
12
13
namespace
ns3
14
{
15
namespace
lrwpan
16
{
17
18
NS_OBJECT_ENSURE_REGISTERED
(LrWpanLqiTag);
19
20
TypeId
21
LrWpanLqiTag::GetTypeId
()
22
{
23
static
TypeId
tid =
TypeId
(
"ns3::lrwpan::LrWpanLqiTag"
)
24
.
AddDeprecatedName
(
"ns3::LrWpanLqiTag"
)
25
.
SetParent
<
Tag
>()
26
.SetGroupName(
"LrWpan"
)
27
.AddConstructor<
LrWpanLqiTag
>()
28
.AddAttribute(
"Lqi"
,
29
"The lqi of the last packet received"
,
30
IntegerValue
(0),
31
MakeIntegerAccessor
(&
LrWpanLqiTag::Get
),
32
MakeIntegerChecker<uint8_t>
());
33
return
tid;
34
}
35
36
TypeId
37
LrWpanLqiTag::GetInstanceTypeId
()
const
38
{
39
return
GetTypeId
();
40
}
41
42
LrWpanLqiTag::LrWpanLqiTag
()
43
: m_lqi(0)
44
{
45
}
46
47
LrWpanLqiTag::LrWpanLqiTag
(uint8_t lqi)
48
: m_lqi(lqi)
49
{
50
}
51
52
uint32_t
53
LrWpanLqiTag::GetSerializedSize
()
const
54
{
55
return
sizeof
(uint8_t);
56
}
57
58
void
59
LrWpanLqiTag::Serialize
(
TagBuffer
i)
const
60
{
61
i.
WriteU8
(
m_lqi
);
62
}
63
64
void
65
LrWpanLqiTag::Deserialize
(
TagBuffer
i)
66
{
67
m_lqi
= i.
ReadU8
();
68
}
69
70
void
71
LrWpanLqiTag::Print
(std::ostream& os)
const
72
{
73
os <<
"Lqi = "
<<
m_lqi
;
74
}
75
76
void
77
LrWpanLqiTag::Set
(uint8_t lqi)
78
{
79
m_lqi
= lqi;
80
}
81
82
uint8_t
83
LrWpanLqiTag::Get
()
const
84
{
85
return
m_lqi
;
86
}
87
88
}
// namespace lrwpan
89
}
// namespace ns3
ns3::IntegerValue
Hold a signed integer type.
Definition
integer.h:34
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition
tag-buffer.h:161
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition
tag-buffer.h:185
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::AddDeprecatedName
TypeId AddDeprecatedName(const std::string &name)
Add an deprecated name for a TypeId.
Definition
type-id.cc:862
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
ns3::lrwpan::LrWpanLqiTag
Represent the LQI (Link Quality Estination).
Definition
lr-wpan-lqi-tag.h:29
ns3::lrwpan::LrWpanLqiTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
lr-wpan-lqi-tag.cc:53
ns3::lrwpan::LrWpanLqiTag::Set
void Set(uint8_t lqi)
Set the LQI to the given value.
Definition
lr-wpan-lqi-tag.cc:77
ns3::lrwpan::LrWpanLqiTag::LrWpanLqiTag
LrWpanLqiTag()
Create a LrWpanLqiTag with the default LQI 0.
Definition
lr-wpan-lqi-tag.cc:42
ns3::lrwpan::LrWpanLqiTag::m_lqi
uint8_t m_lqi
The current LQI value of the tag.
Definition
lr-wpan-lqi-tag.h:74
ns3::lrwpan::LrWpanLqiTag::Serialize
void Serialize(TagBuffer i) const override
Definition
lr-wpan-lqi-tag.cc:59
ns3::lrwpan::LrWpanLqiTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
lr-wpan-lqi-tag.cc:37
ns3::lrwpan::LrWpanLqiTag::Print
void Print(std::ostream &os) const override
Definition
lr-wpan-lqi-tag.cc:71
ns3::lrwpan::LrWpanLqiTag::Deserialize
void Deserialize(TagBuffer i) override
Definition
lr-wpan-lqi-tag.cc:65
ns3::lrwpan::LrWpanLqiTag::Get
uint8_t Get() const
Get the LQI value.
Definition
lr-wpan-lqi-tag.cc:83
ns3::lrwpan::LrWpanLqiTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
lr-wpan-lqi-tag.cc:21
uint32_t
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
lr-wpan-lqi-tag.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeIntegerChecker
Ptr< const AttributeChecker > MakeIntegerChecker()
Definition
integer.h:99
ns3::MakeIntegerAccessor
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition
integer.h:35
src
lr-wpan
model
lr-wpan-lqi-tag.cc
Generated on Fri Nov 8 2024 13:59:02 for ns-3 by
1.11.0