A Discrete-Event Network Simulator
API
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
24namespace ns3 {
25
26NS_OBJECT_ENSURE_REGISTERED (LrWpanLqiTag);
27
28TypeId
30{
31 static TypeId tid = TypeId ("ns3::LrWpanLqiTag")
32 .SetParent<Tag> ()
33 .SetGroupName ("LrWpan")
34 .AddConstructor<LrWpanLqiTag> ()
35 .AddAttribute ("Lqi", "The lqi of the last packet received",
36 IntegerValue (0),
38 MakeIntegerChecker<uint8_t> ())
39 ;
40 return tid;
41}
42
45{
46 return GetTypeId ();
47}
48
50 : m_lqi (0)
51{
52}
53
55 : m_lqi (lqi)
56{
57}
58
61{
62 return sizeof (uint8_t);
63}
64
65void
67{
68 i.WriteU8 (m_lqi);
69}
70
71void
73{
74 m_lqi = i.ReadU8 ();
75}
76
77void
78LrWpanLqiTag::Print (std::ostream &os) const
79{
80 os << "Lqi = " << m_lqi;
81}
82
83void
84LrWpanLqiTag::Set (uint8_t lqi)
85{
86 m_lqi = lqi;
87}
88
89uint8_t
91{
92 return m_lqi;
93}
94
95}
Hold a signed integer type.
Definition: integer.h:44
Represent the LQI (Link Quality Estination).
LrWpanLqiTag(void)
Create a LrWpanLqiTag with the default LQI 0.
virtual void Serialize(TagBuffer i) const
static TypeId GetTypeId(void)
Get the type ID.
void Set(uint8_t lqi)
Set the LQI to the given value.
uint8_t m_lqi
The current LQI value of the tag.
virtual void Deserialize(TagBuffer i)
virtual uint32_t GetSerializedSize(void) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint8_t Get(void) const
Get the LQI value.
virtual void Print(std::ostream &os) const
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(void)
Definition: tag-buffer.h:195
tag a set of bytes in a packet
Definition: tag.h:37
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition: integer.h:45
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.