A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
lr-wpan-lqi-tag.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013 Fraunhofer FKIE
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author:
19
* Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
20
*/
21
#include "
lr-wpan-lqi-tag.h
"
22
#include <ns3/integer.h>
23
24
namespace
ns3 {
25
26
NS_OBJECT_ENSURE_REGISTERED
(LrWpanLqiTag);
27
28
TypeId
29
LrWpanLqiTag::GetTypeId
(
void
)
30
{
31
static
TypeId
tid =
TypeId
(
"ns3::LrWpanLqiTag"
)
32
.
SetParent
<
Tag
> ()
33
.AddConstructor<LrWpanLqiTag> ()
34
.AddAttribute (
"Lqi"
,
"The lqi of the last packet received"
,
35
IntegerValue
(0),
36
MakeIntegerAccessor (&
LrWpanLqiTag::Get
),
37
MakeIntegerChecker<uint8_t> ())
38
;
39
return
tid;
40
}
41
42
TypeId
43
LrWpanLqiTag::GetInstanceTypeId
(
void
)
const
44
{
45
return
GetTypeId
();
46
}
47
48
LrWpanLqiTag::LrWpanLqiTag
(
void
)
49
: m_lqi (0)
50
{
51
}
52
53
LrWpanLqiTag::LrWpanLqiTag
(uint8_t lqi)
54
: m_lqi (lqi)
55
{
56
}
57
58
uint32_t
59
LrWpanLqiTag::GetSerializedSize
(
void
)
const
60
{
61
return
sizeof
(uint8_t);
62
}
63
64
void
65
LrWpanLqiTag::Serialize
(
TagBuffer
i)
const
66
{
67
i.
WriteU8
(
m_lqi
);
68
}
69
70
void
71
LrWpanLqiTag::Deserialize
(
TagBuffer
i)
72
{
73
m_lqi
= i.
ReadU8
();
74
}
75
76
void
77
LrWpanLqiTag::Print
(std::ostream &os)
const
78
{
79
os <<
"Lqi = "
<<
m_lqi
;
80
}
81
82
void
83
LrWpanLqiTag::Set
(uint8_t lqi)
84
{
85
m_lqi
= lqi;
86
}
87
88
uint8_t
89
LrWpanLqiTag::Get
(
void
)
const
90
{
91
return
m_lqi
;
92
}
93
94
}
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition:
object-base.h:38
ns3::LrWpanLqiTag::m_lqi
uint8_t m_lqi
The current LQI value of the tag.
Definition:
lr-wpan-lqi-tag.h:72
ns3::IntegerValue
Hold a signed integer type.
Definition:
integer.h:45
ns3::LrWpanLqiTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
lr-wpan-lqi-tag.cc:29
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:195
ns3::LrWpanLqiTag::Get
uint8_t Get(void) const
Get the LQI value.
Definition:
lr-wpan-lqi-tag.cc:89
ns3::LrWpanLqiTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition:
lr-wpan-lqi-tag.cc:43
ns3::LrWpanLqiTag::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
lr-wpan-lqi-tag.cc:59
ns3::LrWpanLqiTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
lr-wpan-lqi-tag.cc:71
lr-wpan-lqi-tag.h
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::LrWpanLqiTag::LrWpanLqiTag
LrWpanLqiTag(void)
Create a LrWpanLqiTag with the default LQI 0.
Definition:
lr-wpan-lqi-tag.cc:48
ns3::LrWpanLqiTag::Set
void Set(uint8_t lqi)
Set the LQI to the given value.
Definition:
lr-wpan-lqi-tag.cc:83
ns3::LrWpanLqiTag::Print
virtual void Print(std::ostream &os) const
Definition:
lr-wpan-lqi-tag.cc:77
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Definition:
type-id.cc:610
ns3::LrWpanLqiTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
lr-wpan-lqi-tag.cc:65
src
lr-wpan
model
lr-wpan-lqi-tag.cc
Generated on Tue Jun 17 2014 01:12:55 for ns-3 by
1.8.6