Functions-Network Programming-Project (Bluetooth PAN) Report, Study Guides, Projects, Research of Network Programming

This is project report. It was submitted as part of project in Network Programming course to supervisor and course instructor was Prof. Tausiq Dasgupta at Babasaheb Bhimrao Ambedkar University. It includes: Bluetooth, PAN, Implementation, Functions, Network, Programming, Rejected, GUI, Image, Argument

Typology: Study Guides, Projects, Research

2011/2012

Uploaded on 07/31/2012

dhanush
dhanush 🇮🇳

4

(3)

36 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Bluetooth PAN Implementation
Functions
25 | P a g e
Chapter 4: Functions
A number of functions are used in this code, apart from the built in GUI functions,
bellow is a brief description of these functions.
rej = rejected(num)
This function chooses the appropriate image from the image library to display in the
simulation pane. The input argument num shows the number of current nodes and the
respective image is returned in rej.simu and the status ‘Active devices in PAN’ is
returned in rej.stat, since rej is a structure with fields simu and stat.
im = queue(num,node)
This function loads a queue of images from the image library to show in the simulation
panel after a random delay to show the data sent to each slave according to its time
slot. The variable im is a structure array with fields simu and stat. The size of im
varies with num. The node variable is passed to the function to send the name
information to update the status window.
broad = broadcast(num,node)
The above function is used to update the broadcast image and the status bar according
to the number of nodes present in the network. The structure array node is passed to
this function to get the list of the names, the Master node sends data to. The returned
variable broad has one entry with fields simu and stat.
s = sel(num,node,set_val)
For sending data to a selected user, the above function is used. It gets the variables
num and node to get the names and number of nodes in the network. The third input
argument set_val is used to indicate which client is selected. This is required to load
the proper image and status. It also has the fields simu and stat.
[t t2] = terminating(num1,clone,set_val);
This function is used to represent the terminating figure sequence according to the
number of nodes in the network. set_val is again passed to indicate which device is
being terminated. The variable clone is actually a copy of the structure node just to
save the device info after it is terminated from the network to update the status.
docsity.com
pf2

Partial preview of the text

Download Functions-Network Programming-Project (Bluetooth PAN) Report and more Study Guides, Projects, Research Network Programming in PDF only on Docsity!

Bluetooth PAN Implementation Functions

25 | P a g e

Chapter 4: Functions

A number of functions are used in this code, apart from the built in GUI functions, bellow is a brief description of these functions.

rej = rejected(num)

This function chooses the appropriate image from the image library to display in the simulation pane. The input argument num shows the number of current nodes and the respective image is returned in rej.simu and the status ‘Active devices in PAN’ is returned in rej.stat , since rej is a structure with fields simu and stat.

im = queue(num,node)

This function loads a queue of images from the image library to show in the simulation panel after a random delay to show the data sent to each slave according to its time slot. The variable im is a structure array with fields simu and stat. The size of im varies with num. The node variable is passed to the function to send the name information to update the status window.

broad = broadcast(num,node)

The above function is used to update the broadcast image and the status bar according to the number of nodes present in the network. The structure array node is passed to this function to get the list of the names, the Master node sends data to. The returned variable broad has one entry with fields simu and stat.

s = sel(num,node,set_val)

For sending data to a selected user, the above function is used. It gets the variables num and node to get the names and number of nodes in the network. The third input argument set_val is used to indicate which client is selected. This is required to load the proper image and status. It also has the fields simu and stat.

[t t2] = terminating(num1,clone,set_val);

This function is used to represent the terminating figure sequence according to the number of nodes in the network. set_val is again passed to indicate which device is being terminated. The variable clone is actually a copy of the structure node just to save the device info after it is terminated from the network to update the status.

docsity.com

Bluetooth PAN Implementation Functions

26 | P a g e

t is again a structure with fields simu and stat. This contains the image to represent when the device is being terminated. t2 is just an image file to show how many nodes are active in the network, after the device is terminated.

bytes = data

This function generates a random number of bytes, that are assumed to be transferred using the buffers to read and write data. This function also generates a certain delay according to the number of bytes.

pin_code = keygen

The above function randomly generates a 4 digit key to be represented as the key displayed by the master device.

docsity.com