You are on page 1of 24

Abstraction

Bus service is a one of major public service in Sri Lanka. Currently number of problems like frauds by the conductors and passengers, difficulty of monitoring the process, difficulty of securing the passenger has been arisen related to this process. Automated Ticketing Service System is introduced as an optimal solution to reduce the complexity of above condition into a reasonable extent. System is consisting of two main sub systems. One of sub system is a web system and other sub system is an Android application running on a mobile device. Mobile application is compatible with Android version 4.0.4. As a whole system uses APIs for QR code generation and scanning, Google map API V3 for maps. System provides services such as registration of customers and buses, recharging of customers, bus and passenger details searching, QR code generation, ticket issuing, day summary report generation, emergency message sending, displaying the remaining time for the current journey, point outing the important nearby places to the current position of the bus and reporting and viewing the current state of the route. Those services are adding values to main four parties as passengers, conductors, bus owners and government. Through this system efficiency of the process will be increased, frauds will be minimized; monitoring process will be simple and less expensive and provide more secure informational background for passengers.

1. Introduction
1.1 Background
Bus service is a one of main public transport activity in Sri Lanka. Under bus service, there are major two types of services as Private and CTB. Owners are maintaining bus service for the purpose of making profits. In the case of making profits, there are major three points which should be extremely considered. Those major points are conductors fraud, poor handling of transaction records and poor customer relationship. From the government side it is difficult to monitor the bus transportation system in simple manner. This system is designed with the intention of make simple above stated complexities. It will increase the productivity of the bus service and also increase the customer satisfaction and the safety.

1.2 Objectives

1. 2. 3. 4.

Develop an efficient system that can replace the traditional system. To eliminate frauds which are done by conductors. To increase more benefits to passengers like current location, security etc. To build a long term customer relationship between passengers and transport company. 5. To provide user friendly and easier device to conductors to do their job efficiently.

1.3 Achievement in Brief


ATS provides significants performance improvements than all the other solutions which are proposed to the transport industry. When considering the other solutions there are separate GPS receiving units, Camera, ticketing solutions etc solutions to achive the above objectives. ATS can be consider as an all in one solution which provides most of functions which are provided by each of above solution.

2. Review of Other works


Available systems Features of the available systems Comparison with our system (Automated ticketing system) (ATS) Ticket by SMS to the passengers mobile phone. Has a special card with QR code. Can recharge the card on time. Automatically generate summery report. Has an emergency message system. Can know important places. E.g. - hospitals, garages. Can know remaining finishing time for the trip. Has GPS facility. E.g.-current location. Has a map notified. Have GPS facility in the ATS. Send SMS for each individual. E.g.-current location. Can report and send messages about any emergency state to the other connected parties. Have the facility to know nearest important places. E.g.-hospitals. GPS is also in one system (ATS). Geo-Location coordination can be known by a single touch. Has a SMS facility with geocoordinates. Have the facility to know nearest important places. E.g. hospitals etc. has an option to be notified about the route state

Physical ticket by digital ticket issuing machine

Issuing a physical ticket. No automated summery report. No any security services. Cannot used to identify the nearest important places. No any time keeper. No any GPS facility. No any map notifying system.

LED displaying systems.

Lighting system to indicate the routes. Just give a notification for all passengers about route. No other special facilities related to the security.

Ticketing system with separate GPS device.

Has a separate GPS device. No SMS facility with geocoordinates. Cannot point out the nearest important places. No any facility to report route state

Ticketing system which uses credit card dragging.

Has a public transportation payment system(use of credit card) have to have sufficient balance in the credit card.(no recharge facility) No automated ticketing facility via SMS to the passenger. No other special facilities related to the security.

Has a special card with QR code. If not sufficient balance for payment, possible to recharge it on time. Has automated ticketing facility via SMS to the passenger.

Table 1. Comparison between ATS and other solutions

3. Methodology and Design


3.1 Technology Adopted

Mobile Application: Works under the Android mobile operating system Specifically supports for Android ICS (4.0.4) The application was developed under the Eclipse Juno IDE

Web Application: PHP version 5.2.0 MySQL version 5.0 A database was developed under the phpMyAdmin 3.3.7 PHP scripts were coded with NotePad++

3.2 Functional View

contactNo contactNo longitud e latitude regNo passengerId nic value

1 Bus

On board

Passenger
Board state

fromCity toCity

income currentLocation route

1
passengerCoun t finalWithdrawal
Travels on

startTimeDate

1 1

Road condition

Route
ToCity fromCity
Type

indexNo

cost

Figure 1: ER Diagram

Search bus & passenger details

Recharge passenger account

Search registered bus location

Admin
Issue ticket as a SMS

Search current location

Inform emergency situations

Search remaining time for trip

Condoctor

Search and inform road state

Check important places

Check daily summary report

Passenger
Receive ticket as an SMS

Bus Owner

Receive recharge amont

Check available balance

Figure 2: Use Case Diagrm

4. Proposed Solution
Our system consist of two parts Web part and the Android application part. In the web part consist of admin login, customer registration, reloading and, bus registration. Here all the semi luxury and luxury busses have to register with our system. So we can produce an Android device which consist of our ATS system. Also the customers must register with us with their id number and the mobile number. We will provide them a code consists of a unique QR code. Each and every customer has their own account. They can deposit money in that account. Travelling cost will be deducted from that account when the customer buys a ticket. Payment will be deposited in the bus owners account. Conductor must login to the system by choosing the correct image combination from an image set which is supposed to be changed its image order in every startup of the application. A passenger can get the ticket from the conductor using his QR code. Conductor will scan the QR code and select the journey destination and submit it. The customer will get the ticket via SMS. Physical money transaction between the passenger and conductor is eliminated. That will reduce the amount of frauds both by the passengers and conductors; Eliminate the need of change cash; Creates a potential to get loans for tickets; it is easy to deal with SMS ticket rather than a paper ticket. If a customer doesnt have enough balance in their accounts, they can recharge their accounts in two ways. One way is recharge through web site by paying cash to an authorized office. Other way is instant recharge by paying some amount to a bus conductor with the device installed ATS application. By this functionality customers easily can increase their balance either by attending to a specific place or on bus; frauds can be minimized because payments are always centrally recorded. With this system conductor can identify the current location of the bus not only as numerical longitude and latitude values but also as the name of the location. Simplicity is the most obvious advantage of this service. Remaining time for the current journey is calculated and displayed by system as another service. It is not based on the devices system time but the servers system time. Simplicity is given with high accuracy with this option. As another system service conductors can identify important nearby places (such as garages, hospitals, police stations, cafes, stores) to the buss current locations with their brief details consist of places name, address, phone no etc. on a Google map. As an example in an emergency like need of repair for the bus, conductor can search the nearest garage with its contact information to get the service.

Conductors can send emergency messages instantly in a case of an emergency to predefined numbers with buss current positions geo -location details. In an emergency, conductors may become confused and unable to get a decision to what to do or who should be contacted. But with this option simple and straight forward decision is available for the conductor. Conductors can report any difficulties that they have found on the route for the sake of other buses with their geographical location. Other buses can view those difficulties by a map on their device and get immediate actions before they come close to them. This functionality helps to avoid huge traffic situations and choose possible alternate ways to complete the journey. Day summary report provides a summary of total income of the day. Number of passengers travelled in the day. And a performance summary of the bus which is consists with the passengers feedbacks. This is automatically generated by the system based on the stored data. So, this report has fresh records and cannot be altered by unauthorized persons. Bus owners can get a reliable understanding of the performance of the service at the end of the day.

5. Implementation
5.1 Implementation of the website
5.1.1 Login to the web site

Only administration party can log into the system, because all the functions should manage by admin panel. Passengers cannot directly log into the system because some functionalities restricted to passengers. Authenticated admin credentials are stored in the central database. Authenticated users can log into the web site using their valid user name and password.

5.1.2 Customer Registration

Through the web site authenticated admins can register passengers with the system. Passengers need only to provide National Identity Card number and their contact details. A QR code will be generated base on the provided NIC number and printed version of that QR code will be considered as the ticket. QR code generation is done by using an API provided by http://qrickit.com/api

5.1.3 Customer Account Re-Charge

Customer accounts can be recharged by the authenticated admin users via the web site by entering the customers NIC number and the amount to be recharged.

5.1.4 Customer Details searching

Customer details can be searched just by entering the NIC of each customer. Data are retrieved from the central database.

5.1.5 Bus Registration

Busses also register with the website by applying its registered number, contact number and route number. Data will be stored in the central database.

10

5.1.6 Bus details searching

Current details of the bus can be searched. It is capable of displaying frequently updating data like geo-location coordinates in a high refreshing rate. The geo location of the bus can be displayed on the Google Map base on latest geolocation coordinates which were stored in the central database.(Android device which is on conductors hand sends its location after each 1 minute to the server.)

5.1.7 Route Map

Route map is capable of displaying current position of all the busses in a particular route. Route can be chosen and it centers the map to the chosen route. Map is provided with Google Map API V3.

http://qrickit.co m/api/
QR Code Generation Feed Data

Admin
Retrieve Data

Feed Data

Web Site
Retrieve Data Map generation

Central DB

Google Map API V3

Figure 3: Implementation of the website 5.2 Implementation of the Android Application

5.2.1 Log In System

Authentication is decided base on the correct combination of the images. Image order is changed on each startup of the application in random manner. This order randomization makes it difficult to guess the image combination by sharp observing of the finger gesture. Choosing correct image combination is easier than providing text based password and username in a moving environment.
11

5.2.2 Ticketing

Ticketing system initially reads the barcode using a barcode scanning API by ZXing Team and retrieves the passengers NIC number and send it to a PHP script via HTTP request in Android. PHP script compares the sent ID with the stored data in the database and validates the passenger. If the passenger is validated moves to next step that conductor is able to input from where and to where passenger needs to travel. Those data are sent to another PHP script. PHP script do the retrieve the necessary data, do some calculations and update all the necessary tables and finally sends the prepared ticket information to the conductors android device. Android device sends the ticket information to the customers mobile phone as a SMS.
SMS QR Code

Customer

QR Code scanning API

NIC

Android Application

Invokes Retrieve

DB
Update

PHP Script

Figure 4: Implementation of ticketing system


5.2.3 Customer account recharging

Bus conductors also can recharge the customers account using android application in his device (This is on the spot service addition to the recharging process via the web site). Customer has only to provide his unique QR code to the conductor. Conductor scans the QR code (QR code scanning is done via an API by ZXing team) and get the NIC. Then conductor has to input the recharging amount and send. All the tables will be updated and a SMS will be sent to the customer via the conductors mobile device.
QR Code Customer SMS Android device of the conductor.

Update via PHP DB

Figure 5: Implementation of customer accout recharge

12

5.2.4 Time Keeper

Bus conductor can use one touch function in the android application to know the remaining time for the current journey. Required times for each and every journey is stored in the database. When the conductor starts the function android application invokes a PHP script (Device sends its embedded bus registration number). PHP script retrieves the stored data and calculates the remaining time based on the current server time. The final result will be sent to the application.

Bus registration number Android device Calculated Remaining Time PHP Script

Data DB

Figure 6: Implementation of time keeper


5.2.5 Emergency Messenger

In an emergency bus conductor can send emergency messages consist of buss current geo-location to set of stored phone numbers in the central database by a single touch on the android device. Messages are sent through the android device (Bus registration number should be sent to a PHP script).

Android device SMS

Bus registration number Phone Numbers

Data PHP Script DB

Recipients

Figure 7: Implementation of Emergency Messenger

13

5.2.6 Summary Report

Summary of the whole day transaction will be sent to the android application just by a single click. Bus registration number should be sent to a PHP script then it calculates the summary information like total income, number of passengers etc. from the stored data in the database.
Data PHP Script DB

Android device

Bus registration number Summary Details

Figure 8: Implementation of summary report


5.2.7 Near By Places

Conductor can identify important nearby places on a map according to a specific category chosen by him. To satisfy this requirement android application retrieves longitudes and latitudes from the GPS receiver of the mobile device. Then that coordination are sent to the Google map engine and it sends a map included with information like geo-location, name, telephone number etc. which are already registered with the server. A Google Map API key should be received from the Google API console under the service named Nearby places to get the service.

Geo-Coordination Android device MAP Google Map Engine

Figure 9: Implementation of important places

14

5.2.8 Road State Notifier

Conductors can report any kind of difficulty on the road with their current locations geo-codes and a description. This will be marked on a Google map which can be accessed by all other conductors on the route. Point details will be stored on the central database and map will be provided by the Google Map API V3.
GeoCoordination Android device Request MAP PHP Script Retrieve Data

Store Data DB

Google Map Engine

Figure 10: Implementation of road state notifier


5.2.9 Current Location

This function is able to notify the conductor the current location of the bus base on the Geo Location details provided by the device. Current place is provided not only as longitude and latitude but also as the place name. Google MAP reverse Geo-Coding service is used with this system.
Geo-Coordination Android device Reverse Geo-Code Google Map Engine

Figure 11. Implementation of current location

15

6. Testing and Evaluation


Amount of time required to complete the each of whole function is measured in seconds to evaluate the performance of the system. Function QR Code/ Barcode Scanning Remaining time for current journey Day Summary Report Emergency Alert Complete Propogation Load completion of the nearby places map Load completion of the route state map Required Time (s) QR Code Barcode 2.2 3.4 8 (Under 2G signals) 9 (Under 2G signals) 15 (Under 2G signals)

Table 2. Evaluation and Testing results

16

7. Conclusion and future works


7.1 Conclusion

ATS provides significants performance improvements than all the other solutions which are proposed to the transport industry. When considering the other solutions there are separate GPS receiving units, Camera, ticketing solutions etc solutions to achive the objectives such as minimizing frauds, efficient monitoring and secure environment for passenger. ATS can be consider as an all in one solution which provides most of functions which are provided by above each solution. ATS minimizes complexity, cost and higher integration among above main three objectives. Government authorities can collect information automatically related to the buses and passengers and can be used them to monitor them. As an example when the tickets are issuing monitoring process can identify the number of the passengers in the bus, the passengers who are in a particular bus etc. Since the device is sending its GPS location to the central server, monitoring process can determine the current location of each bus, speed of that bus etc. This system creates a secure travelling environment for the passengers because system is able to track each and every passenger inside the system. Even in a court case enough evidence can be provided to the court by using the collected data by the system.

7.2 Recommendations for further development

As a future development of this system, Geo-Location map system should be integrated with Google map API V2 since it is faster in android devices rather than API V3. Furthermore message sending can be done via an on-line SMS gate way since it can reduce cost and increase flexibility rather than using sending SMSs through the Android device.

17

8. List of References
1. http://www.thredbo-conferenceseries.org/downloads/thredbo10_papers/thredbo10-themeE-VasconcellosCosta.pdf 2. http://lms.uom.lk/sf/shantha/Project-web-sites/2007-08/Grp-04Mobitiki/Website/documents/Mobitiki%20DraftReport_Group04_final_ver1.pdf 3. http://www.english.gossiplankanews.com/2011/07/card-ticket-system-forbuses.html 4. http://android-developers.blogspot.de/2009/05/painless-threading.html 5. http://rdcworld-android.blogspot.in/2012/01/get-current-location-coordinatescity.html 6. http://code.google.com/p/zxing/wiki/ScanningViaIntent 7. http://osamashabrez.com/simple-client-server-communication-in-android/ 8. http://www.codeproject.com/Articles/15299/Send-a-Text-Message-to-a-CellPhone-from-a-VB-NET 9. http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/8e358d9c-c3254636-a3bf-9ddbdaf7f7eb 10. http://lirneasia.net/2010/04/colloquium-an-efficient-bus-ticket-system-for-srilanka-possibilities-for-a-mobile2-0-solution/

18

9. Appendices
9.1 Timer which sends the geo-location to the database in frequency of one request per minute
Timer t = new Timer(); t.scheduleAtFixedRate( new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { double latitude=0; double longitude=0; @Override public void run() { gps = new GPSTracker(Control_Panal.this); // check if GPS enabled if(gps.canGetLocation()){ latitude = gps.latitude; longitude = gps.longitude; latForMaps=latitude; lonForMaps=longitude; address=GetAddress(latitude+"", longitude+""); address=address.replace(' ', '_'); new sendLocation().execute(address); }else{ // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latForMaps + "\nLong: " + lonForMaps+" \nLocation Name :"+address, Toast.LENGTH_LONG).show(); } }); } }, 0, 60000);

19

9.2 Start the AsyncTask thread


new reloadPassenger ().execute("");

9.2.1 AsyncThread inner class


public class reloadPassenger extends AsyncTask<String, Integer, String>{ @Override protected String doInBackground(String... params) { } @Override protected void onPostExecute(String result){ } }

9.3 Http response request method


HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://ats1.visanduma.info/timeCalculator.php?busNo="+busNo); try { HttpResponse response = httpclient.execute(httpget); if(response != null) { String line = ""; InputStream inputstream = response.getEntity().getContent(); line = convertStreamToString(inputstream); remainingTime=line; } else { } } catch (ClientProtocolException e) { } catch (IOException e) { } catch (Exception e) {} return "";}

20

9.3.1 Method to convert the response data stream to string


private String convertStreamToString(InputStream is) { String line = ""; StringBuilder total = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((line = rd.readLine()) != null) { total.append(line); } } catch (Exception e) { Toast.makeText(this, "Stream Exception", Toast.LENGTH_SHORT).show(); } test=total.toString(); return total.toString(); }

9.4 UI thread

runOnUiThread(new Runnable() { @Override public void run() { smsManager.sendTextMessage(tpn1, null, busNo+" is in an emergency. Lattitude: "+latForMaps+"; Longitude: "+lonForMaps + "Make an imidiate action---Just a test by Udara", null, null); smsManager1.sendTextMessage(tpn2, null, busNo+" is in an emergency. Lattitude: "+latForMaps+"; Longitude: "+lonForMaps + "Make an imidiate action---Just a test by Udara", null, null); smsManager2.sendTextMessage(tpn3, null, busNo+" is in an emergency. Lattitude: "+latForMaps+"; Longitude: "+lonForMaps + "Make an imidiate action---Just a test by Udara", null, null); } });

9.5 SMS sending through android


private void sendSms(String phoneNo){ SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNo, null, line, null, null); Toast.makeText(this, phoneNo, Toast.LENGTH_SHORT).show(); }

21

9.6 Downloading a web page to a webview in Android

WebView webView = (WebView) findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.setWebChromeClient(new WebChromeClient()); webView.loadUrl("http://ats1.visanduma.info/nearByPlaces.php?lat="+Control_ Panal.lonForMaps+"&lon="+Control_Panal.latForMaps+"&placeType="+Control_Pan al.placeType);

22

9.7 Android application UI designs

Login

Control Panal

QR Code Scanning

Choose From

Choose TO

QR Code Scanning
Choose From

Recharging

23

Emergency Message Sending

Remaining time for current location

Day Summary Report

Route State

Route State reporting 24

Route state displaying

You might also like