Professional Documents
Culture Documents
Final Major Project
Final Major Project
PROJECT REPORT ON
in
COMPUTER SCIENCE & ENGINEERING
By
DONTHULA PRANAVI : 17Q91A05I7
SRIPADA ANUDEEP : 16Q91A05L7
T.ARAVINDARAJU : 18Q95A0505
SANJU BAGRI : 17Q91A05J4
CERTIFICATE
_________________________________________________________________________________________
Submitted for the viva voice examination held on
Date :
Place : Maisammaguda
ii
ACKNOWLEDGEMENT
First and foremost, we would like to express our immense gratitude towards
our institution Malla Reddy College of Engineering, which helped us to attain
profound technical skills in the field of Computer Science & Engineering, there by
fulfilling our most cherished goal.
We are pleased to thank Sri Ch. Malla Reddy, our Founder, Chairman
MRGI, Sri Ch. Mahender Reddy, Secretary, MRGI for providing this opportunity
and support throughout the course.
It gives us immense pleasure to acknowledge the perennial inspiration of
Dr. M Sreedhar Reddy our beloved principal for his kind co-operation and
encouragement in bringing out this task.
We would like to thank Dr. T. V. Reddy our vice principal, Mrs. Ch.Vijaya
Kumari, HOD, CSE Department for their inspiration adroit guidance and constructive
criticism for successful completion of our degree.
We convey our gratitude to Dr. Gladson Mario Britto R & D Coordinator and
Mr. Sayyad Rasheed Uddin, & Mr. Ch. Vengaiah, Assistant Professor, our project
coordinator for their valuable guidance.
We would like to thank Mr. Ch.Vengaiah Assistant Professor our internal
guide, for his valuable suggestions and guidance during the exhibition and completion
of this project.
Finally, we avail this opportunity to express our deep gratitude to all staff who
have contribute their valuable assistance and support making our project success.
iii
INDEX
iv
CHAPTER 7: ANDROID 27
7.1 Overview of Android
7.2 Features
7.3 Linux kernel
7.4 Android Runtime
7.5 Libraries
7.6 Application Framework
CHAPTER 8: ARCHITECTURE 30
CHAPTER 9: JAVA SERVER PAGES(JSP) 34
9.1 Architecture of JSP
9.2 Advantages of JSP
CHAPTER 10: SERVLETS 36
10.1 Servlet Run Time Environment
10.2 Life Cycle of Servlet
CHAPTER 11: FEASABILITY STUDY 39
11.1 Technical Feasibility
11.2 Operational Feasibility
11.3 Economical Feasibility
CHAPTER 12: JAVA 41
12.1 J2EE Application
12.2 Servlets
CHAPTER 13: TESTING 44
CHAPTER 14: METHODOLOGY 48
14.1 Waterfall Approach
14.2 V Model
v
CHAPTER 15: SOURCE CODE 51
15.1 Web Service
15.2 Trance coder code
15.3 Android code
CHAPTER 16: SCREENSHOT 67
CHAPTER 17: CONCLUSION 75
17.1 Future Work
REFERENCES 76
vi
CHAPTER 1
INTRODUCTION
1
A Real-Time Adaptive Algorithm for Video
Streaming over Multiple Wireless Access Networks
OBJECTIVE:
In this paper, we realized a prototype of this architecture to validate the feasibility of
the proposed method.
According to the experiment, this method could provide efficient self-adaptive
multimedia streaming services for varying bandwidth environments.
SYNOPSIS:
Video streaming is gaining popularity among mobile users. The latest mobile
devices, such as smart phones and tablets, are equipped with multiple wireless network
interfaces. How to efficiently and cost-effectively utilize multiple links to improve video
streaming quality needs investigation. In order to maintain high video streaming quality
while reducing the wireless service cost, in this paper, the optimal video streaming process
with multiple links is formulated as a Markov Decision Process (MDP). The reward function
is designed to consider the quality of service (QoS) requirements for video traffic, such as
the startup latency, playback fluency, average playback quality, playback smoothness and
wireless service cost. To solve the MDP in real-time, we propose an adaptive, best-action
search algorithm to obtain a sub-optimal solution. To evaluate the performance of the
proposed adaptation algorithm, we implemented a test bed using the Android mobile phone
and the Scalable Video Coding (SVC) codec. Experiment results demonstrate the feasibility
and effectiveness of the proposed adaptation algorithm for mobile video streaming
applications, which outperforms the existing state-of-the-art adaptation algorithms.
2
EXISTING SYSTEM:
In the previous service, the mobile device side exchanges information with the cloud
environment, so as to determine an optimum multimedia video. Scholars have done
numerous researches toward conventional platform (CDN) to store different movie formats
in a multimedia server, to choose the right video stream according to the current network
situation or the hardware calculation capabilities. To solve this problem, many researchers
have attempted dynamic encoding to transfer media content, but still cannot offer the best
video quality.
LIMITATIONS:
Video communication over mobile broadband networks today is challenging due to
limitations in bandwidth and difficulties in maintaining high reliability, quality, and
latency demands imposed by rich multimedia applications.
Increasing in network traffic by the use of multimedia content and applications.
PROPOSED SYSTEM:
The proposed system provided an efficient interactive streaming service for
diversified mobile devices and dynamic network environments.
When a mobile device requests a multimedia streaming service, it transmits its
hardware and network environment parameters to the profile agent in the cloud
environment, which records the mobile device codes and determines the required
parameters.
Then transmits them to the Network and Device-Aware Multi-layer Management
(NDAMM). The NDAMM determines the most suitable SVC code for the device
according to the parameters, and then the SVC Transcoding Controller (STC) hands
over the transcoding work via map-reduce to the cloud, in order to increase the
transcoding rate.
The multimedia video file is transmitted to the mobile device through the service.
3
ADVANTAGES:
The network bandwidth can be changed dynamically.
This method could provide efficient self-adaptive multimedia streaming services.
SYSTEM ARCHITECTURE:
4
HARDWARE AND SOFTWARE SPECIFICATION:
Software Requirement:
Hardware Requirement:
1. 1 GB RAM
2. 80 GB Hard Disk
3. Above 2GHz Processor
4. Android Mobile With GPRS
5
CHAPTER 2
LITERATURE SURVEY
6
LITERATURE SURVEY
1) Media Cloud: When Media Revolution Meets Rise of Cloud Computing
Mingfeng Tan Computer Engineering Department San Jose State University San Jose, CA,
U.S.
mingfeng.tan@gmail.com
Media cloud provides a cost-effective and powerful solution for the coming tide of
the media consumption. Based on previous summary of the recent work on media cloud
research, in this section, we first make some suggestions on how to build the media cloud,
and then propose some potentially promising topics for future research.
7
4) Distributed Scheduling Scheme for Video Streaming over Multi-Channel Multi-
Radio Multi-Hop Wireless Networks
Liang Zhou, Xinbing Wang, Wei Tu, Gabriel-Miro Muntean, and Benoit Geller
In this paper, we have developed fully distributed scheduling schemes that jointly
solve the channel-assignment, rate allocation, routing and fairness problems for video
streaming over multi-channel multi-radio networks. Unlike conventional scheduling schemes
focus on optimal system throughput or scheduling efficiency, our work aims at achieving
minimal video distortion and certain fairness by jointly considering media-aware distribution
and network resource allocation. Extensive simulation results are provided which
demonstrate the effectiveness of our proposed schemes.
8
CHAPTER 3
DIAGRAMS
9
DIAGRAMS
DATAFLOW DIAGRAM
LEVEL 0:
User Mobile
Mobile
Profile
Profile
Examination
Cloud
LEVEL 1:
User Mobile
NDAM
M
DNEM
Cloud
10
LEVEL 2:
User Mobile
Mobile
Profile
NDAMM
And DNEM
Bit Rate
SVC
Transcoding
Cloud
Streaming in
Mobile
11
UML Diagrams
1. Use Case Diagram
Android Phone
Application
GPRS
User Cloud Server
Searching File
Reterive File
Fig.3.2.Class Diagram
12
3. Activity Diagram
User
Android
Phone
Application
Search Device
Media File Configura...
Media
Profile
Cloud
Server
Retrieve
Media File
Display
Fig.3.3.Activity Diagram
13
4. Sequence Diagram
Request
Response
Mobile Profile
User Profile
Request Data
Media Data
NDAMM
SVC Transcoding
Split Data Reducer
Maping
Result
View Data
14
5. Collaboration Diagram
6: User Profile
9: SVC Transcoding
1: Request
User 3: Search Media data 7: Request Data Media Services
Application
Fig.3.5.Collaboration Diagram
6.ER Diagram
Use Network
Access Server User Application
File Format
View File
Use
Server
Services
Response
Multimedia
Files
Fig.3.6.ER Diagram
15
CHAPTER 4
MODULES
16
MODULES
17
2. Network and Device Aware Multi-Layer Management (NDAMM):
The NDAMM aims to determine the interactive communication frequency and
the SVC multimedia file coding parameters according to the parameters of the mobile
device. It hands these over to the STC for transcoding control, so as to reduce the
communication bandwidth requirements and meet the mobile device user’s demand for
multimedia streaming. It consists of a listen module, a parameter profile module, a
network estimation module, a device-aware Bayesian prediction module, and adaptive
multi-layer selection. The interactive multimedia streaming service must receive the user
profile of the mobile device instantly through the listen module. The parameter profile
module records the user profile and determines the parameter This is provided to both the
network estimation module and the device-aware Bayesian prediction module to predict
the required numerical values. Rw and Rh represent the width and height of the
supportable resolution for the device, CPavg and CP represent the present and average
CPU operating speed. Db and Db rate represent the existing energy of the mobile device
and energy consumption rate, and BW, BWavg, and BWstd represent the existing,
average and standard deviation values of the bandwidth. When this parameter form is
maintained, the parameters can be transmitted to the network estimation module and the
device-aware Bayesian prediction module for relevant prediction.
Para Profile
Listener
18
3. Dynamitic Network Estimation Module (DNEM):
Providing Input
Getting Output from EWMA Used to to DBPM
NDAMM calculate
Bandwidth
19
4. Network and Device-Aware Bayesian Prediction Module (NDBPM):
The SVC hierarchical structure provides scalability of the temporal, spatial and
quality dimensions. It adjusts along with the FPS, resolution and video variations of a
streaming bitrate: however, the question remains of how to choose an appropriate video
format according to the available resources of various devices. Hereby, in order to conform
to the real-time requirements of mobile multimedia, this study adopted Bayesian theory to
infer whether the video features conformed to the decoding action. The inference module
was based on the following two conditions:
• The LCD brightness does not always change This hypothesis aims at a hardware energy
evaluation. The literature states that TFT LCD energy consumption accounts for about 20%–
45% of the total power consumption for different terminal hardware environments. Although
the overall power can be reduced effectively by adjusting the LCD, with multimedia services,
users are sensitive to brightness; they dislike video brightness that repeatedly changes. As
changing the LCD brightness will influence the energy consumption evaluation value, the
LCD brightness of the mobile device is assumed to not able to change at will during
multimedia service.
• The energy of the mobile device shall be sufficient for playing a full multimedia video Full
multimedia service must be able to last until the user is satisfied. This assumed condition is
also the next main decision rule.
As for the three video parameters of FPS, resolution and bit rate, the bit rate depends on the
frame rate and resolution, so the Bayesian network adopts the frame rate and resolution as
the video input features and uses the bit rate as parameter considered.
20
5. Proposed Adaptive Communication and Multi-Layer Content
Selection (ACMCS):
When the predicted bandwidth state and the Bayesian predictive network are
determined, the cloud system will further determine the communication and the
required multimedia video files according to the information.
1) Communication Decision:
A good dynamic communication mechanism can reduce the bandwidth needs and
the power consumption of the device resulting from excessive packet transmission,
and the transmission frequency can be determined according to the bandwidth and its
fluctuation ratio based on such dynamic decision-making. The transmit mode is
engaged until the device finds a variation of the transmitted variables that exceeds a
threshold. Although the threshold can reduce the communication frequency
effectively and precisely, in this mode the mobile device must start up additional
threads for continuous monitoring; thus, the load on the device side is increased.
When the network bandwidth difference exceeds a triple standard deviation, this
indicates the present network is unstable. The overall communication frequency shall
incline to frequency to avoid errors; however, when the network bandwidth
difference is less than a triple standard deviation, the current network is still in a
stable state, and the influence on bandwidth difference can be corrected gradually.
2) SVC Multi-Layer Content Decision:
SVC is an improvement over traditional H.264/MPEG-4 AVC coding, as it
has higher coding flexibility. It is characterized by temporal scalability, spatial
scalability and SNR scalability, allowing video transmissions to be more adaptable to
heterogeneous network bandwidth. This study investigated how to determine an
appropriate multimedia video streaming service according to these three major
characteristics. First, the appropriate bandwidth interval was determined, in which
the average bandwidth was used as the standard value and each standard deviation
was the bandwidth interval segment. A quadruple standard difference is assumed to
be the boundary value. As the communication and prediction mechanisms are
constructed, the system will correct the overall threshold according to the bandwidth
variation gradually, inorder to avoid the bandwidth boundary exceeding the practical
21
situation. When the bandwidth interval is completed, it becomes the criterion of the
video streaming bit rate. The appropriate resolution and frame rate can then be
determined as the streaming data. When the mobile device transmits the current
network and hardware features to the cloud environment, the NDAMM will predict
the bandwidth at the next time point according to the bandwidth and standard
deviation and will identify whether the bandwidth state is stable or not. The DBPM
infers whether the multimedia video, at different resolutions and frame rates, can
complete smooth decoding and whether the hardware can provide complete video
playback services, according to the profile examination and subsequent hardware
features. When the Bayesian inference table is completed, the next communication
time can be determined, and the SVC multimedia coding applicable for the mobile
device can be provided according to the predicted and inferred network and hardware
features.
22
CHAPTER 5
CLOUD COMPUTING
23
CLOUD COMPUTING
Cloud computing is the use of computing resources (hardware and software) that are
delivered as a service over a network (typically the Internet). The name comes from the use
of a cloud-shaped symbol as an abstraction for the complex infrastructure it contains in
system diagrams. Cloud computing entrusts remote services with a user's data, software and
computation.
Using software as a service, users also rent application software and databases. The
cloud providers manage the infrastructure and platforms on which the applications run. End
users access cloud-based applications through a web browser or a light-weight desktop
or mobile app while the business software and user's data are stored on servers at a remote
location. Proponents claim that cloud computing allows enterprises to get their applications
up and running faster, with improved manageability and less maintenance, and enables IT to
more rapidly adjust resources to meet fluctuating and unpredictable business demand.
24
Cloud computing used in:
application that distinguishes between service providers (servers) and service requesters
(clients).
Grid computing — "A form of distributed and parallel computing, whereby a 'super
critical applications, typically bulk data processing such as census, industry and
consumer statistics, police and secret intelligence services, enterprise resource planning,
electricity."
with participants being at the same time both suppliers and consumers of resources (in
computers. The gaming data will be stored in the provider's server, so that gaming will
25
Characteristics
resources.
machines to interact with cloud software in the same way the user interface facilitates
by a third-party and does not need to be purchased for one-time or infrequent intensive
options and fewer IT skills are required for implementation (in-house).The e-FISCAL
project's state of the art repository contains several articles looking into cost aspects in
more detail, most of them concluding that costs savings depend on the type of activities
Device and location independence enable users to access systems using a web
browser regardless of their location or what device they are using (e.g., PC, mobile
utilization be increased. Applications can be easily migrated from one physical server to
another.
26
Multitenancy enables sharing of resources and costs across a large pool of users thus
allowing for:
Peak-load capacity increases (users need not engineer for highest possible
load-levels)
Utilization and efficiency improvements for systems that are often only 10–
20% utilized.
Reliability is improved if multiple redundant sites are used, which makes well-
designed cloud computing suitable for business continuity and disaster recovery.[30]
fine-grained, self-service basis near real-time, without users having to engineer for peak
loads.
resources, etc., but concerns can persist about loss of control over certain sensitive data,
and the lack of security for stored kernels. Security is often as good as or better than
other traditional systems, in part because providers are able to devote resources to
solving security issues that many customers cannot afford. However, the complexity of
security is greatly increased when data is distributed over a wider area or greater number
of devices and in multi-tenant systems that are being shared by unrelated users. In
addition, user access to security audit logs may be difficult or impossible. Private cloud
installations are in part motivated by users' desire to retain control over the infrastructure
27
Maintenance of cloud computing applications is easier, because they do not need to
be installed on each user's computer and can be accessed from different places.
Virtualization
While a physical computer in the classical sense is clearly a complete and actual
machine, both subjectively (from the user's point of view) and objectively (from the hardware
system administrator's point of view), a virtual machine is subjectively a complete machine
(or very close), but objectively merely a set of files and running programs on an actual,
physical machine (which the user need not necessarily be aware of).
28
CHAPTER 6
ALGORITHM
29
ALGORITHM
When the predicted bandwidth state and the Bayesian predictive network are
determined, the cloud system will further determine the communication and the required
multimedia video
files according to the information.
1) Communication Decision: A good dynamic communication mechanism can reduce the
bandwidth needs and the power consumption of the device resulting from excessive packet
transmission, and the transmission frequency can be determined according to the bandwidth
and its fluctuation ratio based on such dynamic decision-making. The transmit mode is
engaged until the device finds a variation of the transmitted variables that exceeds a
threshold. Although the threshold can reduce the communication frequency effectively and
precisely, in this mode the mobile device must start up additional threads for continuous
monitoring; thus, the load on the device side is increased. The communication time is shown
as:
among which, represents the corresponding factor of the bandwidth difference to the stream
flow, and is the set maximum communication time, considering the effect of (5) on network
quality, for the correction of .
When the network bandwidth difference exceeds a triple standard deviation, this indicates
the present network is unstable. The overall communication frequency shall incline to
frequency
to avoid errors; however, when the network bandwidth difference is less than a triple
standard deviation, the current network is still in a stable state, and the influence on
bandwidth difference
can be corrected gradually.
30
2) SVC Multi-Layer Content Decision: SVC is an improvement
over traditional H.264/MPEG-4 AVC coding, as it has higher coding flexibility. It is
characterized by temporal scalability, spatial scalability and SNR scalability, allowing video
transmissions to be more adaptable to heterogeneous network bandwidth. This study
investigated how to determine an appropriate multimedia video streaming service according
to these three major characteristics. First, the appropriate bandwidth interval was determined,
in which the average bandwidth was used as the standard value and each standard deviation
was the bandwidth interval segment. Let be the bandwidth aggregate, then:
As mentioned above, the system will determine the ultimate resolution and a frame rate that
are lower than each frequency range interval as the multimedia space and time features. The
file must enable the device to decode smoothly and finish the complete decoding. The
overall work flow is shown in the following Fig. 3. When the mobile device transmits the
current.
31
network and hardware features to the cloud environment, the NDAMM will predict the
bandwidth at the next time point according to the bandwidth and standard deviation and will
identify whether the bandwidth state is stable or not. The DBPM infers whether the
multimedia video, at different resolutions and frame rates, can complete smooth decoding
and whether
the hardware can provide complete video playback services, according to the profile
examination and subsequent hardware features.
32
CHAPTER 7
ANDROI D
33
ANDROID
Overview of Android
34
SQLite for structured data storage
Media support for common audio, video, and still image formats (MPEG4, H.264,
MP3, AAC, AMR, JPG, PNG, GIF)
GSM Telephony (hardware dependent)
Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
Camera, GPS, compass, and accelerometer (hardware dependent)
Rich development environment including a device emulator, tools for debugging,
memory and performance profiling, and a plugin for the Eclipse IDE
Linux Kernel
Android relies on Linux version 2.6 for core system services such as
security
memory management
process management
network stack
driver model
The kernel also acts as an abstraction layer between the hardware and the rest of the
software stack.
Android Runtime
Android includes a set of core libraries that provides most of the functionality
available in the core libraries of the Java programming language.
Every Android application runs in its own process, with its own instance of the
Dalvik virtual machine. Dalvik has been written so that a device can run multiple
VMs efficiently.
The Dalvik VM executes files in the Dalvik Executable (.dex) format which is
optimized for minimal memory footprint.
The Dalvik VM relies on the Linux kernel for underlying functionality such as
threading and low-level memory management.
35
Libraries
Android includes a set of C/C++ libraries used by various components of the Android
system. These capabilities are exposed to developers through the Android application
framework.
System C Library
Media Library
Surface Manager
LibWebCore
SGL
3D libraries
Free Type
SQLite
Application Framework
Being a open development platform, Android offers developers the ability to build
extremely rich and innovative applications.
Developers have full access to the same framework APIs used by the core
applications.
Views – used to build applications (lists, grid, buttons, text boxes and even
embeddable web browser)
Content providers – enable applications to access data from other applications or
share their own data.
Resource manager – provides access to non-code resources such as localized strings,
graphic and layout files.
Notification manager – enables applications to display custom alerts in status bar
Activity manager – manages lifecycle of applications and provides navigation
backstack
Android ships with a set of core applications including an email client, SMS program,
calendar, maps, browser, contacts, and others.
All applications are written using the Java programming language.
36
CHAPTER 8
ARCHITECTURE
37
ARCHITECTURE
Fig.8.Architecture
38
Android Building Blocks
AndroidManifest.xml
o the control file-tells the system what to do with the top-level components
Activities
o an object that has a life cycle-is a chunk of code that does some work.
Views
o an object that knows how to draw itself to the screen
Intents
o a simple message object that represents an "intention" to do something
Notifications
o is a small icon that appears in the status bar(SMS messages)
o for alerting the user
Services
o is a body of code that runs in the background
Development Tools
The Android SDK includes a variety of custom tools that help you develop mobile
applications on the Android platform. Three of the most significant tools are:
Android Emulator -A virtual mobile device that runs on our computer -use to
design, debug, and test our applications in an actual Android run-time environment
Android Development Tools Plugin -for the Eclipse IDE - adds powerful
extensions to the Eclipse integrated environment
Dalvik Debug Monitor Service (DDMS) -Integrated with Dalvik -this tool let us
manage processes on an emulator and assists in debugging
Android Asset Packaging Tool (AAPT) – Constructs the distributable Android
package files (.apk)
Android Debug Bridge (ADB) – provides link to a running emulator. Can copy files
to emulator, install .apk files and run commands.
39
Life cycle of activity
40
CHAPTER 9
41
JAVASERVER PAGES
JSPs are compiled into Java Servlets by a JSP compiler. A JSP compiler may
generate a servlet in Java code that is then compiled by the Java compiler, or it may generate
byte code for the servlet directly. JSPs can also be interpreted on-the-fly reducing the time
taken to reload changesJavaServer Pages (JSP) technology provides a simplified, fast way to
create dynamic web content. JSP technology enables rapid development of web-based
applications that are server- and platform-independent.
Architecture OF JSP:
42
The Advantages of JSP:
Active Server Pages (ASP). ASP is a similar technology from Microsoft. The
advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual
Basic or other MS-specific language, so it is more powerful and easier to use. Second,
it is portable to other operating systems and non-Microsoft Web servers.
Pure Servlets. JSP doesn't give you anything that you couldn't in principle do with a
servlet. But it is more convenient to write (and to modify!) regular HTML than to
have a zillion println statements that generate the HTML. Plus, by separating the look
from the content you can put different people on different tasks: your Web page
design experts can build the HTML, leaving places for your servlet programmers to
insert the dynamic content.
Server-Side Includes (SSI). SSI is a widely-supported technology for including
externally-defined pieces into a static Web page. JSP is better because it lets you use
servlets instead of a separate program to generate that dynamic part. Besides, SSI is
really only intended for simple inclusions, not for "real" programs that use form data,
make database connections, and the like.
JavaScript. JavaScript can generate HTML dynamically on the client. This is a
useful capability, but only handles situations where the dynamic information is based
on the client's environment. With the exception of cookies, HTTP and form
submission data is not available to JavaScript. And, since it runs on the client,
JavaScript can't access server-side resources like databases, catalogs, pricing
information, and the like.
Static HTML. Regular HTML, of course, cannot contain dynamic information. JSP
is so easy and convenient that it is quite feasible to augment HTML pages that only
benefit marginally by the insertion of small amounts of dynamic data. Previously, the
cost of using dynamic data would preclude its use in all but the most valuable
instances.
43
CHAPTER 10
SERVLETS
44
SERVLETS
The Java Servlet API allows a software developer to add dynamic content to a Web
server using the Java platform. The generated content is commonly HTML, but may be other
data such as XML. Servlets are the Java counterpart to non-Java dynamic Web content
technologies such as PHP, CGI and ASP.NET.
Servlets can maintain state across many server transactions by using HTTP cookies,
session variables or URL rewriting.The Servlet API, contained in the Java package hierarchy
javax.servlet, defines the expected interactions of a Web container and a servlet. A Web
container is essentially the component of a Web server that interacts with the servlets. The
Web container is responsible for managing the lifecycle of servlets, mapping a URL to a
particular servlet and ensuring that the URL requester has the correct access rights.
A Servlet is an object that receives a request and generates a response based on that
request. The basic servlet package defines Java objects to represent servlet requests and
responses, as well as objects to reflect the servlet's configuration parameters and execution
environment. The package javax.servlet.http defines HTTP-specific subclasses of the generic
servlet elements, including session management objects that track multiple requests and
responses between the Web server and a client.
45
The Web page is based on data submitted by the user. For example the results pages
from search engines are generated this way, and programs that process orders for e-
commerce sites do this as well.
The data changes frequently. For example, a weather-report or news headlines page
might build the page dynamically, perhaps returning a previously built page if it is
still up to date.
The Web page uses information from corporate databases or other such sources. For
example, you would use this for making a Web page at an on-line store that lists
current prices and number of items in stock.
Some Web servers, such as Sun's Java Web Server (JWS), W3C's Jigsaw and Gefion
Software's LiteWebServer (LWS) are implemented in Java and have a built-in servlet engine.
Other Web servers, such as Netscape's Enterprise Server, Microsoft's Internet Information
Server (IIS) and the Apache Group's Apache, require a servlet engine add-on module.
The add-on intercepts all requests for servlets, executes them and returns the
response through the Web server to the client. Examples of servlet engine add-ons are
Gefion Software's WAICoolRunner, IBM's WebSphere, Live Software's JRun and New
Atlanta's ServletExec.
All Servlet API classes and a simple servlet-enabled Web server are combined into
the Java Servlet Development Kit (JSDK), available for download at Sun's official Servlet
site .To get started with servlets I recommend that you download the JSDK and play around
with the sample servlets.
46
Life Cycle OF Servlet
2. The container calls the init() method. This method initializes the servlet and must
be called before the servlet can service any requests. In the entire life of a servlet,
serviced in its own separate thread. The container calls the service() method of
the servlet for every request. The service() method determines the kind of request
being made and dispatches it to an appropriate method to handle the request. The
request for a method that is not implemented by the servlet is made, the method
of the parent class is called, typically resulting in an error being returned to the
requester.
4. Finally, the container calls the destroy() method which takes the servlet out of
service. The destroy() method like init() is called only once in the lifecycle of a
Servlet.
47
CHAPTER 11
FEASABILITY STUDY
48
FEASIBILITY STUDY
Feasibility study is the test of a system proposal according to its workability, impact
on the organization, ability to meet user needs, and effective use of recourses. It focuses on
the evaluation of existing system and procedures analysis of alternative candidate system
cost estimates. Feasibility analysis was done to determine whether the system would be
feasible.
The development of a computer based system or a product is more likely plagued by
resources and delivery dates. Feasibility study helps the analyst to decide whether or not to
proceed, amend, postpone or cancel the project, particularly important when the project is
large, complex and costly.Once the analysis of the user requirement is complement, the
system has to check for the compatibility and feasibility of the software package that is
aimed at. An important outcome of the preliminary investigation is the determination that the
system requested is feasible.
Technical Feasibility:
The technology used can be developed with the current equipments and has the
technical capacity to hold the data required by the new system.
Technical feasibility on the existing system and to what extend it can support the proposed
addition.We can add new modules easily without affecting the Core Program. Most of parts
are running in the server using the concept of stored procedures.
49
Operational Feasibility:
This proposed system can easily implemented, as this is based on JSP coding (JAVA)
& HTML .The database created is with MySql server which is more secure and easy to
handle. The resources that are required to implement/install these are available. The personal
of the organization already has enough exposure to computers. So the project is operationally
feasible.
Economical Feasibility:
Economic analysis is the most frequently used method for evaluating the effectiveness of
a new system. More commonly known cost/benefit analysis, the procedure is to determine
the benefits and savings that are expected from a candidate system and compare them with
costs. If benefits outweigh costs, then the decision is made to design and implement the
system. An entrepreneur must accurately weigh the cost versus benefits before taking an
action. This system is more economically feasible which assess the brain capacity with quick
& online test. So it is economically a good project.
50
CHAPTER 12
JAVA
51
JAVA (programming language)
The original and reference implementation Java compilers, virtual machines, and class
libraries were developed by Sun from 1995. As of May 2007, in compliance with the
specifications of the Java Community Process, Sun relicensed most of their Java
technologies under the GNU General Public License. Others have also developed alternative
implementations of these Sun technologies, such as the GNU Compiler for Java and GNU
Classpath
J2EE application
52
application client modules;
the application;
Servlet
// Hello.java
import java.io.*;
import javax.servlet.*;
The import statements direct the Java compiler to include all of the public classes and
interfaces from the java.io and javax.servlet packages in the compilation.
53
The Hello class overrides the service(ServletRequest, ServletResponse) method defined by
the Servlet interface to provide the code for the service request handler. The service() method
is passed a ServletRequest object that contains the request from the client and a
ServletResponse object used to create the response returned to the client. The service()
method declares that it throws the exceptions ServletException and IOException if a problem
prevents it from responding to the request.
The setContentType(String) method in the response object is called to set the MIME content
type of the returned data to "text/html". The getWriter() method in the response returns a
PrintWriter object that is used to write the data that is sent to the client. The println(String)
method is called to write the "Hello, world!" string to the response and then the close()
method is called to close the print writer, which causes the data that has been written to the
stream to be returned to the client.
54
CHAPTER 13
TESTING
55
TESTING
Unit Testing
Unit testing, also known as Module Testing, focuses verification efforts on
the module. The module is tested separately and this is carried out at the
Unit test focuses on the smallest unit of software design- the software
component or module.
56
Using component level design, important control paths are tested to uncover
Unit test is white box oriented and the step can be conducted in parallel for
multiple components.
Functional Testing:
Functional test cases involve exercising the code with normal input values for
which the expected results are known, as well as the boundary values
Objective:
The objective is to take unit-tested modules and build a program structure that
has been dictated by design.
Performance Testing:
Performance testing determines the amount of execution time spent in
various parts of the unit, program throughput, and response time and device
utilization of the program unit. It occurs throughout all steps in the testing
process.
Integration Testing:
It is a systematic technique for constructing the program structure while at
the same time conducting tests to uncover errors associated with in the
interface.
Integration of all the components to form the entire system and a overall
testing is executed.
57
Validation Testing:
Validation test succeeds when the software functions in a manner that can be
that software functions are operational, input is properly accepted, output are
System Testing:
Tests to find the discrepancies between the system and its original objective,
current specifications and system documentation.
Structure Testing:
It is concerned with exercising the internal logic of a program and traversing
particular execution paths.
Output Testing:
Output of test cases compared with the expected results created during design
of test cases.
Asking the user about the format required by them tests the output generated
Here, the output format is considered into two was, one is on screen and
The output on the screen is found to be correct as the format was designed in
The output comes out as the specified requirements as the user’s hard copy.
58
User acceptance Testing:
Final Stage, before handling over to the customer which is usually carried out
by the customer where the test cases are executed with actual data.
The system under consideration is tested for user acceptance and constantly
keeping touch with the prospective system user at the time of developing and
59
CHAPTER 14
METHODOLOGY
60
METHODOLOGY
Waterfall Approach
While the Waterfall Model presents a straightforward view of the software life cycle,
this view is only appropriate for certain classes of software development. Specifically, the
Waterfall Model works well when the software requirements are well understood (e.g.,
software such as compilers or operating systems) and the nature of the software development
involves contractual agreements. The Waterfall Model is a natural fit for contract-based
software development since this model is document driven; that is, many of the products
such as the requirements specification and the design are documents. These documents then
become the basis for the software development contract.
There have been many waterfall variations since the initial model was introduced by
Winston Royce in 1970 in a paper entitled: “managing the development of large software
systems: concepts and techniques”. Barry Boehm, developer of the spiral model (see below)
modified the waterfall model in his book Software Engineering Economics (Prentice-Hall,
1987). The basic differences in the various models is in the naming and/or order of the
phases.
The basic waterfall approach looks like the illustration below. Each phase is done in a
specific order with its own entry and exit criteria and provides the maximum in separation of
skills, an important factor in government contracting.
Fig.14.1.Waterfall Approach
61
Example of a typical waterfall approach
While some variations on the waterfall theme allow for iterations back to the previous phase,
“In practice most waterfall projects are managed with the assumption that once the phase is
completed, the result of that activity is cast in concrete. For example, at the end of the design
phase, a design document is delivered. It is expected that this document will not be updated
throughout the rest of the development. You cannot climb up a waterfall.” (Murray Cantor,
Object-oriented project management with UML, John Wiley, 1998)
The waterfall is the easiest of the approaches for a business analyst to understand and work
with and it is still, in its various forms, the operational SLC in the majority of US IT shops.
The business analyst is directly involved in the requirements definition and/or analysis
phases and peripherally involved in the succeeding phases until the end of the testing phase.
The business analyst is heavily involved in the last stages of testing when the product is
determined to solve the business problem. The solution is defined by the business analyst in
the business case and requirements documents. The business analyst is also involved in the
integration or transition phase assisting the business community to accept and incorporate
the new system and processes.
V Model
The "V" model (sometimes known as the "U" model) reflects the approach to
systems development where in the definition side of the model is linked directly to the
confirmation side. It specifies early testing and preparation of testing scenarios and cases
before the build stage to simultaneously validate the definitions and prepare for the test
stages.It is the standard for German federal government projects and is considered as much a
project management method as a software development approach.
“The V Model, while admittedly obscure, gives equal weight to testing rather than treating it
as an afterthought. Initially defined by the late Paul Rook in the late 1980s, the V was
included in the U.K.'s National Computing Centre publications in the 1990s with the aim of
improving the efficiency and effectiveness of software development. It's accepted in Europe
and the U.K. as a superior alternative to the waterfall model; yet in the U.S., the V Model is
often mistaken for the waterfall…“In fact, the V Model emerged in reaction to some
waterfall models that showed testing as a single phase following the traditional development
phases of requirements analysis, high-level design, detailed design and coding. The waterfall
model did considerable damage by supporting the common impression that testing is merely
a brief detour after most of the mileage has been gained by mainline development activities.
62
Many managers still believe this, even though testing usually takes up half of the project
time.” (Goldsmith and Graham, “The Forgotten Phase”, Software development, July
2002)As shown below, the model is the shape of the development cycle (a waterfall wrapped
around) and the concept of flow down and across the phases. The V shows the typical
sequence of development activities on the left-hand (downhill) side and the corresponding
sequence of test execution activities on the right-hand (uphill) side.
Concept of Acceptance
operations System test
System System
requirements test
Subsystem Subsystem
requirements test
Subsystem Integration
design Subsystem test
Unit Unit
design test
Code
Unit
Fig.14.2 V Model
Example of a typical V Model (IEEE)
The primary contribution the V Model makes is this alignment of testing and specification.
This is also an advantage to the business analyst who can use the model and approach to
enforce early consideration of later testing. The V Model emphasizes that testing is done
throughout the SDLC rather than just at the end of the cycle and reminds the business analyst
to prepare the test cases and scenarios in advance while the solution is being defined.
The business analyst’s role in the V Model is essentially the same as the waterfall. The
business analyst is involved full time in the specification of the business problem and the
confirmation and validation that the business problem has been solved which is done at
acceptance test. The business analyst is also involved in the requirements phases and
advises the system test stage which is typically performed by independent testers – the
quality assurance group or someone other than the development team.
63
CHAPTER 15
SOURCE CODE
64
SOURCE CODE
Web service:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.networkqos;
import com.commondb.Common_DB;
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.net.URI;
import java.net.URL;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
/**
*
* @author santhosh.t
*/
@WebService(serviceName = "NewWebService")
public class NewWebService {
/**
* Web service operation
*/
@WebMethod(operationName = "signin")
public String signin(@WebParam(name = "username") String username,
@WebParam(name = "password") String password) {
65
try {
Common_DB cd=new Common_DB();
ResultSet rs=Common_DB.LoginCheck("psjav05", "login","username","password",
username, password);
if(rs.next()) {
return "success";
}
else {
return "username or password is invalid";
}
} catch (Exception ex) {
Logger.getLogger(NewWebService.class.getName()).log(Level.SEVERE, null, ex);
return "server temporarily not available";
}
}
/**
* Web service operation
*/
@WebMethod(operationName = "signup")
public String signup(@WebParam(name = "username") String username,
@WebParam(name = "password") String password, @WebParam(name = "email") String
email) {
try {
Common_DB cd=new Common_DB();
int rs=Common_DB.InsertTable("psjav05", "INSERT INTO
login(username,password,email) VALUES('"+username+"','"+password+"','"+email+"')");
if(rs>0) {
return "success";
}
else {
return "username is already available";
}
} catch (Exception ex) {
66
Logger.getLogger(NewWebService.class.getName()).log(Level.SEVERE, null, ex);
return "server temporarily not available";
}
/**
* Web service operation
*/
@WebMethod(operationName = "mobileinfo")
public String mobileinfo(@WebParam(name = "bandwidth") String bandwidth,
@WebParam(name = "networkname") String networkname, @WebParam(name =
"phonetype") String phonetype, @WebParam(name = "simstate") String simstate,
@WebParam(name = "networktype") String networktype,@WebParam(name = "osversion")
String osversion, @WebParam(name="username") String username) {
try {
Common_DB cd=new Common_DB();
int rs=Common_DB.UpdateTable("psjav05", "UPDATE login SET
bandwidth='"+bandwidth+"',networkname='"+networkname+"',phonetype='"+phonetype+"',
simstate='"+simstate+"',networktype='"+networktype+"',osversion='"+osversion+"' WHERE
username='"+username+"'");
if(rs>0) {
67
for(File filename : files) {
filenames+=filename.getName()+"@";
}
return filenames;
}
else {
return "Sorry unable to get mobile info";
}
} catch (Exception ex) {
Logger.getLogger(NewWebService.class.getName()).log(Level.SEVERE, null, ex);
return "server temporarily not available";
}
/**
* Web service operation
*/
@WebMethod(operationName = "Transcode")
public String Transcode(@WebParam(name = "filename") String
filename,@WebParam(name = "username") String username) {
try {
String filename1=null;
String formatname=null;
Common_DB cd=new Common_DB();
ResultSet rs=Common_DB.ViewParticularData("psjav05", "login", "username",
username);
if(rs.next()) {
int bandwidth=Integer.parseInt(rs.getString("bandwidth"));
String networktype=rs.getString("networktype");
String networkname=rs.getString("networkname");
String osversion=rs.getString("osversion");
String phonetype=rs.getString("phonetype");
if(osversion.startsWith("2.2")) {
68
filename1=filename.substring(0,filename.lastIndexOf("."));
formatname="3gp";
TransCoder.TransCode(filename, filename1,formatname , "libfaac", new
Integer(128000), 44100, 800000, 480, 360);
}
else if(filename.endsWith("3gp")){
filename1=filename;
}
else {
if(bandwidth<70) {
filename1=filename.substring(0,filename.lastIndexOf("."));
formatname="3gp";
TransCoder.TransCode(filename, filename1,formatname , "libfaac", new
Integer(128000), 44100, 800000, 176, 144);
}
else if(bandwidth>70 && 90>bandwidth) {
filename1=filename.substring(0,filename.lastIndexOf("."));
formatname="mp4";
TransCoder.TransCode(filename, filename1,formatname , "libfaac", new
Integer(200000), 65100, 3200000, 480, 360);
}
}
return filename1+"."+formatname;
}
else {
return "no file found";
}
}catch (Exception ex) {
Logger.getLogger(NewWebService.class.getName()).log(Level.SEVERE, null, ex);
return "error";
}
}
}
69
Transcoder Code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.networkqos;
import it.sauronsoftware.jave.*;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author santhosh.t
*/
public class TransCoder {
public static void TransCode(String sourcefile,String filename,String formatname,String
setCodec,Integer audioBitRate,Integer audioSamplingRate,Integer videoBitRate,int width,int
height ) {
try {
File source=new File("E:\\NetworkQoSService\\build\\web\\videos/"+sourcefile);
File target=new
File("E:\\NetworkQoSService\\build\\web\\videos1/"+filename+"."+formatname);
if(!(target.exists())) {
AudioAttributes aattrib=new AudioAttributes();
aattrib.setCodec(setCodec);
aattrib.setBitRate(new Integer(audioBitRate));
aattrib.setSamplingRate(new Integer(audioSamplingRate));
aattrib.setChannels(new Integer(2));
VideoAttributes vattrib=new VideoAttributes();
vattrib.setCodec("mpeg4");
vattrib.setBitRate(new Integer(videoBitRate));
vattrib.setFrameRate(new Integer(30));
70
vattrib.setSize(new VideoSize(width,height));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat(formatname);
attrs.setAudioAttributes(aattrib);
attrs.setVideoAttributes(vattrib);
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);
}
} catch (IllegalArgumentException ex) {
Logger.getLogger(TransCoder.class.getName()).log(Level.SEVERE, null, ex);
} catch (InputFormatException ex) {
Logger.getLogger(TransCoder.class.getName()).log(Level.SEVERE, null, ex);
} catch (EncoderException ex) {
Logger.getLogger(TransCoder.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String a[]) {
try {
File source=new File("E:/Wildlife.wmv");
File target=new File("E:/my.mp4");
AudioAttributes aattrib=new AudioAttributes();
aattrib.setCodec("libfaac");
aattrib.setBitRate(new Integer(256000));
aattrib.setSamplingRate(new Integer(65100));
aattrib.setChannels(new Integer(2));
VideoAttributes vattrib=new VideoAttributes();
vattrib.setCodec("mpeg4");
vattrib.setBitRate(new Integer(3200000));
vattrib.setFrameRate(new Integer(18));
vattrib.setSize(new VideoSize(620, 480));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp4");
attrs.setAudioAttributes(aattrib);
attrs.setVideoAttributes(vattrib);
71
Encoder encoder = new Encoder();
encoder.encode(source, target, attrs);
} catch (IllegalArgumentException ex) {
Logger.getLogger(TransCoder.class.getName()).log(Level.SEVERE, null, ex);
} catch (InputFormatException ex) {
Logger.getLogger(TransCoder.class.getName()).log(Level.SEVERE, null, ex);
} catch (EncoderException ex) {
Logger.getLogger(TransCoder.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Android Code:
package com.networkqos;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
/*
72
* variable declaration
*/
static String
urlString,bandwidth,phonetype,simstate,networkname,networktype,osversion;
static TextView bw,ss,nt,pt,nn,uname;
static Button bn;
static ProgressBar pb;
static ProgressDialog pDialog;
static int icon;
static String username;
/*
* SIM state constants
*/
public static final String SIM_ABSENT = "Absent";
public static final String SIM_READY = "Ready";
public static final String SIM_PIN_REQUIRED = "PIN required";
public static final String SIM_PUK_REQUIRED = "PUK required";
public static final String SIM_NETWORK_LOCKED = "Network locked";
public static final String SIM_UNKNOWN = "Unknown";
/*
* Network type constants
*/
public static final String NETWORK_CDMA = "CDMA: Either IS95A or IS95B (2G)";
public static final String NETWORK_EDGE = "EDGE (2.75G)";
public static final String NETWORK_GPRS = "GPRS (2.5G)";
public static final String NETWORK_UMTS = "UMTS (3G)";
public static final String NETWORK_EVDO_0 = "EVDO revision 0 (3G)";
public static final String NETWORK_EVDO_A = "EVDO revision A (3G - Transitional)";
public static final String NETWORK_EVDO_B = "EVDO revision B (3G - Transitional)";
public static final String NETWORK_1X_RTT = "1xRTT (2G - Transitional)";
public static final String NETWORK_HSDPA = "HSDPA (3G - Transitional)";
public static final String NETWORK_HSUPA = "HSUPA (3G - Transitional)";
public static final String NETWORK_HSPA = "HSPA (3G - Transitional)";
public static final String NETWORK_IDEN = "iDen (2G)";
73
public static final String NETWORK_LTE = "LTE (4G)";
public static final String NETWORK_EHRPD = "EHRPD (3G)";
public static final String NETWORK_HSPAP = "HSPAP (3G)";
public static final String NETWORK_UNKOWN = "Unknown";
/*
* Phone type constants
*/
public static final String PHONE_CDMA = "CDMA";
public static final String PHONE_GSM = "GSM";
public static final String PHONE_SIP = "SIP";
public static final String PHONE_NONE = "No radio";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pb=(ProgressBar)findViewById(R.id.progressBar2);
bn=(Button)findViewById(R.id.bt);
bw=(TextView)findViewById(R.id.bandwidth);
pt=(TextView)findViewById(R.id.phone_type);
nt=(TextView)findViewById(R.id.network_type);
ss=(TextView)findViewById(R.id.sim_state);
nn=(TextView)findViewById(R.id.network_name);
uname=(TextView)findViewById(R.id.uname);
username=getIntent().getStringExtra("username");
uname.setText("welcome "+username+",");
icon=R.drawable.ic_launcher;
bn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Get the telephony system service to find out network details
final TelephonyManager tm = (TelephonyManager)
getSystemService(TELEPHONY_SERVICE);
74
updateViews(tm)
// Since these attributes can change, we will register a
// {@code PhoneStateListener} to listen for these changes and
// update the view.
tm.listen(new PhoneStateListener() {
@Override
public void onServiceStateChanged(ServiceState serviceState) {
// Update our TextViews
updateViews(tm);
}
@Override
public void onDataConnectionStateChanged(int state) {
// A change in data connection state may be due to availability
// of a different network type
updateViews(tm);
}
}, PhoneStateListener.LISTEN_SERVICE_STATE |
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
// calculate bandwidth
Downloadfile df=new Downloadfile();
df.execute();});}
// @Override
// protected void onResume() {
// super.onResume();
// final TelephonyManager tm = (TelephonyManager)
getSystemService(TELEPHONY_SERVICE);
//
// // Update text views with readable values.
// updateViews(tm);
// }
75
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
/**
* Update text views with telephony attributes.
*/
private final void updateViews(TelephonyManager tm) {
/**
* Returns a string describing the current SIM state.
*/
private static String mapSimStateToName(int simState) {
switch (simState) {
case TelephonyManager.SIM_STATE_ABSENT:
return SIM_ABSENT;
case TelephonyManager.SIM_STATE_READY:
return SIM_READY;
76
case TelephonyManager.SIM_STATE_PIN_REQUIRED:
return SIM_PIN_REQUIRED;
case TelephonyManager.SIM_STATE_PUK_REQUIRED:
return SIM_PUK_REQUIRED;
case TelephonyManager.SIM_STATE_NETWORK_LOCKED:
return SIM_NETWORK_LOCKED;
case TelephonyManager.SIM_STATE_UNKNOWN:
return SIM_UNKNOWN;
default:
// shouldn't happen.
return null;
}
}
/**
* Returns a string indicating the phone radio type.
*/
private static String mapDeviceTypeToName(int device) {
switch (device) {
case TelephonyManager.PHONE_TYPE_GSM:
return PHONE_GSM;
case TelephonyManager.PHONE_TYPE_NONE:
return PHONE_NONE;
default:
// shouldn't happen.
return null;
}
}
/**
* Returns a string describing the network type.
*/
77
public static String mapNetworkTypeToName(int networkType) {
switch (networkType) {
case TelephonyManager.NETWORK_TYPE_EDGE:
return NETWORK_EDGE;
case TelephonyManager.NETWORK_TYPE_GPRS:
return NETWORK_EDGE;
case TelephonyManager.NETWORK_TYPE_UMTS:
return NETWORK_UMTS;
// case TelephonyManager.NETWORK_TYPE_HSPAP:
// return NETWORK_HSPAP;
case TelephonyManager.NETWORK_TYPE_UNKNOWN:
default:
return NETWORK_UNKOWN;
}
}
class Downloadfile extends AsyncTask<String, Void, Void> {
String list=null;
@Override
protected Void doInBackground(String... params) {
//urlString="http://llc.mtsac.edu/handouts/powerpoint.pdf";
urlString="http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Me
dia/H264_test3_Talkingheadclipped_mp4_480x360.mp4";
bandwidth=new Bandwidth().getBandwidth(urlString);
list=CallServices.getVideosFromMobileInfo(bandwidth,phonetype,networkname,sim
state,networktype,osversion,username, "mobileinfo");
return null;
}
@SuppressWarnings("deprecation")
78
@Override
protected void onPostExecute(Void result) {
bw.setText("Network Bandwidth: "+bandwidth+" kbps");
pb.setVisibility(View.INVISIBLE);
@Override
public void onClick(android.content.DialogInterface arg0, int
arg1) {
Intent intent1=new
Intent(getBaseContext(),VideoList.class);
intent1.putExtra("list", list);
intent1.putExtra("username", username);
startActivity(intent1);
}
});
// Show progressbar
pDialog.show();
@Override
79
protected void onPreExecute() {
pb.setVisibility(View.VISIBLE);
@Override
protected void onProgressUpdate(Void... values) {
}
}
80
CHAPTER 16
SCREENSHOTS
81
SCREENSHOTS
82
83
84
85
86
87
88
89
CHAPTER 17
CONCLUSION
90
CONCLUSION
Future Work
In this work, we just consider a singleflow scenario and ignore the interference from
the other flows as well as the competitive bidding for spectrum usage from the other flows.
In a CRN with multiflows, the CR source nodes need to develop sophisticated bidding
strategies considering the competition from the peer flows, and the SSP should jointly
consider the cross-layer factors and the bidding values to determine the sharing of
theharvested spectrum.
91
REFERENCES
92