Documentation Tips Problem Statement (restate the assignment in your own words) Write a program in eMbedded Visual Basic (eVB) to utilize the Software Development Kit (SDK) from Biocentric Solutions Inc. (BSI) to acquire a fingerprint image from their product BioSentry, and extract the minutiae from this fingerprint. (Background information) This project is just one small part of a larger project called Fingerprinting Sobriety Tester, or FiST. (explanation intention/application of FiST) The application shown in Figure 1 is actually just a learning project I created call BSIlearn, to help me learn and understand how to incorporate BSI’s hardware and functionality into my own applications. Fig. 1 Fingerprint test application (Further explanation of given assignment, including given information, limitations, completion criteria, etc) Implementation (description of Architecture) Biocentric Solutions provides a hardware product called BioSentry to add fingerprinting capabilities to the Compaq iPAQ sleeve. BSI also provides its own integrated software solution to provide biometric data security. As most software products, this functionality is provided through the use of a Dynamic Link Library (DLL). DLLs are collections of functions that provide functionality to an application. In this case, BSI’s DLL performs the actual hardware interface to control the sensor, acquire an image, and perform routine software tests such as minutiae extraction. For an additional fee, BSI will sell the SDK to allow software developers such as myself to integrate BSI technology into their own application. In many cases, this SDK is nothing more than documentation, as the functionality necessary to develop applications already exist within the DLLs BSI’s own software is using. One limitation of Visual Basic is that it cannot develop standard compiled DLLs that can be utilized by all other development environments. Therefore, all DLLs are created using C or C++. In the eMbedded development environment for PocketPC, all DLLs must be created in eMbedded Visual C++, as where BSI’s DLLs. A common practice for software engineers is to pass information between applications and functions within DLLs is to use pointers and pass a collection of information via structures. This causes a
big problem for VB developers because VB attempts to isolate the programmer from direct memory access such as pointers, and does not support custom data types such as structures. Therefore, it was necessary to write my own interface DLL, FiST.dll, to act as glue code between the two development environments. (Architecture Diagram) Application “BSIlearn.vb” Interface DLL “FiST.dll” BSI DLL “BioFamily.dll” BSI hardware “BioSentry” Fig. 2 Fingerprinting layer architecture (other possible ways to pictorially represent)
My application - BSIlearn.vb FiST.dll BioFamily.dll BioSentry hardware
Fig. 2b Accessing fingerprinting sensor (direct source code (BSIlearn.vb only, not including FiST.dll source), NOT want you want to do unless requested) all code should be self documenting Option Explicit Declare Function FPtoBMP Lib "FiST.dll" (ByVal fileName As String, ByVal lpImage As Long, ByVal Rows As Integer, ByVal Cols As Integer) As Integer Declare Function CharAt Lib "FiST.dll" (ByVal pUnpackedMinutiae As Long, ByVal Offset As Long) As Integer Declare Function FPtoMinutiae Lib "FiST.dll" (ByVal lpImage As Long, ByVal Rows As Integer, ByVal Cols As Integer, ByVal pMinutiae As Long, ByRef MinutiaeCount As Integer, ByRef UnpackedMinutiaeLength As Integer) As Integer 'Declare Function CreateString Lib "VBPointers" Alias "VB_CreateString" (ByVal Src As Long, ByVal nSrcSizeInBytes As Long, StrResult As String) As Long Declare Function FreeMemory Lib "FiST.dll" (ByVal pointer As Long) As Integer
Declare Function AllocateMemory Lib "FiST.dll" (ByVal size As Long) As Long Declare Function test Lib "FiST.dll" (ByVal size As Long) As Integer Private Sub cmdCalibrate_Click() MsgStatus.Text = "Calibrating..." ' Calibrate Sensor BSIResult = FIM_Calibrate If BSIResult <> FIM_NO_ERROR Then MsgStatus.Text "Unable to calibrate:: " + ErrorToMsg(BSIResult), vbExclamation, "BioSentry Error" MsgStatus.Text = MsgStatus.Text & "Done" End Sub Private Sub Form_Load() If FIM_Init <> FIM_NO_ERROR Then MsgBox "Error in Init, cannot continue", vbCritical, "BioSentry Error" Form_OKClick End If BSIResult = BSI_GetMatchSecurityLevel(MIN_MATCH_SECURITY) MsgStatus.Text = "Security returned: " & BSIResult End Sub Private Sub Form_OKClick() If FIM_PowerDown <> FIM_NO_ERROR Then MsgBox "PowerDown returned: " & ErrorToMsg(BSIResult), vbExclamation, "BioSentry Error" If FIM_Shutdown <> FIM_NO_ERROR Then MsgBox "Shutdown returned: " & ErrorToMsg(BSIResult), vbExclamation, "BioSentry Error" App.End End Sub Private Sub cmdCheckSensor_Click() MsgStatus.Text = "Working..." PreviousTick = GetTickCount BSIResult = FIM_PowerUp CurrentTick = GetTickCount AppendMsg "PowerUp took " & (CurrentTick - PreviousTick) & "ms..." If BSIResult <> FIM_NO_ERROR Then AppendMsg "Error in PowerUp: " & ErrorToMsg(BSIResult) PowerDownBSI Exit Sub End If 'Check for fingerprint PreviousTick = GetTickCount
BSIResult = FIM_FingerDetect CurrentTick = GetTickCount AppendMsg "Finger detect took " & (CurrentTick - PreviousTick) & "ms..." If BSIResult <> FIM_FINGER_DETECT Then If BSIResult <> FIM_NO_ERROR Then AppendMsg "Error in FingerDetect: " & ErrorToMsg(BSIResult) AppendMsg "No fingerprint detected" picTest.Picture = "" PowerDownBSI Exit Sub End If 'Get Geometry BSIResult = FIM_Geometry(SensorRows, SensorCols) If BSIResult <> FIM_NO_ERROR Then AppendMsg "Error retrieving geometry: " & ErrorToMsg(BSIResult) PowerDownBSI Exit Sub End If 'Allocate memory Dim imageSize As Integer Dim pFPraw As Long imageSize = SensorRows * SensorCols pFPraw = AllocateMemory(imageSize) If pFPraw = 0 Then AppendMsg "Error allocating image memory" PowerDownBSI Exit Sub End If 'Read fingerprint PreviousTick = GetTickCount BSIResult = FIM_Read(pFPraw, imageSize) CurrentTick = GetTickCount AppendMsg "Image acquire took " & (CurrentTick - PreviousTick) & "ms..." If BSIResult <> FIM_NO_ERROR Then AppendMsg "Error getting image: " & ErrorToMsg(BSIResult) Dim I As Integer I=1 Do While BSIResult <> FIM_NO_ERROR And I < 5 AppendMsg "Retry " & I & ": " BSIResult = FIM_Read(pFPraw, imageSize) MsgStatus.Text = MsgStatus.Text & ErrorToMsg(BSIResult) I=I+1 Loop
If BSIResult <> FIM_NO_ERROR Then AppendMsg "Image acquisition failed" FreeMemory pFPraw PowerDownBSI Exit Sub End If End If PreviousTick = GetTickCount 'Open File Dim FileHandle As Long FileHandle = BSI_OpenFile("\test.raw", FILE_OPEN_WRITE) If FileHandle = 0 Then MsgStatus.Text "Cannot open file" FreeMemory (pFPraw) Exit Sub End If 'Save File BSIResult = BSI_WriteFile(FileHandle, pFPraw, imageSize) If BSIResult <> imageSize Then MsgStatus.Text = "Cannot write file" BSI_CloseFile (FileHandle) FreeMemory (pFPraw) Exit Sub End If BSI_CloseFile (FileHandle) CurrentTick = GetTickCount AppendMsg "Saving raw file took " & (CurrentTick - PreviousTick) & "ms..." PowerDownBSI 'no longer need sensor PreviousTick = GetTickCount BSIResult = FPtoBMP("\test.bmp", pFPraw, SensorRows, SensorCols) CurrentTick = GetTickCount AppendMsg "Saving bitmap took " & (CurrentTick - PreviousTick) & "ms..." If BSIResult <> FIM_NO_ERROR Then AppendMsg "FPtoBMP error: " & BSIResult FreeMemory pFPraw PowerDownBSI Exit Sub End If 'Display image picTest.Picture = "\test.bmp"
'Allocate memory Dim UnpackedMinutiaeLength As Integer Dim MinutiaeCount As Integer Dim pMinutiae As Long pMinutiae = AllocateMemory(MINUTIA_BUFFER_SIZE * UNPACKED_MINUTIAE_MAX_SIZE) If pMinutiae = 0 Then AppendMsg "Error allocating minutiae memory" FreeMemory pFPraw PowerDownBSI Exit Sub End If PreviousTick = GetTickCount BSIResult = FPtoMinutiae(pFPraw, SensorRows, SensorCols, pMinutiae, MinutiaeCount, UnpackedMinutiaeLength) CurrentTick = GetTickCount AppendMsg "Extracting " & MinutiaeCount & " minutiae took " & (CurrentTick PreviousTick) & "ms..." If BSIResult <> FIM_NO_ERROR Then AppendMsg "Minutiae extract failed: " & BSIResult FreeMemory pMinutiae PowerDownBSI Exit Sub End If PreviousTick = GetTickCount Dim strUnpackedMinutiae As String Dim IncomingChar As Integer strUnpackedMinutiae = "(x,y,theta,min_type)" & vbCrLf For I = 0 To UnpackedMinutiaeLength IncomingChar = CharAt(pMinutiae, I) If IncomingChar = 10 Then strUnpackedMinutiae = strUnpackedMinutiae & vbCrLf Else strUnpackedMinutiae = strUnpackedMinutiae & Chr(IncomingChar) End If Next I ' BSIResult = CreateString(pMinutiae, UnpackedMinutiaeLength, strUnpackedMinutiae) CurrentTick = GetTickCount BSI_Deallocate pMinutiae AppendMsg "Unpacking minutiae took " & (CurrentTick - PreviousTick) & "ms:" AppendMsg strUnpackedMinutiae ' If BSIResult = 0 Then ' AppendMsg "Minutiae unpacked failed"
' FreeMemory pMinutiae ' PowerDownBSI ' Exit Sub ' End If PreviousTick = GetTickCount File1.Open "\test.txt", fsModeOutput File1.LinePrint strUnpackedMinutiae File1.Close CurrentTick = GetTickCount MsgStatus.Text = MsgStatus.Text & "Saving minutiae file took " & (CurrentTick PreviousTick) & "ms..." AppendMsg "Done." End Sub (logical description of code implementation via Flow Chart)
FIM_Init no error FIM_Power Up no error FIM_FingerDetect no error FIM_Geometry no error AllocateMemory (FP) no error FIM_Read no error FIM_PowerDown
erro r erro r error or no finger detected erro r
FIM_PowerDown
FIM_Shutdown
erro r no erro r
Failed 5 times?
yes
FreeMemory (FP)
Save File (.raw) no error FPtoBMP no error Display bitmap no error AllocateMemory
(minutiae)
erro r erro r erro r erro r erro r
no error FPtoMinutiae (deallocates
FP memory)
no error 1 2
1
2
Unpack Minutiae
Deallocate Memory
(minutiae)
Save Minutiae
FIM_Shutdown Fig. III.E.ii.2.1 Fingerprint acquisition and minutiae extraction flow chart (logical description of code implementation via Pseudo Code (more English)) Initialize hardware If error then ExitRoutine Power up hardware If error then Exit Routine If not FingerDetected then ExitRoutine GetGeometry of sensor If error then ExitRoutine AllocateMemory If error then ExitRoutine Scan fingerprint 5 times or until good read If no good read, then Free Memory ExitRoutine … ExitRoutine PowerDown Shutdown End App
(logical description of code implementation via Pseudo Code (more C-like)) BSIlearn() { If (HardwareInit() == Error) ExitRoutine() If (PowerUp() == Error) ExitRoutine() If (FingerDetect() == No) ExitRoutine() If(GetGeometry() == Error) ExitRoutine() If(AllocateMemory() == Error) ExitRoutine() int i; While(Read() == Error && I++ < 5) If(I >= 5) ExitRoutine() … } (logical description of code implementation via Pseudo Code (more C-like with nested statements)) BSIlearn() { If (HardwareInit() != Error) If (PowerUp() != Error) If (FingerDetect()) If(GetGeometry() != Error) If(AllocateMemory() != Error) { int i; While(Read() == Error && I++ < 5) If(I < 5) If(ConvertToBmp() != Error) … } … }
(logical description of code implementation via State Diagram (slightly modified from flow chart execution for GUI implementation instead of iterative execution))
S0: Init hardware
No error idle Error or quit clicked Sensor button clicked Wait for Action error PowerUp hardware success No finger detected
error Power Down
Shut down
Check for Finger Finger detected error Get Geometry No error error Allocate Memory No error, procedure done … success Save to Bmp Error < 5 tries No error Error >= 5 tries Read Sensor
Fig. M: BSIlearn State Machine Diagram
Testing and Demonstrating functionality (Describe usage, proof that it works, use embedded graphics to illustrate. Write as if to describe to a dumb user how to use the program, and how they will know it is working properly. Prove it works using sample input values and verify its output values.) The minutiae extraction function is working and can be verified by comparing it to the acquired image…. To test this more thoroughly, I created a small LabVIEW application to display the .raw file on an XY graph and verified many minutiae datapoints. Problems Encountered (discuss problems encountered during development, how you overcame them, and what problems may still linger) The primary problem encountered in the development of this application was dealing with the different datatypes when passing information from eVB to eVC++. Much research and experimentation was necessary to properly handle information without loss of information or memory corruption…. I fear that a memory problem may remain within this application. If the program is run multiple times an observant user will notice strange characters begin to display in the minutiae output. I believe the UnpackMinutiae function is suspect, but due to lack of time and immediate need of this portion of the project, I did not further investigate this problem.
Here we see…
Fig. N Minutiae extraction
Other types of diagrams
Context Diagram Describes how various entities (people, organizations, other systems) interact with a system and other entities. Great for databases and system level design representation.
Agencies/Visitors (Congregations, Organizations, Interested individuals)
Program information
Evaluation form
YARP Calendar
Request form
YARP Calendar ELCA SWT Synod YARPIT 2.0 Evaluation form YARP Profile Archived information YARP Calendar Program Information Resource Inventory Expense Voucher Program Information YARPs
Resource Inventory
Generated Reports
Evaluation form
Reports Expense Voucher Budget
YARP Coordinators Expense Voucher
Process Flow Diagrams (PFD) Shows how individuals access and use data by the processes in place within the system, or the proposed system to be implemented. General rules for PFD: Entities cannot directly communicate without a process. Entities cannot access or store data without a process. Data stores cannot interact with other data stores without a process.
YARP Calendar
YARP Profile
Vendor or Supplier
Service/prod uct rendered
Generate invoice
Invoice Process
Invoice
Process validated invoice
Signed invoice
Sandra
Signed invoice Invoice
Add cover page
Check
Process invalidated invoice
Invoice w/ cover
Physics Instructor
FAMIS
Transaction
Process Transaction
Accounting Assistant
Issue check
TAMU Accounting
Update internal records
Record of transaction
PAM
Data Flow Diagrams (DFD) Show how data interacts with each other in an information system. (Data Modeling, table relationships)
Unsigned invoice Record of transaction
Completed invoice Transactio n
Check order
SoundStage 3NF Data Model
MEMBER ORDERED PRODUCT Primary Key Order-Number [PK1] [FK] Product-Number [PK2] [FK] Non-Key Attributes Quantity-Ordered Quantity-Shipped Quantity-Backordered Purchase-Unit-Price Credits-Earned MEMBER ORDER Primary Key Order-Number [PK1] Non-Key Attributes Order-Creation-Date Order-Fill-Date Shipping-Address-Name Shipping-Street-Address Shipping-City Shipping-State Shipping-Zip Shipping-Instructions Order-Sub-Total Order-Sales-Tax Order-Shipping-Method Order-Shipping-&-Handling-Cost Order-Status Order-Prepaid-Amount Order-Prepayment-Method Promotion-Number [FK] Member-Number [FK] Member-Number-1 . Member-Number [FK] is a
sells
responds to
places
sold as
PRODUCT Primary Key Product-Number [PK1] Non-Key Attributes "Universal-Product-Code (Alternate Key)" Quantity-in-Stock Product-Type Suggested-Retail-Price Default-Unit-Price Current-Special-Unit-Price Current-Month-Units-Sold Current-Year-Units-Sold Total-Lifetime-Units-Sold is a TITLE Primary Key Product-Number [PK1] [FK] Non-Key Attributes Title-of-Work Title-Cover Catalog-Description Copyright-Date Entertainment-Category Credit-Value
MEMBER Primary Key Member-Number [PK1] Non-Key Attributes Member-Name Member-Status Member-Street-Address Member-Post-Office-Box Member-City Member-State Member-Zip-Code Member-Daytime-Phone-Number Member-Date-of-Last-Order Member-Balance-Due Member-Credit-Card-Type Member-Credit-Card-Number Member-Credit-Card-Expire-Date Member-Bonus-Balance-Available Audio-Category-Preference Audio-Media-Preference Date-Enrolled Expiration-Date Game-Category-Preference Game-Media-Preference Number-of-Credits-Earned Video-Category-Preference Video-Media-Preference Agreement-Number [FK] Privacy-Code Email-Address
has conducted
TRANSACTION Primary Key Transaction-Reference-Number [PK1] Non-Key Attributes Transaction-Date Transaction-Type Transaction-Description Transaction-Amount Member-Number [FK] Order-Number [FK]
is a MERCHANDISE Primary Key Product-Number [PK1] [FK] Non-Key Attributes Merchandise-Name Merchandise-Description Merchandise-Type Unit-of-Measure
binds
generates
AGREEMENT Primary Key Agreement-Number [PK1] Non-Key Attributes Agreement-Expire-Date Agreement-Active-Date Fulfillment-Period Required-Number-of-Credits
is featured as
is a AUDIO TITLE Primary Key Product-Number [PK1] [FK] Non-Key Attributes Artist Audio-Category Audio-Sub-Category Number-of-Units-in-Package Audio-Media-Code Content-Advisory-Code
is a VIDEO TITLE Primary Key Product-Number [PK1] [FK] Non-Key Attributes Producer Director Video-Category Video-Sub-Category Closed-Captioned Language Running-Time Video-Media-Type Video-Encoding Screen-Aspect MPA-Rating-Code
is a GAME TITLE Primary Key Product-Number [PK1] [FK] Non-Key Attributes Manufacturer Game-Category Game-Sub-Category Game-Platform Game-Media-Type Number-of-Players Parent-Advisory-Code
TITLE PROMOTION Primary Key Product-Number [PK1] [FK] Promotion-Number [PK2] [FK]
features
PROMOTION Primary Key Promotion-Number [PK1] Non-Key Attributes Promotion-Release-Date Promotion-Status Promotion-Type
3NF Member Services (Entity Relation Subject Area) SA/2001 Tue May 02, 2000 10:41 Comment Sandra Shepherd
Info620 TAMU 2002
Chapter 7.35