PocketPC Application - CapeCoder

Download Report

Transcript PocketPC Application - CapeCoder

PocketPC Application
Design
Cape Cod Community College
April 5, 2007
Objectives


Overview of barcode/mobile applications
Discussion of one such application



Requirements
What would you do?
Our solution
Barcode



A machine-readable representation of
information in a visual format on a surface.
Store data in the width and spacing of parallel
lines; patterns of dots; concentric circles; and
hidden within images.
Improve speed and accuracy of data entry
From Wikipedia
Types of Barcodes

1-D

2-D

RFID Radio-frequency
identification (RFID) is an
automatic identification
method, relying on storing
and remotely retrieving data
using devices called RFID
tags or transponders.
Types of Barcode Scanners

USB/Keyboard Wedge
(Non-batch)



Directly connected to a PC
with an interface cable,
transmits the decoded scan
data, one scan at a time,
directly into the keyboard
buffer or USB port.
Some USB or Keyboard
Wedge scanners have
proprietary programming
languages.
Examples: Symbol LS4208
or Symbol P304IMG Imager
Types of Barcode Scanners

Portable Memory Data
Terminal (Batch)

The operator carries the
scanner with them, but
unlike other scanners,
data can be batch
uploaded. These devices
vary greatly in price,
memory capacity and
optional features.

Examples: Symbol MC
series, PPT 8800;
Metrologic SP5500
Optimus S
Types of Barcode Scanners

Wireless, Cordless
and Bluetooth


The operator carries the
scanner with them and
transmits the data
wirelessly, one scan at a
time. These scanners
communicate with their
own base station or with
other Bluetooth-equipped
devices.
Examples: Metrologic
MS9535 Voyager, Symbol
LS3478
Data Transfer and Storage





Serial inputs from COM/TCP ports (wedge)
Wireless
ActiveSync: Windows application using TCP
ports for data transfer
XML
Database
Customer overview


The customer is a leading adult stem cell
therapeutic company.
They develop and market products to treat
medical conditions in the inflammatory,
orthopedic, and cardiovascular areas.
Project overview



The customer wanted a Chain of Custody
application to keep track of product units from
manufacturing release through shipping.
The customer purchased a Laboratory
Information Management System (LIMS) to do
the recordkeeping.
The customer wanted to automate data input to
the LIMS as an alternative to using lab
notebooks and manual data entry.
Functional requirements







Through LIMS, register product and assign
customer code
Print and attach barcode labels to units and
locations
User and reviewers scan their Id’s
Move product from manufacturing to Work in
Progress location, scan unit and location Id’s
Move product through several post-production
phases, scan product label at each location
Update LIMS
Generate packing list in LIMS
Environment Considerations






Customer could not implement wireless
Customer did not want to implement a web service
for data transport
No clean room scans
24x7, no onsite IT support for second and third shifts
Customer wanted a scanner that was double impact
tested and offered persistent storage
Customer required some data validation at time of
scan
Challenges





Minimize need for tech support
No wireless -> wired, batch upload required
LIMS vendor prohibited direct database update
Required some validation of scans (location, number
of scans/record, duplicate scans for one product)
Unit record consisted of multiple scans, but scans
could be in any order, plus associated data
Unit Record

Scanned data






User Id
Unit Id
Location (location) Id (verified against database)
(Optional) comments (“unit moved in error”)
(Optional) verifier Id
Non-scanned data


Date and time of scan
Date and time of verification
Decisions To Be Made




Select mobile device
 Optical Scanner
 Pocket PC
Select development environment for custom application
 Operating System
 Framework
 Language
Select data storage mechanism
 XML and/or database
Select data transport mechanism
 Wireless
 Web service
 Synchronization
Discussion
What decisions would you have made about
 Hardware?
 Data storage?
 Data transfer?
Additional considerations to complete system
design?
We Decided




Pocket PC with its own local database
Scans have unique formats to identify them
Upload via ActiveSync
Use XML as upload format
Project Tasks







Design and print custom barcodes
Develop Pocket PC application to capture user ids,
product unit Id’s and locations through barcode scans
Design local database for Pocket PC
Design XML file for data upload to the desktop via
ActiveSync
Design desktop application to update the LIMS database
via proprietary API’s
Design final post-processing “handshake” between
desktop and Pocket PC
Write documentation
Implementation Details







User scans their ID only once per session
Verifier (optional) also scans their ID only once per session
Scans have unique patterns to differentiate them
Consecutive product id scans are compared; a warning message
is shown if not the same
Last scan “of a type” is accepted
Location scans are verified against a database on the PocketPC
Final check for required scans/unit record
Pocket PC User Interface





Ability to clear unit and
location scans in case of
error
Each unit record is written to
the database on Save, with
current date and time
On Exit, an XML file is
created of all unit records that
have not yet been uploaded
Status bars to display State
and error messages
Display no. of units scanned
Physical Elements of Our
Solution

Barcode printing software


Barcode printer


Examples: BarTender, ID
Automation/Crystal Reports
Example: Zebra
Scanner/data collectors
Software Elements of Our
Solution









Windows Mobile 5.0 Operating System
Microsoft Compact Framework
SQL Mobile database
XML file for unit records
XML configuration files
Error logs
ActiveSync/RAPI
Custom desktop application in C#
Custom Pocket PC applications in C#
Process
•Read user and verifier ids
•Read and process scans
•Write scans to local db
•Create XML scans file
•Dock, upload to PC
•User Login
•ActiveSync Pocket PC
•Update LIMS
•Send confirmation
Pocket PC Application Tasks









Differentiate between different scans (user, verifier,
unit, location)
In-memory storage of User and Verifier Ids
Display error messages
Verify location against local database, reject invalid
entry
Check that data for each scan is complete
Provide dropdown with optional comments
Write unit records to local database
Display number of units scanned
Create XML data transfer file
Elements of the Desktop
Application




Authenticate users through LIMS API
Read data file from Pocket PC via ActiveSync
Update LIMS database through LIMS API
Notify Pocket PC that data has been
uploaded and database has been updated
Pocket PC Application Process
Flow








Open Windows Form
Handle Scan Data
 Determine scan type
 Store Unit data
 Hold UserId and VerifierId in memory
Assign State
Display UI messages
Display error messages
Check final data
Write to local database
Create XML unit records file, close form
Desktop Process Flow





On completion of scans, user docks the PocketPC
and logs in to the main LIMS system for
authorization and authentication
On verification of user id, application checks through
ActiveSync to see if PocketPC is docked
Application uploads XML scans file from PocketPC
Application updates LIMS database
Application calls second executable on PocketPC
which updates local database records and deletes
XML scans file
Files and Documentation





Both the PocketPC and desktop have their
own log files
Both the PocketPC and desktop have their
own XML configuration files
Both the PocketPC and desktop have their
own databases
End user document
System test documents
State Machine
private enum AppState
{
INIT,
SCANUSER,
SCANUNIT,
SCANLOCATION,
SCANVERIFIER,
READYTOSAVE,
CLEAR,
ERROR,
SAVINGDATA,
SAVED,
NOTSAVED,
NOSTATE
}
private void AppState_Set(AppState appState)
{
//Set the private global variable to the passed in value
this._currentAppState = appState;
//Execute the state machine
AppState_Set();
}
State Machine (cont’d)
private void AppState_Set()
{
switch (_currentAppState)
{
case AppState.INIT:
statusBar1.Text = "Scan your user id";
lblVersion.Text = Utilities.GetVersionInformation();
break;
case AppState.SCANUNIT:
lblUserId.Text = "User Id: " + userId;
statusBar1.Text = "Scan unit";
break;
case AppState.SCANLOCATION:
lblUnit.Text = "Unit: "+sampleCode;
statusBar1.Text = "Scan freezer/shelf";
break;
…..
}
RefreshLabels();
}
AppState_Set(AppState.SCANLOCATION);
File Transfer via RAPI



















public DataSet GetDataSetFromHandheld()
{
DataSet ds = new DataSet();
RAPI myrapi = new RAPI();
if (myrapi.DevicePresent)
{
while (!myrapi.Connected)
myrapi.Connect(true, 3);
}
if(myrapi.DeviceFileExists(ConfigurationManager.AppSettings.Get("RemoteSamplesXMLFile")))
//(@"\Application\ScannedSamples.xml"))
{
string localXMLFile=ConfigurationManager.AppSettings.Get("LocalSamplesXMLFile");
if(System.IO.File.Exists(localXMLFile))
System.IO.File.Delete(localXMLFile);
myrapi.CopyFileFromDevice(localXMLFile,
ConfigurationManager.AppSettings.Get("RemoteSamplesXMLFile"));//@"C:\Testing\Scan_Unit_Date.txt",
@"\Application\ScannedSamples.xml");
ds.ReadXml(ConfigurationManager.AppSettings.Get("LocalSamplesXMLFile"));
}
return ds;
}














using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Xml;
namespace PostProcessing
{
public class ReadXML
{
public bool UpdateRecordsInXMLFile()
{
string samplecode = "";
string sampledate = "";
string sampletime = "";
string localXMLFile = Utilities.GetAppSetting("filePath");
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Auto;
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;





XmlReader reader = XmlReader.Create(localXMLFile,settings);
try
{
string readerName = "";
while (reader.Read())
{
if (reader.Name != "")
readerName = reader.Name;
if (reader.NodeType == XmlNodeType.Text && readerName == "samplecode")
samplecode = reader.Value;
else if (reader.NodeType == XmlNodeType.Text && readerName == "sampledate")
sampledate = reader.Value;
else if (reader.NodeType == XmlNodeType.Text && readerName == "sampletime")
{
sampletime = reader.Value;
Utilities.SetUploadedToTrue(samplecode, sampledate, sampletime);
Utilities.LogError("Successful update: " + samplecode + " " + sampledate + " " + sampletime);
}
}
reader.Close();
return true;
}
catch(Exception exc)
{
reader.Close();
Utilities.LogError("ScanCleanup failed: " + exc.Message);
throw new SystemException("ScanCleanup failed");
}






























}
XML Configuration File










<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="filePath" value="/Application/ScannedUnits.xml" />
<add key=“locationsfilePath" value="/Application/Locations.xml" />
<add key="dbPath" value="/Application/Program Files/SQL Mobile/EN/" />
<add key="localDB" value=“mydb.sdf" />
<add key="localPWD" value=“password" />
</appSettings>
</configuration>
Excerpt from the User Doc
















Using the Handheld
The handheld is turned on by holding down the power button on the upper right corner.
Scanning is accomplished by pushing one of the three yellow buttons on the front and side of the handheld.
The stylus may be used to tap or select objects on the screen.
Before uploading the scans, the user must ensure that the handheld is firmly docked. The middle top orange light will be on
when the unit is properly docked.
A Microsoft program called ActiveSync manages the connection between the PC and the handheld. If ActiveSync is working
correctly, there will be a bright green icon in the PC’s taskbar (lower right corner of the monitor display).
It may take several seconds after docking for the PC and the handheld to “synch up”. This is normal.
The handheld has persistent storage of data; as long as the user has properly saved and exited from the program, their data
will be saved. So, if the handheld loses power, saved data is protected.
The handheld should be docked when it is not in use.
Troubleshooting the Handheld
If necessary, the handheld can be warm booted by holding down the power button in the upper right hand corner until the
warm boot screen is displayed. The handheld can be cold booted by simultaneously holding down the 1 and 9 keys and the
power button.
If necessary, the application can be closed by clicking on the “x” in the upper right hand corner. In that case, any scans that
have not been saved will be lost.
The application keeps an error log in File Explorer->Application/ErrorLog In the event assistance is needed with the
application, Tech Support may ask for a copy of this error log file.
The application includes a SQL Server Mobile database, also located in FileExplorer->Application. Only IT personnel are
permitted to view or change this database, and only at the direction of the vendor.
The application uses a file called Configuration.xml. This file must not be changed unless directed by the vendor.
Please refer to the manufacturer’s documentation for information on maintenance and handling of the Pocket PC.
Excerpt from the Testing Docs














Test Identification
Title
:
Accurately decode scanned data
Test Reference No.
:
PR001/001
Objective of Test
This test will ensure that data is decoded accurately
Description of Sub Tests
The following sub tests will be performed.
Normal startup
Correctly decode unit id scan
Flag dissimilar consecutive unit id scans
Correctly decode verifier id scan
Correctly decode location id scan
Correctly decode performer id scan
Clear scans


Preparation for test
Start the application from the drop down link on the handheld.
Development Setup









VS 2005
Windows Mobile 5.0 Operating System
.NET Compact Framework 2.0
SQL Server 2005 Mobile Edition
ActiveSync 4.2 (deprecated by VISTA)
Windows Mobile 5.0 SDK for PocketPC (6.0 March 2007)
Windows Mobile 5.0 Developer Resource Kit
http://www.microsoft.com/downloads/details.aspx?FamilyID=3ba
a5b7d-04c1-4ec2-83dc-61b21ec5fe57&DisplayLang=en
Windows Mobile 6.0 SDK:
http://www.microsoft.com/downloads/details.aspx?FamilyID=061
11a3a-a651-4745-88ef-3d48091a390b&DisplayLang=en
System Requirements

Supported Operating Systems: Windows Mobile 2002 software
for Pocket PCs; Windows Mobile 2003 software for Pocket PCs;
Windows XP

1.5 GHz computer with 512 MB of RAM, supporting at least 1024
x 768 resolution and 32-bit color

Microsoft Windows 2000 Service Pack or later, or Microsoft
Windows XP Service Pack 2 or later

Microsoft Internet Explorer version 5.0 or later

Visual Studio 2005 Standard Edition or higher
Deployment/Installation


VS2005
You may need to specify additional
component libraries