DETAILED DESIGN
6.1 XML files
6.1.1 GRAssTrack Mobile
6.1.1.1 Settings.xml
A typical settings file presents the following parameters.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="tagReadEmployeeId" value="true" />
<!-- Id length range: 4 to 255 -->
<add key="employeeIdLength" value="32" />
<add key="tagReadTagId" value="true" />
<!-- Id length range: 4 to 255 -->
<add key="tagIdLength" value="32" />
<add key="tagReadAssetId" value="true" />
<!-- Id length range: 4 to 255 -->
<add key="assetIdLength" value="32" />
<add key="usePositionId" value="true" />
<add key="tagReadPositionId" value="true" />
<!-- Id length range: 4 to 255 -->
<add key="positionIdLength" value="32" />
<!-- Id wait interval range (ms): 1000 to 10000 -->
<add key="idWaitMsInterval" value="6000" />
<!-- Position retrieve interval range (ms): 500 to 5000 -->
<add key="positionRetrieveMsInterval" value="1200" />
<!-- Id length range: 4 to 255 - If interrogator ID is missing application will not start! -->
<add key="interrogatorId"
value="RFIDREADER0000000000000000000001" />
<add key="enableWLanSync" value="true" />
<!-- Sync interval range (minutes): 2 to 120 -->
<add key="syncMinutesInterval" value="2" />
<add key="webServiceURL"
value="http://www.bluesoft.dnsalias.com/GTS/GTS.asmx" />
</appSettings>
</configuration>
6.1.1.2 GTMDataSchema.xsd
GTMData.xml files have the XML Schema detailed below.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:GTM.Data="http://www.bluesoft.dnsalias.com/GRAssTrackMobile Data" targetNamespace="http://www.bluesoft.dnsalias.com/GRAssTrack MobileData" elementFormDefault="qualified" attributeFormDefault=
"unqualified">
<xs:element name="GRAssTrackMobileData">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="operation">
<xs:complexType>
<xs:all>
<xs:element name="employeeID"
type="GTM.Data:identifierType"/>
<xs:element name="interrogatorID"
type="GTM.Data:identifierType"/>
<xs:element name="dateAndTime"
type="xs:dateTime"/>
<xs:element name="action">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="CheckIn"/>
<xs:enumeration value="CheckOut"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="assetID"
type="GTM.Data:identifierType"/>
<xs:element name="tagID"
type="GTM.Data:identifierType"/>
<xs:element name="position"
type="GTM.Data:positionType"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="identifierType">
<xs:restriction base="xs:string">
<xs:pattern value="[0-9A-Z]{32,32}"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="positionType">
<xs:all>
<xs:element name="positionID"
type="GTM.Data:identifierType"/>
<xs:element name="latitude">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-90"/>
<xs:maxInclusive value="90"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="longitude">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-180"/>
<xs:maxInclusive value="180"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="altitude">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-500"/>
<xs:maxInclusive value="9000"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:schema>
FIGURE 6.1 – GTMData XML Schema graphical representation
6.1.2 GRAssTrack Server 6.1.2.1 Web.config
A typical Web Service settings file presents the following parameters.
<?xml version = "1.0" encoding = "utf-8"?>
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<!-- Update period hours range: 1 to 24 -->
<add key="updatePeriodHours" value="24" />
<!-- Purge period days range: 14 to 255 -->
<add key="purgePeriodDays" value="14" />
<add key="adminEmailAddress" value="bluesoftgt@yahoo.it" />
<add key="smtpHost" value="smtp.mail.yahoo.it" />
<!--
<add key="smtpPort" value="25" />
<add key="smtpEnableSsl" value="false" />
-->
<add key="smtpUser" value="bluesoftgt" />
<add key="smtpPassword" value="password" />
</appSettings>
<connectionStrings
configSource="bin\BLUEsoft.Data.AnyDbms.dll.config" />
<system.web>
<!--
Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development.
-->
<compilation debug="false" defaultLanguage="c#" />
<!--
The <authentication> section enables configuration of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
6.1.2.2 BLUEsoft.Data.AnyDbms.dll.config This file contains the database connection strings.
<?xml version = "1.0" encoding = "utf-8"?>
<connectionStrings>
<clear/>
<add name="DB2Conn"
providerName="IBM.Data.DB2"
connectionString="Server=IP_or_Name;Database=GTSDB;
User ID=DB2UserId;Password=DB2Pwd;" />
<add name="OracleTrustedConn"
providerName="System.Data.OracleClient"
connectionString="Data Source=GTSDB;
Integrated Security=Yes;" />
<add name="OracleStandardConn"
providerName="System.Data.OracleClient"
connectionString="Data Source=GTSDB;
User id=OracleUserId;
Password=OraclePwd;" />
<add name = "SqlServerTrustedConn"
providerName="System.Data.SqlClient"
connectionString="Data Source=localhost;
Initial Catalog=GTSDB;
Integrated Security=SSPI;" />
<add name="SqlServerStandardConn"
providerName="System.Data.SqlClient"
connectionString="Data Source=localhost;
Initial Catalog=GTSDB;
User ID=ASPNETUser;
Password=ASPNETPwd;" />
<add name="MySqlConn"
providerName="MySql.Data.MySqlClient"
connectionString="Server=IP_or_Name;Database=GTSDB;
Uid=MySqlUserId;Pwd=MySqlPwd;" />
</connectionStrings>
6.1.3 GRAssTrack Job Runner GTJR.exe.config has the following settings:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="webServiceURL"
value="http://www.bluesoft.dnsalias.com/GTS/GTS.asmx" />
<add key="adminEmailAddress" value="bluesoftgt@yahoo.it" />
<add key="smtpHost" value="smtp.mail.yahoo.it" />
<!--
<add key="smtpPort" value="25" />
<add key="smtpEnableSsl" value="false" />
-->
<add key="smtpUser" value="bluesoftgt" />
<add key="smtpPassword" value="password" />
</appSettings>
</configuration>
6.2 Database
The following figures illustrate GTSDB tables and their relationships (obviously a DBMS must be installed; GTS has been tested with SQL Server 2005).
FIGURE 6.2 – Operations table
Operations table will be used for raw insertion and therefore for periodical synchronizations; locked field is used to manage synchronization concurrency issues.
FIGURE 6.3 – Actions table
FIGURE 6.4 – TagAssetPairs table
FIGURE 6.5 – Positions table
FIGURE 6.6 – Tracks table
FIGURE 6.7 – Tables relationships
6.3 Detailed class diagrams
6.3.1 GRAssTrack Mobile
6.3.1.1 BLUEsoft.Configuration.AppSettings
FIGURE 6.8 – Settings classes
6.3.1.2 BLUEsoft.GPS.Data
FIGURE 6.9 – GPS classes
6.3.1.3 BLUEsoft.RFID.Data
FIGURE 6.10 – RFID classes
6.3.1.4 BLUEsoft.PowerManagement
FIGURE 6.11 – Power management classes
FIGURE 6.12– PsionTeklogixPM class (PsionTeklogix package)
6.3.1.5 BLUEsoft.GRAssTrack.Mobile
FIGURE 6.13 – PLConfig and AlphaNumTextBox classes
FIGURE 6.14 – GtmForm class fields
FIGURE 6.15 – GtmForm class methods
FIGURE 6.16 – BLLConfig and GeographicCoords classes
FIGURE 6.17 – IdReceivedEventArgs class and IdReceivedEventHandler delegate
FIGURE 6.18 – SyncStartEventArgs class and SyncStartEventHandler delegate
FIGURE 6.19 – DALConfig and GtmGtsWebServiceProxy classes
FIGURE 6.20 – XmlData class
6.3.2 GRAssTrack Server 6.3.2.1 BLUEsoft.Data.AnyDbms
FIGURE 6.21 – AnyDbProvider class
6.3.2.2 BLUEsoft.Net.Mail
FIGURE 6.22 – Mailer class
6.3.2.3 BLUEsoft.GRAssTrack.Server
FIGURE 6.23 – GtsWebService and Operation classes
FIGURE 6.24 – DbAccess class
6.3.3 GRAssTrack Job Runner
6.3.3.1 BLUEsoft.Diagnostics.TaskScheduler
FIGURE 6.25 – ScheduledTasks and Task classes
FIGURE 6.26 – TriggerList and Trigger classes
Only the most important classes have been displayed; for the others refer to the source code.
6.3.3.2 BLUEsoft.Diagnostics.EventLogger
FIGURE 6.27 – EventsLog class
6.3.3.3 BLUEsoft.Net.Mail See paragraph 6.3.2.2 at page 139.
6.3.3.4 BLUEsoft.GRAssTrack.JobRunner
FIGURE 6.28 – GtjrForm and Gtjr classes
6.4 User interaction
6.4.1 GRAssTrack Mobile
At startup GTM presents the following login screen:
FIGURE 6.29 – Login screen
At the top there is a small square that simulates a LED; it can take four different colors, depending on the associated information:
1. grey – RFID reader is off/LED is flashing
2. flashing yellow – RFID reader is waiting for a tag to respond 3. red – no tag response received by the reader (now off)
4. blue – a tag has been read by the interrogator (now off)
FIGURE 6.30 – Tag LED possible colors
Each employee must insert his identifier or read it from a tag to log in; if the length of the identifier match the one specified in the settings the log in button is enabled:
FIGURE 6.31 – Ready to log in screen
By pressing it the user can log in and the following screen appears:
FIGURE 6.32 – Logging in screen
After a while the employee can start using the program that has the following appearance:
FIGURE 6.33 – Main screen
The GPS LED has three possible states:
1. grey – Bluetooth radio off, no GPS activity/LED is flashing
2. flashing yellow – Bluetooth radio on, waiting/receiving position (when receiving position the associated labels display latitude, longitude and altitude) 3. red – Bluetooth radio off, no GPS activity since no position was received
FIGURE 6.34 – GPS LED colors
GTM text boxes and associated buttons let the employee insert identifiers and make tag-asset association, so that the next time a tag ID is inserted, the corresponding asset ID is retrieved from GTMData.xml, the XML data file.
Check in/out buttons determine if the operation represent the start or end of an asset movement; obviously check out is not possible before check in and, vice versa,
check in is only possible if the previous operation has already performed its check out.
From time to time synchronization starts providing progress information:
FIGURE 6.35 – Synchronization screen
Synchronization LED has four states:
1. flashing grey – synchronization in progress 2. flashing yellow – synchronization in progress 3. red – synchronization failed
4. blue – synchronization success
FIGURE 6.36 – Sync LED colors
Synchronization can also occur without any employee being logged in and, in this case, progress information will be provided on the login screen.
6.4.2 GRAssTrack Server
GTS does not provide a GUI a part from the web page that can be seen if the Web Service URL is reached with a browser:
FIGURE 6.37 – Web Service web page
When problems are encountered during stored data synchronization, an administrative email is sent.
Suppose the database server is not active:
FIGURE 6.38 – SQL Server stopped
The following figure shows the mail that will be sent by GTS to the administrator.
FIGURE 6.39 – Administrative email in case of data storage failure
6.4.3 GRAssTrack Job Runner
GTJR provides a user interface only when it is not run in silent/synchronization mode; the GUI let the user to install/uninstall the program and to set/change schedule time and interval.
FIGURE 6.40 – Install/uninstall screen
The installation process involves interacting with Windows to schedule GTJR, so that it could be run by Windows Task Scheduler in silent mode and allowing it to write events that could be read with the Event Viewer.
FIGURE 6.41 – GTJR scheduled
When the program runs in silent mode it logs operations with these events and if problems are encountered an administrative email is sent.
Event IDs possible values are 0, 1, 2 and 3:
• event ID 0 – job run successfully
• event ID 1 – the Web Service cannot be reached
• event ID 2 – an error occurred during database synchronization
• event ID 3 – an error occurred sending an administrative email
FIGURE 6.42 – GTJR events as shown by the Event Viewer
If the web server or the DBMS are stopped, event 1 or 2 will occur, respectively.
FIGURE 6.43 – IIS stopped
FIGURE 6.44 – Job run successfully
FIGURE 6.45 – Error 1: Web Service cannot be reach
FIGURE 6.46 – Administrative email in case of error 1
FIGURE 6.47 – Error 2: database synchronization failed
FIGURE 6.48 – Administrative email in case of error 2
FIGURE 6.49 – Error 3: an error occurred sending email
6.5 GRAssTrack software requirements
GT requires the following software to be installed and properly configured:
• Microsoft Internet Information Services (IIS) to expose GTS Web Service (make sure the ASPNET user has been given the appropriate permissions on GTS folder)
• A database server among IBM DB2, Oracle Database, Microsoft SQL Server and MySQL (make sure the ASPNET user has been given the appropriate permissions to access the DBMS and GTSDB)
With regard to SQL Server the following steps must be performed:
1. Install SQL Server 2005 and SQL Server Management Studio (SSMS) 2. Open SSMS and right-click on ServerName → Properties
3. Go to Security, set Server authentication to SQL Server and Windows Authentication mode and close Properties
4. Create a database user and the associated SQL Server login and grant him needed permissions (see the query below)
5. Right-click on UserName in ServerName → Security and go to Properties → General to verify the default database is correct
6. Go to ServerName → Databases, right-click on GTSDB and go to Properties → Permissions to verify the user has the right permissions
Below there is a sample of user creation/deletion script:
CREATE LOGIN ASPUsr WITH PASSWORD = 'Pwd',DEFAULT_DATABASE = GTSDB USE GTSDB
CREATE USER ASPUsr GRANT CONNECT TO ASPUsr GRANT DELETE TO ASPUsr GRANT INSERT TO ASPUsr GRANT SELECT TO ASPUsr GRANT UPDATE TO ASPUsr
DROP LOGIN ASPUsr USE GTSDB
DROP USER ASPUsr