You are on page 1of 128

AMA COMPUTER COLLEGE

Calamba Campus

COLLEGE OF ENGINEERING

BIBLIOGRAPHY

Books

Hoffer/Prescott/McFadden (2002). International Edition Modern Database Management (Sixth Edition). Pearson Education, Inc., Upper Saddle River, New Jersey Roy Blake (2002). Electronic Communication Systems (Second Edition). Delmar division of Thompson Learning Ronald Banasihan (January 2003). Buhawi Magazine ,Issue No. 6, Vol. 2 Daniel Smith Jr., ( October 2010). Introduction to Visual Basic Rudolf Anol (April 2009). Energy Science Shaun Cliff (2008). PC Magazine Jeff Salk (January 2003). Buhawi Magazine ,Issue No. 6, Vol. 2

Theses

De Guzman, William (2009). Proposed Attendance Monitoring System Using Barcode. Unpublished Thesis. AMA COMPUTER COLLEGE-CALAMBA CAMPUS

156

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Ruel, (2011). Student Attendance using Barcode in Touch Screen Interface Unpublished Thesis. Asio, December (2008). Microcontroller Based Car Usage Authentication & Activity Monitoring with the Use of Drivers License and Finger Print Matching. Unpublished Thesis. Marvin, December (2010). Monitoring for Library and Laboratory Using Zigbee. Unpublished Thesis. De la salle University CH.S.ELLARAO, CHIRANJEEVI.N, CH.HARISH REDDY (2013). Finger Print Attendance Management. Unpublished Thesis. Terry Web, Roger Price, Sandy Philip and Marty Crabbs (2009). Madison Technical College Room Scheduling Process. Unpublished Thesis. Madison Area Technical College Tomas Echeverria, Daniel Boyd, Ryan McGowan, Derek Smith, and Sherry Thomas (2008). Room Scheduling for New Mexico Tech. Unpublished Thesis. New Mexico
Websites

http://www.e-gizmo.com/kit2.html (02 January 2012). http://www. E-gizmo.com (02 January 2013). http://www.ukessays.co.uk/essays/engineering/features-ofmicrocontroller.php (05 December 2012). http://infohost.nmt.edu/~roominfo/designdoc/SE_Final_Report.pdf (05 July 2008) http://intranet.madisoncollege.edu/formsdb/forms/Final%20Report%20Room%20Scheduling.pdf?c=intranet.ma tcmadison.edu (21 August 2009) http://seminarprojects.com/Thread-finger-print-project-fullreport#ixzz2EHKCE8Xr (06 December 2012).

157

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
http://www.touchboards.com/polyvision/PolyvisionRoomWizardII.html (12 January 2012) http://www.touchboards.com/polyvision/pdf/RoomWizardII_Brochure.p df (3 December 2012) http://www.prenhall.com/hopper (6 February 2012) http://www.electronitech.com (12 November 2011) http://www.delmar.com (7 December 2011) http://www.thompsonlearning.com (18 August 2010)

158

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Appendix A
(Material and Component Datasheets)

159

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

ADST11SD300&310
Fingerprint Identification Module Users Guide (Ver 4.0)

160

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

ID System Technology Co.,Ltd http://www.szadst.com

161

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING 1. Summary


Functions and Characteristic: ADST11SD3xx serial is All-in-one (Optic sensor +CMOS image sensor + CPU +Flash memory) embedded stand-alone fingerprint identification module, it is convenient for second development,Extremely easy to integrate minimizing time-tomarket.

1.1 Main functions


Optic sensor is reliable and Low-cost, High ESD Protection 1:N Identification (One-to-Many) 1:1 Verification (One-to-One) High speed fingerprint identification algorithm engine Self study function Fingerprint template data read from /write to FLASH memory function Get Feature Data of Captured fingerprint Verify Downloaded Feature with Captured fingerprint Identify Downloaded Feature with Captured fingerprint Security Level setting Standby mode Communication interface :UART

1.2 Application examples


Access control systems Time & Attendance Locks, safes

162

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
POS terminals

1.3 Technology Parameter


Item CPU Sensor Fingerprint capacity FAR FRR Match Mode Fingerprint Data size Security level Time of Response 1:N matching3000 fingerprints< 1s Resistant to Abrasion >1 Million Finger Press UARTParity = NONE,Stop Bit = 1,Flow Control = NONE Communication Baud rate is 9600/19200/38400/57600/115200 (BPS) Default setting115200bps Description Core:ARC (120Mhz,1M bit Flash Memory,128K SRAM) Optic sensor 500~5000 can be enlargeDefault setting is 3000 fingerprints < 0.001 %Security Level is 3 < 0.1 %Security Level is 3 1:N identification and 1:1 verification 496 Byte Level 1 to Level 5 can be set , default setting is : Level 3 Fingerprint pretreatment < 0.45

163

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Working Voltage Working Current DC 3.3V-5V Max 100mAStandby Mode less than 5mA Working Temperature-10 to 60 Working Environment Relative humidity20% 80% Storage temperature: -20 to 80 Storage Environment Storage humidity:<90%

1.4 Default Setting


Item Security Level15 Finger Time Out060S BaudRate9600192003840057600115200BPS Fingerprint Duplication CheckON/OFF Value 3 5s 115200 BPS ON

164

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING 2. Configration and Connector

2.1 Mount and Connector

Fig2-1. Shape of ADST11SD300&310

165

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Table2-1. Connector Signal description Pin No. PIN 1 Color White Signal name UART-TX Signal Description Module Transmit Output,3.3V TTL Logic Module Receive Input,3.3V TTL Logic GND DC Input,Range of voltage is 3.3V-5V

PIN 2 PIN 3 PIN 4

Yellow Black Red

UART-RX GND VIN

166

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

2.2 Dimension of ADST11SD300

167

S e ria l


CPU

3.3V GND RXD TXD RST

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Fig2-2. Dimension of ADST11SD300

2.3 Dimension of ADST11SD310

168

S e ria l


CPU

3.3V GND RXD TXD RST

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Fig 2-3. Dimension of ADST11SD310

3. Communication Protocol
The module is used as a slave device. The Master device sends relative commands to control it. The CMD sent by the master and the ACK signal returned by the module. Command interface: UART (Universal Asynchronous Receiver Transmitter) Default Setting is : 115200BPS ,1 start-bit ,1 stop-bit ,no check bit

3.1 The process of communication


HOST T A R G E TADST11SD300&310

Begin Wait Command Command Packet Send Command

Receive Command
Data Packet

Process Command Receive Result

169

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Response Packet

Data Packet

Send Result

End

Fig3-1.Process of Communication Notice. Host do not send next command until receive result , except send FP Cancel

3.2 Classify of communication packet


3.2.1 Command packet Command Packet is the instruction from Host to Target (ADST11SD3xx), Total length of the command packet is 24 Bytes 3.2.2 Response packet Response packet is result of execute command packet, from Target (ADST11SD3xx) to Host,

170

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Total length of the command packet is 24 Bytes 3.2.3 Data Packet When length of Command Parameter or Data is larger than 16 Bytes, Utilize Data Packet to transmit block Data, the maximum length of Data Packet is 512Bytes

3.3 Packet Structure


3.3.1 Packet Identify Code Section of start 2byte prefix define type of packet Type of Packet Command packet Response packet Command Data Packet Response Data Packet Code 0xAA55 0x55AA 0xA55A 0x5AA5

3.3.2 Structure of Command Packet PREFIX CMD LEN 0x55 0xAA L 0 1 2 H 3 L 4 H 5

DATA D0 6 D1 7 D15 21

CKS L 22 H 23

OFFSET FIELD

TYPE

SIZE

DESCRYPTION

171

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
0 2 PREFIX WORD CMD WORD 2byte 2byte 2byte (=n, n < 17) Packet Identify code Command Code

LEN

WORD Byte array

Length of Command Parameter

DATA

16byte

Command Parameter Check Sum is the low word of value listed below: offset[0] + offset[1] + +offset[21]

22

CKS

WORD

2byte

3.3.3 Response packet PREFIX RCM 0xAA 0 0x55 L 1 2 H 3

LEN L 4 H 5

RET L 6 H 7

DATA D0 D1 8 9 D13 21

CKS L 22 H 23

OFFSET FIELD 0 2 4

TYPE

SIZE 2byte 2byte 2byte(=n, n <

DESCRYPTION Packet Identify code Response Code RET and DATA

PREFIX WORD RCM LEN WORD WORD

172

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
17) Result Code 6 RET WORD Byte array 2byte (0 :success1 :fail

DATA

14byte

Response Data (n-2 byte) Check Sum is the low word of value listed below: offset[0] + offset[1] + +offset[21]

22

CKS

WORD

2byte

3.3.4 Command Data Packet PREFIX CMD LEN 0x5A 0 0xA5 1 L 2 H 3 L 4 H 5

DATA D0 D1 6 7 Dn-1 6+n-1

CKS L 6+n H 6+n+1

OFFSET FIELD 0 2

TYPE

SIZE 2byte 2byte

DESCRYPTION Packet Identify code Command Code

PREFIX WORD CMD WORD

173

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
2byte(=n , n < 512)

LEN

WORD Byte array

Length of DATA

DATA

nbyte

Command parameter Check Sum is the low word of value listed below: offset[0] + offset[1] + +offset[6+n-1]

6+n

CKS

WORD

2byte

Before send Command Data packet, Host first send Command packet which set the length of next command data packet in Data Field 3.3.5 Response Data Packet PREFIX RCM LEN 0xA5 0 0x5A 1 L 2 H 3 L 4 H 5

RET L 6 H 7

DATA D0 8 D1 9 Dn-3 6+n1

CKS L H

6+n 6+n+1

OFFSET FIELD 0 2

TYPE

SIZE 2byte 2byte 2byte(=n, n < 512)

DESCRYPTION Packet Identify code Response Code Length of result data(RET + DATA)

PREFIX WORD RCM WORD

LEN

WORD

174

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Result code 0 : success 1 : fail

RET

WORD Byte array

2byte n-2byte

DATA

Response data Check Sum is the low word of value listed below: offset[0] + offset[1] + +offset[6+n-1]

6+n

CKS

WORD

2byte

4. Packet Command Detail Description

4.1 Structure of Fingerprint Template Data is follow


Template Data(496Bytes)+CheckSum(2Bytes)=498Bytes

Template Data 496 bytes Template Data D0,D1,D495

CheckSum 2 byte Check Sum is the low word of value listed below: D0+D1++D495

4.2 Command List


N o Function Command CMD LEN DATA Response RCM LEN RE T DATA

175

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
N o 1 Function Verify Command 0x0101 2 Template No. Response 0x0101 4 0/1 Template No./ Error Code 2 Identify 0x0102 0 0x0102 4 0/1 Template No ./ Error Code 3 Enroll 0x0103 2 Template No. 0x0103 4/6 0/1 Template No. / Error Code + Duplicaion ID 4 Enroll One Time 0x0104 2 Template No. 0x0104 4/6 0/1 Template No. / ErrorCode 5 Clear Template 0x0105 2 Template No. 0x0105 4 0/1 Template No. / ErrorCode 6 Clear All Template 0x0106 0 0x0106 4 0/1 Cleared TemplateCoun t/ Error Code 7 Get Empty ID 0x0107 0 0x0107 4 0/1 Template No. / Error Code

176

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
N o 8 Function Get Template Status Get Broken Template Command 0x0108 2 Template No. Response 0x0108 4 0/1 Template Status /Error Code 9 0x0109 0 0x0109 6 0/1 Broken Template Count + First Broken Template No./Error Code Template No + Template Record Data /Error Code

10

Read Template

0x010 A

Template No.

0x010 A

( 0/1 Templat e Record Size + 4) or (4)

11

Write Template

0x010 B

Templat Template e Record No. + Size + 2 Template Record Data 2 Security Level Value

0x010 B

0/1

Template No. / Error Code

12

Set Security 0x010 Level C

0x010 C

0/1

Security Level Value/Error Code

13

Get Security Level

0x010 D

0 -

0x010 D

Security Level Value

177

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
N o 14 Function Set Finger Time Out Command 0x010 E 2 Time Out Value Response 0x010 E 4 0/1 TimeOut Value / Error Code 15 Get Finger Time Out Set Device ID Get Device ID Get F/W Version Finger Detect Set BaudRate 0x010F 0 Device ID 0x010F 4 0 TimeOut Value Device ID

16

0x0110

0x0110

17

0x0111

0x0111

0/1

Device ID / Error Code

18

0x0112

0x0112

F/W Version

19

0x0113

0x0113

Detect Result

20

0x0114

BaudRate Index

0x0114

0/1

BaudRate Index / Error Code

21

Set Duplication Check

0x0115

Duplicatio n Check Option(1/0 ) -

0x0115

0/1

Duplication Check Option /Error Code

22

Get Duplication Check

0x0116

0x0116

Duplication Check Option

178

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
N o 23 Function Enter Stadby Mode Enroll And Store in RAM Get Enroll Data Command 0x0117 0 Response 0x0117 4 0 -

24

0x0118

0x0118

0/1

0 / ErrorCode

25

0x0119

0x0119

( 0/1 Templat e Record Size + 2) or (4) ( 0/1 Templat e Record Size + 2) or (4) 4 0/1

Template Record Data /Error Code

26

Get Feature Data of Captured FP

0x011 A

0x011 A

Template Record Data /Error Code

27

Verify Downloade d Feature with Captured FP

0x011 B

Templat Template e Record Record Size Data

0x011 B

0/Error Code

179

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
N o 28 Function Identify Downloade d Feature with Captured FP 29 Get Device Name 0x0121 0 0x0121 16 0/1 STO20OEM /Error Code 30 Sensor LED Control Identify Free 0x0124 2 0/1 0x0124 4 0 0 Command 0x011 C Templat Index + e Record Template Size + 2 Record Data Response 0x011 C 4 0/1 0/Error Code

31

0x0125

0x0125

0/1

Template No. / Error Code

32

Set Device Password Verify Device Password Get Enroll Count FP Cancel

0x0126

14

Password

0x0126

0/1

0/ Error Code

33

0x0127

14

Password

0x0127

0/1

0/ Error Code

34

0x0128

0x0128

0/1

Enroll Count /Error Code -

35

0x0130

0x0130

180

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
N o 36 Function Test Connection Incorrect Command Command 0x0150 0 Response 0x0150 2 0 0 -

37

0x0160

Table4-2 Command List

5. Appendix

5.1 Response and Error Code


No. Response and Error Code 1 2 3 4 ERR_SUCCESS ERR_FAIL ERR_VERIFY ERR_IDENTIFY Value 0x00 0x01 0x11 0x12 Description Successful for command execute Fail for command execute One to one match fail Identify fail, no matched template The appointed Template Data is Null Existed Template Data for the appointed ID All template is Null, Without enrolled Template Without available Template ID.

ERR_TMPL_EMPTY

0x13

ERR_TMPL_NOT_EMPTY

0x14

ERR_ALL_TMPL_EMPTY

0x15

ERR_EMPTY_ID_NOEXIST

0x16

181

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
9 10 ERR_BROKEN_ID_NOEXIST ERR_INVALID_TMPL_DATA 0x17 0x18 Without damaged Template. Appointed Template Data is invalid. The fingerprint has been enrolled. Bad quality fingerprint image. During Time Out period, no finger is detected Command is without authorization Generalize Template Data fail Relative fingerprint command have been cancelled Internal Error Memory Error Firmware Error Template No. is invalid The Value of Security Level is invalid The Value of Time Out is invalid

11

ERR_DUPLICATION_ID

0x19

12 13

ERR_BAD_QUALITY ERR_TIME_OUT

0x21 0x23

14

ERR_NOT_AUTHORIZED

0x24

15 16

ERR_GENERALIZE ERR_FP_CANCEL

0x30 0x41

17 18 19 20 21

ERR_INTERNAL ERR_MEMORY ERR_EXCEPTION ERR_INVALID_TMPL_NO ERR_INVALID_SEC_VAL

0x50 0x51 0x52 0x60 0x61

22

ERR_INVALID_TIME_OUT

0x62

182

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
23 ERR_INVALID_BAUDRATE 0x63 The Value of Baud Rate is invalid Not setting Device ID Option Value of Duplication Check is invalid Parameter is invalid In process of IdentifyFree command, Finger is not release 28 GD_DOWNLOAD_SUCCESS 0xA1 Download Template Record Data is successful

24 25

ERR_DEVICE_ID_EMPTY ERR_INVALID_ DUP_VAL

0x64 0x65

26 27

ERR_INVALID_PARAM ERR_NO_RELEASE

0x70 0x71

29

GD_NEED_FIRST_SWEEP

0xFFF1 Waiting input fingerprint for the first time. 0xFFF2 Waiting input fingerprint for the second time. 0xFFF3 Waiting input fingerprint for the third time.

30

GD_NEED_SECOND_SWEEP

31

GD_NEED_THIRD_SWEEP

32 33 34 35

GD_NEED_RELEASE_FINGER 0xFFF4 Lift finger GD_DETECT_FINGER GD_NO_DETECT_FINGER 0x01 0x00 There is an finger on sensor There is no finger on sensor The appointed Template Data are not null

GD_TEMPLATE_NOT_EMPTY 0x01

183

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
36 GD_TEMPLATE_EMPTY 0x00 The appointed Template Data are null

Gizduino: Arduino Compatible Kit


(Atmega168 and Atmega328) Hardware Manual Rev 1r0
e-Gizmo Learn to use and program microcontroller the fast and easy way. e-Gizmos Gizduino platform kit is a single board AVR microcontroller platform based on highly popular open source Arduino design. It can be used as well with AVRs tradional programming tools.

The Gizduino is a microcontroller board based on the ATmega328 and ATmega168. It has 14 digital input/ output pins, 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-toDC adapter or battery to get started. it is an open source computing platform based on a simple input/output (I/O) board and the use of standard programming language; in otherwords, it is a tool for implementing a program you have designed. Gizduino is programmed using the IDE (Integrated Development Environment). Gizduino is ideal for beginner programmers and hobbyists because of its simplicity compared to other platforms. It is a multiplatform environment; it can run on Windows, Macintosh, and Linux. It is programmable via USB cable, which makes it more accessible

184

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
and allows communication with the computer.

FEATURES & SPECIFICATIONS


Microcontroller: ATmega168 or ATmega328 User Interface: USB Port, DC Jack, Reset Button, ICSP Port, Shield Connection Port Debbuger Port: ICSP Power Input: External:8V-12V USB:5V DC Power Output: 3.3V PCB Size: 2.7 x 2.1 inch On-board Crystal: 16MHz and 12MHz

185

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

PARTS & PINS DESCRIPTION Gizduino: Arduino


Compatible Kit Datasheet Version 1

No. I.D. Description 1 AREF analog reference pin for the A/D Converter.

186

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
2 GND ground. 3 13 Digital I/O 4 12 Digital I/O 5 11 PWM OUT 6 10 PWM OUT / Digital I/O 7 9 PWM OUT / Digital I/O 8 8 Digital I/O 9 7 Digital I/O 10 6 PWM OUT / Digital I/O 11 5 PWM OUT / Digital I/O 12 4 Digital I/O 13 3 PWM OUT / Digital I/O 14 2 Digital I/O 15 1 TX / Digital I/O 16 0 RX / Digital I/O No. I.D. Description 1 A0 Analog I/O 2 A1 Analog I/O 3 A2 Analog I/O 4 A3 Analog I/O 5 A4 Analog I/O 6 A5 Analog I/O 7 A6 Analog I/O 8 A7 Analog I/O No. I.D. Description 1 Reset reset. 2 +3.3V 3.3V Device Power Supply 3 +5V 5V Device Power Supply 4 GND ground. 5 GND ground. 6 VIN 8-12V Device Power Supply its a choice of ATmega168 or ATmega328 Microcontroller Device Flash Mem. EEPROM RAM Interrupt Vector Size
ATmega168PA 16K Bytes 512 Bytes 1K Bytes 2 instruction words/vector ATmega328P 32K Bytes 1K Bytes 2K Bytes 2 instruction words/vector

187

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

188

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

189

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

190

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

191

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

192

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

193

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

194

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

195

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

196

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

197

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

198

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Appendix B
(Complete Program Source Code Listing)

199

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

200

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Start

Counter = 1 Waiting for finger Yes

FP Cancel? No Yes Time Out ? No

No
Capture Success? Yes Increasing Counter No

Counter = 3 ? Yes No
Generalize Success?

Yes Result = Success Result = Fail

Flowchart of the program

End

201

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Start Waiting for finger

FP Cancel? No Time Out? No No

Yes

Yes 202
Result = Timeout

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Program Listing with Comments

A. Home Form VB Code


Public Class Homeform

203

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
'near na to Dim sendData(24) As Byte 'fps prog Dim replData(48) As Byte Dim serialData As String Dim rxDisplay As String Dim resultReply As String Dim whatProcess As String Delegate Sub SetTextCallBack2(ByVal [setResultDisplay] As String) 'up to here Dim command As String Dim a As Integer Dim b As Integer Dim x As Integer Dim y As Integer Dim p As Integer Dim r As Integer Dim day As Integer Dim result As String Dim result1 As String Private Sub Room1BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room1BindingNavigatorSaveItem.Click Me.Validate() Me.Room1BindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.DenisDataSet) End Sub Private Sub Homeform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load txtResult.Text = "0" txtResult1.Text = "0" txtresult2.Text = "0" txtwindow.Text = "0" 'SET-UP COMPORT If serialPort.IsOpen Then Else 'this for loop will clear byte array sendDAta wala lang to pang linis lang For i As Integer = 0 To 23 sendData(i) = 0

204

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Next 'if you going to read fPM you can see that 0xAA55 is code fore comand wich will be send to fps 'and x0102 is command for Identify mode or scan mode ' ask fps manual about this sendData(0) = &H55 sendData(1) = &HAA sendData(2) = &H2 sendData(3) = &H1 checkSum() ' I Call CheckSum just check this out 'now we will send it on the serial we through 24 bytes on serial prot whatProcess = "READ" serialPort.Write(sendData, 0, 24) End If serialPort.Close() End Sub Private Sub checkSum() 'check sum compute here CKS = 0 'in check sum it is needed to get the summation of all data' in the case of fps only first 20 byte is needed to add For i As Integer = 0 To 21 CKS += sendData(i) Next ' We will now append cpk to the last 2 bytes of our data since the cks is more than 256 we need to bytes ' to contain them we need to devide dem in to higher byte and lower byte 'first, lower byte of the cpk it something like getting the mod of 255(hFF) here or just get the remainder sendData(22) = CKS And &HFF 'second, higher byte of the cpk in this part you just 'count how many byte are there in cks (devide it by 256 then you can get it) sendData(23) = (CKS - (CKS And &HFF)) / 256 'nothing do here just return End Sub Private Sub PictureBox1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseHover

205

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
PictureBox1.BorderStyle = BorderStyle.FixedSingle End Sub Private Sub PictureBox1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave PictureBox1.BorderStyle = BorderStyle.None End Sub Private Sub PictureBox2_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseHover PictureBox2.BorderStyle = BorderStyle.FixedSingle End Sub Private Sub PictureBox2_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseLeave PictureBox2.BorderStyle = BorderStyle.None End Sub Private Sub PictureBox3_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.MouseHover PictureBox3.BorderStyle = BorderStyle.FixedSingle End Sub Private Sub PictureBox3_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.MouseLeave PictureBox3.BorderStyle = BorderStyle.None End Sub Public Sub DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles serialPort.DataReceived Dim returnValue As Integer 'Dim serialData As String

206

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Dim buffer As Byte() resultReply = "" 'serialData = serialPort.ReadExisting() Dim n As Integer = serialPort.BytesToRead buffer = New Byte(n - 1) {} returnValue = serialPort.Read(buffer, 0, n) If returnValue > 0 Then rxDisplay = "" For i As Integer = 1 To returnValue 'replData(i - 1) = Asc(Mid(serialData, i, 1)) 'rxDisplay = rxDisplay + " " + Hex(replData(i - 1)) replData(i - 1) = buffer(i - 1) 'rxDisplay = rxDisplay + " " + Hex(replData(i - 1)) 'rxDisplay = rxDisplay + "index:" + Str(i) + "(" + Hex(replData(i - 1)) + ") " rxDisplay = rxDisplay + " " + Hex(replData(i - 1)) Next i setRXDisplay(rxDisplay) End If 'here Ill display the result If replData(6) = 0 Then '7 byte's value is 0 means there is no error 'THIS WILL ENTER THE ENROLLMENT POSSIBLE OUTPUT If whatProcess = "ENROLL" Then ' possible na ang mareceive ko dito ay para sa enroll response perO may mas madaling paraan tingan nyo nalng sa pfs ito way ko eh mabilisan ba. If replData(8) = Int(&HF1) And replData(9) = Int(&HFF) Then resultReply = "Press a finger to register first time." End If If replData(8) = Int(&HF2) And replData(9) = Int(&HFF) Then resultReply = "Press the same finger the second time..." End If If replData(8) = Int(&HF3) And replData(9) = Int(&HFF) Then

207

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
resultReply = "Press the same finger the last time..." End If If replData(8) = Int(&HF4) And replData(9) = Int(&HFF) Then resultReply = "Lift finger..." End If If replData(4) = Int(&H6) Then resultReply = "Ok" End If '----------------------------------------------------------'THIS IF FOR DELETE INDIVIDUAL ElseIf whatProcess = "DELETE" Then resultReply = "User Deleted" 'THIS IS FOR DELETE ALL USER ElseIf whatProcess = "DELETEALL" Then resultReply = "All Users Deleted" 'THIS IS FOR CANCEL ALL USER ElseIf whatProcess = "CANCEL" Then resultReply = "Cancelled" 'THIS IS FOR READ ElseIf replData(8) = Int(&HF4) And replData(9) = Int(&HFF) And whatProcess = "READ" Then 'JUST GO BACK TO THE THREAD Else resultReply = +Str(replData(9) * 256 + replData(8)) End If Else error code '7 byte's value is 1 or greater, means it is error go to or pfs check that for your self If replData(8) = Int(&H12) Then resultReply = "Di kita kilala! Tsupi!" ElseIf replData(8) = Int(&H14) Then resultReply = "Location not empty!" ElseIf replData(8) = Int(&H15) Then resultReply = "No enrolled user!"

208

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
ElseIf replData(8) = Int(&H21) Then resultReply = "Bad quality fingerprint image!" ElseIf replData(8) = Int(&H60) Then resultReply = "Location No. not valid!" End If End If End Sub 'here ill display bytes ' InvokeRequired required compares the thread ID of the ' calling thread to the thread ID of the creating thread. ' If these threads are different, it returns true. Private Sub setRXDisplay(ByVal rxDisplay As String) If Me.txtResult.InvokeRequired Then Dim d As New SetTextCallBack1(AddressOf setRXDisplay) Me.Invoke(d, New Object() {[rxDisplay]}) Else Me.txtwindow.Text = rxDisplay '[Text] End If End Sub 'here ill display bytes ' InvokeRequired required compares the thread ID of the ' calling thread to the thread ID of the creating thread. ' If these threads are different, it returns true. Private Sub setResultDisplay(ByVal resultDisplay As String) If Me.txtResult.InvokeRequired Then Dim d As New SetTextCallBack2(AddressOf setResultDisplay) Me.Invoke(d, New Object() {[resultDisplay]}) Else 'Me.txtResult.Text = "Hello No. " + Str(Int(Asc(Mid$(Right$(Rx, 24), 10, 1)) * 256 + Asc(Mid$(Right$(Rx, 24), 9, 1)))) + " Welcome!" Me.txtResult.Text = resultReply Me.txtResult1.Text = resultReply Me.txtresult2.Text = resultReply End If End Sub Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click serialPort.Open() If serialPort.IsOpen Then

209

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
'this for loop will clear byte array sendDAta wala lang to pang linis lang For i As Integer = 0 To 23 sendData(i) = 0 Next 'if you going to read fPM you can see that 0xAA55 is code fore comand wich will be send to fps 'and x0102 is command for Identify mode or scan mode ' ask fps manual about this sendData(0) = &H55 sendData(1) = &HAA sendData(2) = &H2 sendData(3) = &H1 checkSum() ' I Call CheckSum just check this out 'now we will send it on the serial we through 24 bytes on serial prot whatProcess = "READ" serialPort.Write(sendData, 0, 24) End If serialPort1.Close() 'alis muna////// 'Choice.Show() 'Choice.Button3.Visible = True 'Choice.Button5.Visible = True End Sub Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click If serialPort.IsOpen Then serialPort.Close() 'this for loop will clear byte array sendDAta wala lang to pang linis lang For i As Integer = 0 To 23 sendData(i) = 0 Next serialPort.Open()

210

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
'if you going to read fPM you can see that 0xAA55 is code fore comand wich will be send to fps 'and x0102 is command for Identify mode or scan mode ' ask fps manual about this sendData(0) = &H55 sendData(1) = &HAA sendData(2) = &H2 sendData(3) = &H1 checkSum() ' I Call CheckSum just check this out 'now we will send it on the serial we through 24 bytes on serial prot whatProcess = "READ" serialPort.Write(sendData, 0, 24) End If 'alis muna//////// 'Choice.Show() 'Choice.Button4.Visible = True 'Choice.Button6.Visible = True End Sub Private Sub AboutsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutsToolStripMenuItem.Click Me.Dispose() Abouts.Show() serialPort.Close() End Sub Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click Me.Dispose() Help.Show() serialPort.Close() End Sub

211

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Private Sub txtResult1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtResult1.TextChanged 'for room2 If txtResult1.Text = "1" Then open11() ElseIf txtResult1.Text = "2" Then open21() ElseIf txtResult1.Text = "3" Then open31() ElseIf txtResult1.Text = "4" Then open41() End If End Sub Private Sub txtResult_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtResult.TextChanged If txtResult.Text = "1" Then open1() txtResult.Text = "0" ElseIf txtResult.Text = "2" Then open2() txtResult.Text = "0" ElseIf txtResult.Text = "3" Then open3() txtResult.Text = "0" ElseIf txtResult.Text = "4" Then open4() txtResult.Text = "0" End If End Sub Public Sub open1() If ProfessorTextBox.Text = "A" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1

212

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort.Close() serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor A") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

213

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
serialPort1.Open() command += "4" serialPort.Close() serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor A") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf ProfessorTextBox.Text = "VACANT" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor A" ProfessorTextBox.Text = "A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor A") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then

214

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
If ProfessorTextBox.Text = "A" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor A") ProfessorTextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are professor A" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open2() If ProfessorTextBox.Text = "B" Then

215

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor B" MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied"

but since

but since

216

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
txtwel1.Text = "Bye, professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor B") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf ProfessorTextBox.Text = "VACANT" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor B" ProfessorTextBox.Text = "B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor B") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then If ProfessorTextBox.Text = "B" Then Try serialPort1.Close() With serialPort1

217

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor B") ProfessorTextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are not professor B" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open3() If ProfessorTextBox.Text = "C" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None

218

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor C") serialPort1.Close() Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor C" Dim SAPI

but since

219

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor C") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf ProfessorTextBox.Text = "VACANT" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor C" ProfessorTextBox.Text = "C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor C") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then If ProfessorTextBox.Text = "C" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE

220

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor C") ProfessorTextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are not professor C" End If End If Else txtwel1.Text = "Make sure its your time!" End If Public Sub open4() If ProfessorTextBox.Text = "D" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One

9600 but since

221

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor D") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor D") Catch ex As Exception MsgBox(ex.ToString) End Try

but since

222

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End If ElseIf ProfessorTextBox.Text = "VACANT" Then If StatusTextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() StatusTextBox.Text = "Occupied" txtwel1.Text = "Welcome professor D" ProfessorTextBox.Text = "D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor D") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf StatusTextBox.Text = "Occupied" Then If ProfessorTextBox.Text = "D" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024

223

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
'.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) StatusTextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor D") ProfessorTextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are not professor D" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open11() If Professor1TextBox.Text = "A" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

224

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
serialPort1.Open() command += "5" serialPort1.WriteLine(command) Status1TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor A") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

serialPort1.Open() command += "6" serialPort1.WriteLine(command) Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor A") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor1TextBox.Text = "VACANT" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close()

225

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "5" serialPort1.WriteLine(command) Status1TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor A" Professor1TextBox.Text = "A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor A") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then If Professor1TextBox.Text = "A" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

226

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
serialPort1.Open() command += "6" serialPort1.WriteLine(command) Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor A") Professor1TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are professor A" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open21() If Professor1TextBox.Text = "B" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open()

227

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Status1TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor B") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

serialPort1.Open() command += "6" serialPort1.WriteLine(command) Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor B") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor1TextBox.Text = "VACANT" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE

228

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.BaudRate = 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() Status1TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor B" Professor1TextBox.Text = "B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor B") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then If Professor1TextBox.Text = "B" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "6" serialPort1.WriteLine(command) 'NORMAL BAUDRATE IS 9600

229

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor B") Professor1TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are professor B" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open31() If Professor1TextBox.Text = "C" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "5" serialPort1.WriteLine(command) Status1TextBox.Text = "Occupied"

230

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
txtwel1.Text = "Welcome professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor C") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor C") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor1TextBox.Text = "VACANT" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200

but since

231

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() Status1TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor C" Professor1TextBox.Text = "C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor C") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then If Professor1TextBox.Text = "C" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "6" serialPort1.WriteLine(command) Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor C" Dim SAPI

232

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor C") Professor1TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are professor C" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open41() If Professor1TextBox.Text = "D" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "5" serialPort1.WriteLine(command) Status1TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor D")

233

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

serialPort1.Open() command += "6" serialPort1.WriteLine(command) Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor D") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor1TextBox.Text = "VACANT" Then If Status1TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None

234

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
'.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() txtwel1.Text = "Welcome professor D" Professor1TextBox.Text = "D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor D") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status1TextBox.Text = "Occupied" Then If Professor1TextBox.Text = "D" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() Status1TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor D") Professor1TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else

235

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
txtwel1.Text = "You are professor D" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Private Sub txtresult2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtresult2.TextChanged If txtresult2.Text = "1" Then open12() ElseIf txtresult2.Text = "2" Then open22() ElseIf txtresult2.Text = "3" Then open32() ElseIf txtresult2.Text = "4" Then open42() End If End Sub Public Sub open12() If Professor2TextBox.Text = "A" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command)

236

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor A") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

serialPort1.Open() command += "4" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor A") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor2TextBox.Text = "VACANT" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1

237

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor A" Professor2TextBox.Text = "A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor A") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then If Professor2TextBox.Text = "A" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open()

238

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
command += "4" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor A" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor A") ProfessorTextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are professor A" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open22() If Professor2TextBox.Text = "B" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3"

but since

239

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
serialPort1.WriteLine(command) Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor B") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor B") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor2TextBox.Text = "VACANT" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500

240

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor B" ProfessorTextBox.Text = "B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor B") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then If Professor2TextBox.Text = "B" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor B" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor B") Professor2TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString)

241

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End Try Else txtwel1.Text = "You are not professor B" End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open32() If Professor2TextBox.Text = "C" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "3" serialPort1.WriteLine(command) Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor C") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then Try serialPort1.Close()

242

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With

but since

serialPort1.Open() command += "4" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor C") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor2TextBox.Text = "VACANT" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open()

243

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
command += "3" serialPort1.WriteLine(command) Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor C" Professor2TextBox.Text = "C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor C") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then If Professor2TextBox.Text = "C" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "4" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor C" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor C") Professor2TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are not professor C"

244

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End If End If Else txtwel1.Text = "Make sure its your time!" End If End Sub Public Sub open42() If Professor2TextBox.Text = "D" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None .ReceivedBytesThreshold = 24 .WriteBufferSize = 1024 .ReadBufferSize = 512 .ReadTimeout = 500 End With serialPort1.Open() command += "6" serialPort1.WriteLine(command) Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor D") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE

245

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.BaudRate = 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None .ReceivedBytesThreshold = 24 .WriteBufferSize = 1024 .ReadBufferSize = 512 .ReadTimeout = 500 End With serialPort1.Open() command += "7" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor D") Catch ex As Exception MsgBox(ex.ToString) End Try End If ElseIf Professor2TextBox.Text = "VACANT" Then If Status2TextBox.Text = "Unoccupied" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE .BaudRate = 9600 'NORMAL BAUDRATE IS 9600 but since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "6" serialPort1.WriteLine(command) 'NORMAL BAUDRATE IS 9600

246

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Status2TextBox.Text = "Occupied" txtwel1.Text = "Welcome professor D" Professor2TextBox.Text = "D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Welcome professor D") Catch ex As Exception MsgBox(ex.ToString) End Try ElseIf Status2TextBox.Text = "Occupied" Then If Professor2TextBox.Text = "D" Then Try serialPort1.Close() With serialPort1 .PortName = "COM3" 'PLACE THE COMPORT HERE 9600 but since .BaudRate = 9600 'NORMAL BAUDRATE IS we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .Handshake = IO.Ports.Handshake.None '.ReceivedBytesThreshold = 24 ' .WriteBufferSize = 1024 '.ReadBufferSize = 512 '.ReadTimeout = 500 End With serialPort1.Open() command += "7" serialPort1.WriteLine(command) Status2TextBox.Text = "Unoccupied" txtwel1.Text = "Bye, professor D" Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Bye, professor D") Professor2TextBox.Text = "VACANT" Catch ex As Exception MsgBox(ex.ToString) End Try Else txtwel1.Text = "You are not professor D" End If End If

247

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Else txtwel1.Text = "Make sure its your time!" End If

Room1 Code
Dim Dim Dim Dim Dim sendData(24) As Byte replData(48) As Byte serialData As String CKS As Integer whatProcess As String

Delegate Sub SetTextCallBack1(ByVal [rxDisplay] As String) Delegate Sub SetTextCallBack2(ByVal [setResultDisplay] As String) Private Sub Room1BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room1BindingNavigatorSaveItem.Click Dim x As Integer BindingNavigatorMoveLastItem.PerformClick() x = BindingNavigatorPositionItem.Text BindingNavigatorMoveFirstItem.PerformClick() For a As Integer = 1 To x If ProfessorTextBox.Text = "" Or _ StarthourTextBox.Text = "" Or _ StartminsTextBox.Text = "" Or _ StophourTextBox.Text = "" Or _ StopminTextBox.Text = "" Or _ SubjectTextBox.Text = "" Or _ ContactnumTextBox.Text = "" Or _ DayTextBox.Text = "" Or _ StatusTextBox.Text = "" Then Dim y As Integer y = BindingNavigatorPositionItem.Text HomeToolStripMenuItem.Enabled = False

248

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
MsgBox("Nulls are not allowed, Line " & y, MsgBoxStyle.Critical)

ElseIf IsNumeric(StarthourTextBox.Text) = False Or _ IsNumeric(StartminsTextBox.Text) = False Or _ IsNumeric(StophourTextBox.Text) = False Or _ IsNumeric(StopminTextBox.Text) = False Then Dim y As Integer y = BindingNavigatorPositionItem.Text MsgBox("Enter only numeric type on start and stop time,Line " & y, MsgBoxStyle.Critical) Else Me.Validate() Me.Room1BindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.DenisDataSet) Room1DataGridView.Refresh() HomeToolStripMenuItem.Enabled = True End If BindingNavigatorMoveNextItem.PerformClick() Next End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'DenisDataSet.Room1' table. You can move, or remove it, as needed. Me.Room1TableAdapter.Fill(Me.DenisDataSet.Room1) LogoutToolStripMenuItem.Visible = False Room1BindingNavigator.Visible = False Room2.Show() Room3.Show() Room2.Hide()

249

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Room3.Hide() serialPort.Close() End Sub Private Sub HomeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HomeToolStripMenuItem.Click Me.Hide() Homeform.Show() serialPort.Close() End Sub Private Sub Room2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room2ToolStripMenuItem.Click Me.Hide() Room2.Show() End Sub Private Sub Room3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room3ToolStripMenuItem.Click Me.Hide() Room3.Show() End Sub Private Sub DayToolStripTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DayToolStripTextBox.TextChanged Try Me.Room1TableAdapter.FillBy3(Me.DenisDataSet.Room1, DayToolStripTextBox.Text) Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try End Sub

250

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Private Sub ProfessorToolStripTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProfessorToolStripTextBox.TextChanged Try Me.Room1TableAdapter.FillBy1(Me.DenisDataSet.Room1, ProfessorToolStripTextBox.Text) Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try End Sub Private Sub SubjectToolStripTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Try Me.Room1TableAdapter.FillBy4(Me.DenisDataSet.Room1, SubjectToolStripTextBox.Text) Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try End Sub Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click Me.Hide() Help.Show() End Sub Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click If ProfessorTextBox.Text = "" Then BindingNavigatorDeleteItem.Enabled = False End If End Sub

251

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Private Sub LoginToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginToolStripMenuItem.Click Admin.Show() End Sub Private Sub LogoutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogoutToolStripMenuItem.Click Admin.Dispose() ' Admin.GroupBox4.Visible = False ' Admin.GroupBox2.Visible = True LogoutToolStripMenuItem.Visible = False Room2.LogoutToolStripMenuItem.Visible = False Room3.LogoutToolStripMenuItem.Visible = False LoginToolStripMenuItem.Visible = True Room2.LoginToolStripMenuItem.Visible = True Room3.LoginToolStripMenuItem.Visible = True Admin.txtresult.Text = "" Room1BindingNavigator.Visible = False Room2.Room2BindingNavigator.Visible = False Room3.Room3BindingNavigator.Visible = False End Sub Private Sub AboutsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutsToolStripMenuItem.Click Me.Hide() Abouts.Show() End Sub Private Sub TimeinsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeinsToolStripMenuItem.Click Me.Hide() Form1.Show()

252

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End Sub Private Sub SubjectToolStripTextBox_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubjectToolStripTextBox.TextChanged Try Me.Room1TableAdapter.FillBy4(Me.DenisDataSet.Room1, SubjectToolStripTextBox.Text) Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try End Sub Private Sub Room1DataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Room1DataGridView.CellContentClick End Sub Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click End Sub Private Sub AdminToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AdminToolStripMenuItem.Click If serialPort.IsOpen Then Try With serialPort . .ReceivedBytesThreshold = 24 .WriteBufferSize = 1024 .ReadBufferSize = 512 .ReadTimeout = 500 .Handshake = IO.Ports.Handshake.None End With serialPort.Open()

253

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Catch ex As Exception MsgBox(ex.ToString) End Try End If

Admin Code
Imports System Imports System.ComponentModel Imports System.Threading Imports System.Windows.Forms Public Class Admin Dim sendData(24) As Byte Dim replData(48) As Byte Dim serialData As String Dim CKS As Integer Dim rxDisplay As String Dim resultReply As String Dim whatProcess As String Public WithEvents serialPort As New IO.Ports.SerialPort Delegate Sub SetTextCallBack1(ByVal [rxDisplay] As String) Delegate Sub SetTextCallBack2(ByVal [setResultDisplay] As String) Private Sub Admin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load txtresult.Text = "0" serialPort.Open() 'SET-UP COMPORT If serialPort.IsOpen Then Try serialPort.Close() With serialPort .PortName = "COM4" 'PLACE THE COMPORT HERE

254

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
.BaudRate = 115200 since we use 115200 .Parity = IO.Ports.Parity.None .DataBits = 8 .StopBits = IO.Ports.StopBits.One .ReceivedBytesThreshold = 24 .WriteBufferSize = 1024 .ReadBufferSize = 512 ' .ReadTimeout = 500 .Handshake = IO.Ports.Handshake.None End With serialPort.Open() Catch ex As Exception MsgBox(ex.ToString) End Try End If 'TODO: This line of code loads data into the 'Admintab.admintable' table. You can move, or remove it, as needed. Me.AdmintableTableAdapter1.Fill(Me.Admintab.admintable) 'TODO: This line of code loads data into the 'AdminDS.admintable' table. You can move, or remove it, as needed. Me.AdmintableTableAdapter.Fill(Me.AdminDS.admintable) End Sub Private Sub FillByToolStripButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'NORMAL BAUDRATE IS 9600 but

End Sub Private Sub AdmintableBindingNavigatorSaveItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.Validate() Me.AdmintableBindingSource1.EndEdit() Me.TableAdapterManager1.UpdateAll(Me.Admintab)

255

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End Sub Private Sub FillBy1ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub AdminToolStripTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BindingNavigatorAddNewItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.AdmintableBindingSource1.AddNew() End Sub Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.AdmintableBindingSource1.RemoveCurrent() End Sub Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.AdmintableBindingSource1.MoveNext() End Sub Private Sub BindingNavigatorMoveLastItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.AdmintableBindingSource1.MoveLast() End Sub Private Sub BindingNavigatorMovePreviousItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.AdmintableBindingSource1.MovePrevious() End Sub Private Sub BindingNavigatorMoveFirstItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

256

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Me.AdmintableBindingSource1.MoveFirst() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Choice.TextBox4.Text = "True" And Homeform.StatusTextBox.Text = "Unoccupied" Then Homeform.StatusTextBox.Text = "Occupied" Homeform.Validate() Homeform.Room1BindingSource.EndEdit() Homeform.TableAdapterManager.UpdateAll(Homeform.DenisDataSet) Me.Dispose() Choice.Dispose() ElseIf Choice.TextBox4.Text = "True" And Homeform.StatusTextBox.Text = "Occupied" Then Homeform.StatusTextBox.Text = "Unoccupied" Homeform.Validate() Homeform.Room1BindingSource.EndEdit() Homeform.TableAdapterManager.UpdateAll(Homeform.DenisDataSet) Me.Dispose() Choice.Dispose() ElseIf Choice.TextBox2.Text = "True" And Homeform.Status1TextBox.Text = "Unoccupied" Then Homeform.Status1TextBox.Text = "Occupied" Homeform.Validate() Homeform.Room2BindingSource.EndEdit() Homeform.TableAdapterManager2.UpdateAll(Homeform.DenisDataSet2) Me.Dispose() Choice.Dispose() ElseIf Choice.TextBox2.Text = "True" And Homeform.Status1TextBox.Text = "Occupied" Then

257

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Homeform.Status1TextBox.Text = "Unoccupied" Homeform.Validate() Homeform.Room2BindingSource.EndEdit() Homeform.TableAdapterManager2.UpdateAll(Homeform.DenisDataSet2) Me.Dispose() Choice.Dispose() ElseIf Choice.TextBox3.Text = "True" And Homeform.Status2TextBox.Text = "Unoccupied" Then Homeform.Status2TextBox.Text = "Occupied" Homeform.Validate() Homeform.Room3BindingSource.EndEdit() Homeform.TableAdapterManager3.UpdateAll(Homeform.DenisDataSet3) Me.Dispose() Choice.Dispose() ElseIf Choice.TextBox3.Text = "True" And Homeform.Status2TextBox.Text = "Occupied" Then Homeform.Status2TextBox.Text = "Unoccupied" Homeform.Validate() Homeform.Room3BindingSource.EndEdit() Homeform.TableAdapterManager3.UpdateAll(Homeform.DenisDataSet3) Me.Dispose() Choice.Dispose() End If End Sub Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click If serialPort.IsOpen Then

258

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

'this for loop will clear byte array sendDAta wala lang to pang linis lang For i As Integer = 0 To 23 sendData(i) = 0 Next 'if you going to read fPM you can see that 0xAA55 is code fore comand wich will be send to fps 'and x0102 is command for Identify mode or scan mode ' ask fps manual about this sendData(0) = &H55 sendData(1) = &HAA sendData(2) = &H2 sendData(3) = &H1 checkSum() ' I Call CheckSum just check this out 'now we will send it on the serial we through 24 bytes on serial prot whatProcess = "READ" serialPort.Write(sendData, 0, 24) End If End Sub Private Sub checkSum() 'check sum compute here CKS = 0 'in check sum it is needed to get the summation of all data' in the case of fps only first 20 byte is needed to add For i As Integer = 0 To 21 CKS += sendData(i) Next ' We will now append cpk to the last 2 bytes of our data since the cks is more than 256 we need to bytes ' to contain them we need to devide dem in to higher byte and lower byte 'first, lower byte of the cpk it something like getting the mod of 255(hFF) here or just get the remainder sendData(22) = CKS And &HFF 'second, higher byte of the cpk in this part you just 'count how many byte are there in cks (devide it by 256 then you can get it) sendData(23) = (CKS - (CKS And &HFF)) / 256 'nothing do here End Sub just return

259

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Public Sub DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles serialPort.DataReceived Dim returnValue As Integer ' Dim serialData As String Dim buffer As Byte() resultReply = "" 'serialData = serialPort.ReadExisting() Dim n As Integer = serialPort.BytesToRead buffer = New Byte(n - 1) {} returnValue = serialPort.Read(buffer, 0, n) If returnValue > 0 Then rxDisplay = "" End If 'here Ill display the result If replData(6) = 0 Then '7 byte's value is 0 means there is no error 'THIS WILL ENTER THE ENROLLMENT POSSIBLE OUTPUT If whatProcess = "ENROLL" Then ' possible na ang mareceive ko dito ay para sa enroll response perO may mas madaling paraan tingan nyo nalng sa pfs ito way ko eh mabilisan ba. If replData(8) = Int(&HF1) And replData(9) = Int(&HFF) Then resultReply = "Press a finger to register first time." End If If replData(8) = Int(&HF2) And replData(9) = Int(&HFF) Then resultReply = "Press the same finger the second time..." End If If replData(8) = Int(&HF3) And replData(9) = Int(&HFF) Then resultReply = "Press the same finger the last time..." End If

260

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
If replData(8) = Int(&HF4) And replData(9) = Int(&HFF) Then resultReply = "Lift finger..." End If If replData(4) = Int(&H6) Then resultReply = "Ok" End If '-------------------------------------------------'THIS IF FOR DELETE INDIVIDUAL ElseIf whatProcess = "DELETE" Then resultReply = "User Deleted" 'THIS IS FOR DELETE ALL USER ElseIf whatProcess = "DELETEALL" Then resultReply = "All Users Deleted" 'THIS IS FOR CANCEL ALL USER ElseIf whatProcess = "CANCEL" Then resultReply = "Cancelled" 'THIS IS FOR READ ElseIf replData(8) = Int(&HF4) And replData(9) = Int(&HFF) And whatProcess = "READ" Then 'JUST GO BACK TO THE THREAD Else resultReply = +Str(replData(9) * 256 + replData(8)) End If Else error code '7 byte's value is 1 or greater, means it is error go to or pfs check that for your self If replData(8) = Int(&H12) Then resultReply = "Di kita kilala! Tsupi!" ElseIf replData(8) = Int(&H14) Then resultReply = "Location not empty!" ElseIf replData(8) = Int(&H15) Then resultReply = "No enrolled user!" ElseIf replData(8) = Int(&H21) Then resultReply = "Bad quality fingerprint image!" ElseIf replData(8) = Int(&H60) Then resultReply = "Location No. not valid!"

261

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
End If End If setResultDisplay(resultReply) End Sub 'here ill display bytes ' InvokeRequired required compares the thread ID of the ' calling thread to the thread ID of the creating thread. ' If these threads are different, it returns true. Private Sub setRXDisplay(ByVal rxDisplay As String) If Me.txtresult.InvokeRequired Then Dim d As New SetTextCallBack1(AddressOf setRXDisplay) Me.Invoke(d, New Object() {[rxDisplay]}) Else Me.txtwindow.Text = rxDisplay '[Text] End If End Sub 'here ill display bytes ' InvokeRequired required compares the thread ID of the ' calling thread to the thread ID of the creating thread. ' If these threads are different, it returns true. Private Sub setResultDisplay(ByVal resultDisplay As String) If Me.txtresult.InvokeRequired Then Dim d As New SetTextCallBack2(AddressOf setResultDisplay) Me.Invoke(d, New Object() {[resultDisplay]}) Else 'Me.txtResult.Text = "Hello No. " + Str(Int(Asc(Mid$(Right$(Rx, 24), 10, 1)) * 256 + Asc(Mid$(Right$(Rx, 24), 9, 1)))) + " Welcome!" Me.txtresult.Text = resultReply End If End Sub Private Sub txtresult_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtresult.TextChanged If txtresult.Text = "6" Then txtresult.Text = "0" Room2.LoginToolStripMenuItem.Visible = False Room2.LogoutToolStripMenuItem.Visible = True Room2.Room2DataGridView.ReadOnly = False

262

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Room2.Room2BindingNavigator.Visible = True Room2.GroupBox2.Enabled = True Room3.LoginToolStripMenuItem.Visible = False Room3.LogoutToolStripMenuItem.Visible = True Room3.Room3DataGridView.ReadOnly = False Room3.Room3BindingNavigator.Visible = True Room3.GroupBox2.Enabled = True Else Dim SAPI SAPI = CreateObject("SAPI.spvoice") SAPI.Speak("Identification Did not match.") End If End Sub Private Sub txtwindow_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtwindow.TextChanged End Sub End Class

Help form Code


Private Sub Room1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room1ToolStripMenuItem.Click Me.Dispose() Room1.Show() End Sub Private Sub Room2ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room2ToolStripMenuItem.Click Me.Dispose() Room2.Show() End Sub Private Sub Room3ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Room3ToolStripMenuItem.Click

263

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Me.Dispose() Room3.Show() End Sub Private Sub AboutsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutsToolStripMenuItem.Click Me.Dispose() Abouts.Show() End Sub Private Sub TimeinToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeinToolStripMenuItem.Click Me.Dispose() Form1.Show()

MCU Program Code: //declaration char buffer[10]; void setup(){ } void loop(){ if(Serial.available()>0){ len = Serial.available();

264

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

for(int index=0;index<len;index++){ buffer[index] = Serial.read(); } if(buffer[0] == 'A'){ digitalWrite(13,HIGH); // for(lit=0;lit<5;lit++){ digitalWrite(7,HIGH); delay(100); digitalWrite(7,LOW); delay(1000); } } else if (buffer[0] == 'a'){ digitalWrite(13,LOW); } else if (buffer[0] == 'B'){ digitalWrite(12,HIGH); } else if (buffer[0] == 'b'){ digitalWrite(12,LOW); } } }

265

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Appendix C
(Sample Questionnaires)

AMA COMPUTER COLLEGE CALAMBA CAMPUS CALAMBA, LAGUNA

266

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING TOUCH SCREEN ROOM UTILIZATION SYSTEM WITH FINGER PRINT AUTHENTICATION
Name: ______________________________ Status: ______ Position: _______________________________ Educational Attainment: _______ Direction: Check the number that correspondents to your answer: 5- Strongly Agree 4- Agree 3- Undecided 2- Disagree 1- Strongly Disagree

Overall System Performance Accuracy

The system has able to show the right schedule and right room for the professor. Speed 5 4 3 2 The system is friendly user. Security

The system is not easily to access by unauthorized user. Comments/Suggestions: _________________________________________________________ THANK YOU! MAGARARU, Jonel Mark P. PRADO, Ann Bernadeth E. YUKOT, Dennis B.

267

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Appendix D
(Users Manual)

268

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Users Manual of Touch Screen Room Utilization System with Fingerprint Authentication How to set up the System 1. Plug the main power of the computer system.

2. Insert in the USB port the USB cord of fingerprint scanner, MCU, touch screen panel and also the speaker.

269

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

3. Switch on the computer.

4. Run the set up for the application. 5. Run the system application in exe file by double tapping the file. And wait until it open.

How to Use the System 1. To use the system, make sure that you are a member of a faculty. Look for your name in any of professors textbox.

270

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
2. If you see your name, it means it is your time to teach. Tap the button on that room, and then put your finger on the scanner. Wait for the system recognizes your fingerprint.

What if I would like to dismiss the class early? 1. Tap the button of the room you used. 2. Scan your fingerprint by putting your finger print on the scanner. 3. Wait until the system recognizes you, and says goodbye.

What if I would like to use the vacant room for special classes or class meeting? 1. Look for a vacant room, and talk to the member of the administrator or dean that you want to use the vacant room for special class for class meeting. 2. The member of the administrator will tap the room for you and scan his/ her fingerprint by putting the fingerprint on the scanner. 3. If you are going to dismiss the class early, ask again either one of the member of the administrator or dean to close the room.

1. 2. 3. 4. 5.

How to edit classroom schedules for the next semester? Only the member of the administrator or the dean can change or edit schedule of the room. Log-in first to the admin account by tapping the admin menu and tap login. Scan the finger by putting your fingerprint on the scanner. If the system recognizes you, tap the room that you want the change the schedule on the Rooms menu. You can now change the schedule, the time, professor, and subject.

271

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
6. If you are finished editing. Tap the save tools to save the entire schedule for that room.

272

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Appendix E
(Curriculum Vitae)

273

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

JONEL MARK PASTRO MAGARARU


293 St. Michael Subdivision Mayapa Calamba City Laguna Tel. no.: 834-6652 Mobile no.: 09214058878 E-mail address: jonelmarkmagararu@ymail.com OBJECTIVE:

To apply my profession and acquire relevant experiences.


EDUCATIONAL ATTAINMENT:

2008-Present

2005-2008

Bachelor of Science in Electronics and Communication Engineering AMA Computer College, Calamba City, Laguna Secondary Education

274

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Occidental Mindoro State College 2000-2005 Elementary Education San Jose Pilot Elementary School Occidental Mindoro

SEMINARS AND WORKSHOP ATTENDED: Institute of Electronics Engineers of the Philippines De La Salle University-Dasmarias (August 28, 2011) Institute of Computer Engineers of the Philippines (Cisco Certification Awareness) Adamson University-Ermita Manila (March 5, 2011)

PERSONAL DATA: Birth date: Birthplace: Age: Height: Weight: Civil Status: Nationality: Religion: Fathers name: Mothers name: December 7, 1991 San Jose Occidental Mindoro 20 yrs old 59 140lbs Single Filipino Born Again Christian Adlin Magararu Rosalinda Magararu

CHARACTER REFERENCES: Rev. Ptr. Gabriel V. Cubio

275

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Head Pastor of Jesus Christ the Lifegiver Ministries Mayapa Calamba City Mobile no.: 09187283420 Insp. Needheart C. Perino Police Officer Mayapa, Calamba City Mobile no.: 09185060726

I hereby certify that the above information is true and correct to the best of my knowledge.

MAGARARU, JONEL MARK P. Applicant

DENNIS YUKOT B.
Blk 11 Lot 20 Phasa 3 Calamba City Laguna Mobile no.: 09184113119 E-mail address: dyukot@yahoo.com OBJECTIVE: To enhance my knowledge and skills regarding my course.

EDUCATIONAL ATTAINMENT:

276

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

2008-Present

Bachelor of Science in Electronics and Communication Engineering AMA Computer College, Calamba City, Laguna Secondary Education Rizal College of Laguna Elementary Education Paciano Rizal

2005-2008

2000-2005

SEMINARS AND WORKSHOP ATTENDED:

Institute of Electronics Engineers of the Philippines De La Salle University-Dasmarias (August 28, 2011)

PERSONAL DATA: Birth date: Birthplace: Age: Height: Weight: Civil Status: Nationality: Religion: Fathers name: Mothers name: May 24, 1991 Manila 21 yrs old 55 140lbs Single Filipino Born Again Christian Daniel Yukot Emma Yukot

CHARACTER REFERENCES:

277

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
Engr. Joanna Marie Baroro AMACC Instructor 6 Mayapa Calamba Laguna

I hereby certify that the above information is true and correct to the best of my knowledge.

YUKOT, DENNIS B. Applicant

PRADO, ANN BERNADETH EVANGELISTA


#86 Brgy. Laurel, Tanauan City, Batangas Mobile no.: 09127800689 E-mail address: annbernadeth.prado@yahoo.com

278

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
OBJECTIVE: To secure a cooperative education in the field of Electronics and Communications Engineering that will challenge and strengthen my education and professional skills. EDUCATIONAL BACKGROUND:

2008-Present

Bachelor of Science in Electronics and Communication Engineering AMA Computer College, Calamba City, Laguna

SEMINARS AND WORKSHOP ATTENDED:

Institute of Electronics Engineers of the Philippines De La Salle University-Dasmarias (August 28, 2011)

PERSONAL DATA: Birth date: Birthplace: Age: Height: Civil Status: Nationality: March 21, 1992 Sto.Thomas 21 yrs old 50 Single Filipino

CHARACTER REFERENCES: Engr. Joanna Marie Baroro

279

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING
AMACC Instructor 6 Mayapa Calamba Laguna

I hereby certify that the above information is true and correct to the best of my knowledge.

ANN BERNADETH E. PRADO Applicant

280

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

281

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

Appendix F
(Copy of COR, Permit, and etc.)

282

AMA COMPUTER COLLEGE


Calamba Campus

COLLEGE OF ENGINEERING

283

You might also like