MC File DHRUV GOEL 44114802717
MC File DHRUV GOEL 44114802717
MC File DHRUV GOEL 44114802717
ETIT-452
1
MAHARAJA AGRASEN INSTITUTE OF TECHNOLOGY
VISION
To nurture young minds in a learning environment of high academic value and imbibe spiritual
and ethical values with technological and management competence.
MISSION
The Institute shall endeavor to incorporate the following basic missions in the teaching
methodology:
Engineering Hardware – Software Symbiosis
Practical exercises in all Engineering and Management disciplines shall be carried out by
Hardware equipment as well as the related software enabling a deeper understanding of basic
concepts and encouraging inquisitive nature.
Life-Long Learning
The Institute strives to match technological advancements and encourage students to keep
updating their knowledge for enhancing their skills and inculcating their habit of continuous
learning.
Liberalization and Globalization
The Institute endeavor’s to enhance the technical and management skills of students so that
they are intellectually capable and competent professionals with Industrial Aptitude to face the
challenges of globalization.
Diversification
The Engineering, Technology, and Management disciplines have diverse fields of studies with
different attributes. The aim is to create a synergy of the above attributes by encouraging
analytical thinking.
Digitization of Learning Processes
The Institute provides seamless opportunities for innovative learning in all Engineering and
Management disciplines through digitization of learning processes using analysis, synthesis,
simulation, graphics, tutorials, and related tools to create a platform for a multi-disciplinary
approach.
Entrepreneurship
The Institute strives to develop potential Engineers and Managers by enhancing their skills and
research capabilities so that they become successful entrepreneurs and responsible citizens.
2
MAHARAJA AGRASEN INSTITUTE OF TECHNOLOGY
3
Mobile Computing Lab
(ETIT-452)
Lab Assessment Sheet
R1 R2 R3 R4 R5
1 | Page
Write a Program in NS3 to Simulate
8 AODV
Overall Comments:
2 | Page
EXPERIMENT NO. 1
AIM: Write a WML program to print a formatted Text on the mobile Screen using various tags.
Theory:
Attribute Value Description
align left Aligns the paragraph. Default is "left"
right
center
mode wrap Sets whether a paragraph should wrap lines or not.
nowrap
xml:lang language_code Sets the language used in the element
class cdata Sets a class name for the element. The class name is case-
sensitive. An element can be connected to multiple classes.
Multiple class names within the class attribute
are separated by white space
id id Sets a unique name for the element
3 | Page
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="ABC" title="Practical 1">
<p>
Hello World
</p>
<onevent type="ontimer">
<go href="#ABC1"/>
</onevent>
<timer value="50"/>
</card>
<card id="ABC1" title="Practical 1">
<p>
<b>Kishan Sharma</b><br>
<big>Kishan Sharma</big><br>
<em>Kishan Sharma</em><br>
<i>Kishan Sharma</i><br>
<small>Kishan Sharma</small><br>
<strong>Kishan Sharma</strong><br>
<u>Kishan Sharma</u>
</p>
</card>
</wml>
4 | Page
Output:
5 | Page
EXPERIMENT NO. 2
AIM: Write a WML program to connect multiple cards from the same desk.
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="CardNo.1" title="Program2Card1">
<p>You Are Visiting Card 1</p>
<do type="accept" name="CardNo.2" label="Continue">
<go href="#CardNo.2"/>
</do>
</card>
Output:
6 | Page
7 | Page
EXPERIMENT NO. 3
AIM: Write WML program to display table with three columns Image name, Image and third column
contain a hyperlink to open another card.
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="CardNo.1" title="Program3Card1">
<p>
<table columns="3" align="LCR">
<tr>
<td>Image Name</td>
<td>Image</td>
<td>Link</td>
</tr>
<tr>
<td>Thumb Image</td>
<td><img src="thumb.wbmp" alt="Thumb Image"/></td>
<td><anchor><a href="#CardNo.2">CardNo2</a></anchor></td>
</tr>
<tr>
<td>Heart Image</td>
<td><img src="heart.wbmp" alt="Heart Image"/></td>
<td><anchor><a href="#CardNo.3">CardNo3</a></anchor></td>
</tr>
</table>
</p>
</card>
<card id="CardNo.2" title="Program3Card2">
<p>You Are Visiting Card 2</p>
<do type="accept" name="CardNo.3" label="Continue">
<go href="#CardNo.3"/>
</do>
</card>
<card id="CardNo.3" title="Program3Card3">
<p>You Are Visiting Card 3</p>
<do type="accept" name="CardNo.1" label="Go Back">
<go href="#CardNo.1"/>
</do>
</card>
</wml>
8 | Page
Output:
9 | Page
EXPERIMENT NO. 4
AIM: Write a WML program to create a form with multiple options.
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card title="Practical4">
<p> Select a Tutorial :
<select>
<option value="htm">HTML Tutorial</option>
<option value="xml">XML Tutorial</option>
<option value="wap">WAP Tutorial</option>
</select>
</p>
</card>
</wml>
Output:
10 | Page
EXPERIMENT NO. 5
AIM: Write a WML program to use the time control and to trigger On pick event.
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="ABC" title="Practical 5">
<p>
Hello World
</p>
<onevent type="ontimer">
<go href="#ABC1"/>
</onevent>
<timer value="100"/>
</card>
<card id="ABC1" title="Practical 5">
<p>Select a Tutorial :
<select title="tutorials" name="selection_list">
<option onpick="#xhtml">XHTML Tutorial</option>
<option onpick="#wap">WAP Tutorial</option>
</select>
</p>
</card>
<card id="xhtml" title="Practical 5">
<p>
XHTML stands for EXtensible HyperText Markup Language.
</p>
</card>
<card id="wap" title="Practical 5">
<p>
Wireless Application Protocol (WAP) is a technical standard for accessing
information over a mobile wireless network.
</p>
</card>
</wml>
Output:
11 | Page
12 | Page
EXPERIMENT NO. 6
AIM: Write a WML script to find a maximum out of two numbers with help of inbuilt function
Lang.Max() and to find absolute value with help of inbuilt function Lang.abs().
Code:
lang.max():
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="card1" title="WMLScript Tutorial">
<p>
<a href="findmax.wmls#findmax()">Find Maximum Out Of Two.</a><br/>
<br>
First Number: $(number1)<br>
Second Number: $(number2)<br>
Maximum One: $(maxnumber)
</p>
</card>
</wml>
lang.abs():
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="card1" title="WMLScript Tutorial">
<p>
<fieldset title="Enter The Number: ">
n : <input name="N" size="12" format="*N"/>
</fieldset><br/>
<do type="accept" name="CardNo.2" label="Enter">
<go href="findmax.wmls#findabs(-8)"/>
</do>
<br>
</p>
<p>
First Number: $(number)<br>
ABS Number: $(absnumber)
</p>
</card>
</wml>
Custom function[findmax()]:
13 | Page
extern function findmax()
{
var result1 = Dialogs.prompt("Enter 1st number", "");
var result2 = Dialogs.prompt("Enter 2cd number", "");
var maxnum = Lang.max(result1, result2);
WMLBrowser.setVar("number1", result1);
WMLBrowser.setVar("number2", result2);
WMLBrowser.setVar("maxnumber", maxnum);
WMLBrowser.go("p6.wml#card2");
}
extern function findabs(n)
{
var absnum = Lang.abs(n);
WMLBrowser.setVar("number", n);
WMLBrowser.setVar("absnumber", absnum);
WMLBrowser.go("p6.2.wml#card3");
};
Output:
14 | Page
15 | Page
EXPERIMENT NO. 7
AIM: Write a Program in NS3 to Simulate OLSR.
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/olsr-helper.h"
#include "ns3/ipv4-static-routing-helper.h"
#include "ns3/ipv4-list-routing-helper.h"
NS_LOG_COMPONENT_DEFINE ("SimplePointToPointOlsrExample");
// Allow the user to override any of the defaults and the above
// DefaultValue::Bind ()s at run-time, via command-line arguments
CommandLinecmd;
cmd.Parse (argc, argv);
// Enable OLSR
Ipv4StaticRoutingHelper staticRouting;
InternetStackHelper internet;
internet.SetRoutingHelper (list); // has effect on the next Install ()
internet.Install (c);
// Create a packet sink to receive these packets apps = sink.Install (c.Get (1));
apps.Start (Seconds (1.1));
apps.Stop (Seconds (10.0));
AsciiTraceHelper ascii;
p2p.EnableAsciiAll (ascii.CreateFileStream ("simple-point-to-point-olsr.tr"));
p2p.EnablePcapAll ("simple-point-to-point-olsr");
return 0;
}
Output:
18 | Page
19 | Page
EXPERIMENT NO. 8
AIM: Write a Program in NS3 to Simulate AODV.
Code:
#include "ns3/aodv-module.h"
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/mobility-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/wifi-module.h"
#include "ns3/v4ping-helper.h"
#include <iostream>
#include <cmath>
using namespace ns3;
class AodvExample{
public:
AodvExample ();
bool Configure (int argc, char **argv);
void Run ();
void Report (std::ostream & os);
private:
// network NodeContainernodes;
NetDeviceContainerdevices;
Ipv4InterfaceContainerinterfaces;
private:
void CreateNodes ();
void CreateDevices ();
void InstallInternetStack ();
void InstallApplications ();
};
//-----------------------------------------------------------------------------
AodvExample::AodvExample () : size (10), step (100), totalTime (10), pcap (true), printRoutes (true){}
SeedManager::SetSeed (12345);
CommandLinecmd;
void AodvExample::Run ()
{
// Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", UintegerValue (1));
// enable rts cts all the time.
CreateNodes ();
CreateDevices ();
InstallInternetStack ();
InstallApplications ();
void AodvExample::CreateNodes ()
{
std::cout <<"Creating "<< (unsigned)size<<" nodes "<<step<<" m apart.\n";
21 | Page
nodes.Create (size);
// Name nodes
for (uint32_t i = 0; i <size; ++i)
{
std::ostringstream os;
os <<"node-"<< i;
Names::Add (os.str (), nodes.Get (i));
}
// Create static grid
MobilityHelpermobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator", "MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0), "DeltaX", DoubleValue (step), "DeltaY", DoubleValue (0),
"GridWidth", UintegerValue (size),
"LayoutType", StringValue ("RowFirst"));
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (nodes);
}
void AodvExample::CreateDevices ()
{
WifiMacHelper wifiMac;
wifiMac.SetType ("ns3::AdhocWifiMac");
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
WifiHelperwifi;
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue
("OfdmRate6Mbps"), "RtsCtsThreshold", UintegerValue (0));
devices = wifi.Install (wifiPhy, wifiMac, nodes);
if (pcap)
{
wifiPhy.EnablePcapAll (std::string ("aodv"));
}
}
void AodvExample::InstallInternetStack ()
{
AodvHelper aodv;
// you can configure AODV attributes here using aodv.Set(name, value)
InternetStackHelperstack;
stack.SetRoutingHelper (aodv); // has effect on the next Install ()
stack.Install (nodes);
Ipv4AddressHelperaddress;
address.SetBase ("10.0.0.0", "255.0.0.0");
interfaces = address.Assign (devices);
22 | Page
if (printRoutes)
{
Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper> ("aodv.routes",
std::ios::out);
aodv.PrintRoutingTableAllAt (Seconds (8), routingStream);
}
}
void AodvExample::InstallApplications ()
{
V4PingHelper ping (interfaces.GetAddress (size - 1));
ping.SetAttribute ("Verbose", BooleanValue (true));
Output:
23 | Page
EXPERIMENT NO. 9
AIM: Make an application of your choice using WML.
Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml13.dtd">
<wml>
<card id="CardNo.1" title="Calculator">
<p>
<fieldset title="Enter First Number: ">
Enter First Value: <input format="*N" name="a" title="First Amount:"/>
</fieldset><br/>
<fieldset title="Enter Second Number: ">
Enter Second Value: <input format="*N" name="b" title="Second Value:"/>
</fieldset><br/>
<fieldset>
Operator :
<select name="op" title="Operation:">
<option value="+">Addition</option>
<option value="-">Subtraction</option>
<option value="*">Multiplication</option>
<option value="/">Division</option>
</select><br/><br/>
<do type="accept" name="Calculator" label="Ans(=)">
<go href="calc.wmls#operation($(a),$(b))"/>
</do>
</fieldset>
</p>
</card>
<card id="result" title="Result">
<p>
Here is the result:<br/>
$(a) '$(op)' $(b) = $(result)
</p>
<do type="accept" label="Back">
<prev/>
</do>
</card>
</wml>
Calc.wmls:
extern function operation(a, b)
24 | Page
{
var ans = 0;
var op = WMLBrowser.getVar("op");
if (op == "+"){
ans = a + b;
}
else if (op == "-"){
ans = a - b;
}
else if (op == "*"){
ans = a * b;
}
else if (op == "/"){
ans = a / b;
}
WMLBrowser.setVar("result",ans);
WMLBrowser.go("#result");
}
Output:
25 | Page
EXPERIMENT NO. 10
AIM: Write an Android Program to create a list view.
Code:
package com.example.myapplication;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(main, menu);
return true;
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_alignParentTop="true"
android:layout_marginTop="18dp"
26 | Page
android:text="@string/hello_sanfoundry_android" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="53dp"
android:text="This is a Large Text View"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="16dp"
android:text="This is Medium Text View"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView3"
android:layout_below="@+id/textView3"
android:layout_marginTop="14dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView4"
android:layout_below="@+id/textView4"
android:layout_marginTop="16dp"
android:text="Button" />
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/button2"
android:layout_alignBottom="@+id/button2"
android:layout_alignParentRight="true"
android:text="ToggleButton" />
<Button
android:id="@+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
27 | Page
android:layout_alignTop="@+id/button1"
android:layout_centerHorizontal="true"
android:text="Small Button" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/toggleButton1"
android:layout_below="@+id/toggleButton1"
android:layout_marginTop="93dp"
android:text="CheckBox" />
<CheckedTextView
android:id="@+id/checkedTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/checkBox1"
android:layout_alignBottom="@+id/checkBox1"
android:layout_alignLeft="@+id/button1"
android:text="CheckedTextView" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/checkedTextView1"
android:layout_below="@+id/checkBox1"
android:layout_marginTop="34dp"
android:text="RadioButton" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/radioButton1"
android:layout_below="@+id/radioButton1"
android:text="RadioButton" />
</RelativeLayout>
Output:
28 | Page
29 | Page