Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
238 lines (151 sloc) 11.3 KB

IBM IoT for Automotive (Bluemix) - Fleet Management Starter Application




This repository is no longer supported because of the withdrawal of IBM Watson IoT for Automotive Experimental Bluemix service.

For more Information, see this page.

You can use the Fleet Management Starter Application together with an instance of the IBM IoT for Automotive SaaS offering on IBM SoftLayer. See IBM for Automotive (SaaS) - Fleet Management Starter Application.







The IBM IoT for Automotive - Fleet Management Starter Application demonstrates how quickly you can build an app on IBM Bluemix to manage and monitor a fleet of vehicles in real time.

Overview

The Fleet Management Starter Application uses services in IBM Bluemix to provide a sample solution for fleet operation management and personnel. By using the application, you can easily track and view the following information:

  • Availability of a fleet of cars on a map
  • Location of vehicles
  • Overall health of the entire fleet
  • Health diagnostics and conditions of a specific vehicle in the fleet
  • Condition of vehicles by order of severity or risk
  • Event history for the entire fleet
  • Event history for a specific vehicle in the fleet

The Fleet Management Starter Application uses the following services that are available on IBM Bluemix:

You can also use the Fleet Management Starter Application together with an instance of the IBM IoT for Automotive SaaS offering on IBM SoftLayer. For more information, see IBM for Automotive (SaaS) - Fleet Management Starter Application.

Deploying the app on Bluemix

You can automatically deploy an instance of the Fleet Management Starter Application on Bluemix by clicking Deploy to Bluemix. You can also deploy the app manually. Note that you have to do the service activation step mentioned below after the automatic or manual deployment.

To manually deploy your own instance of the Fleet Management Starter Application on Bluemix, complete all of the following steps:

  1. Register an account on Bluemix or use an existing valid account.
  2. Download and install the Cloud-foundry CLI tool.
  3. Clone the Fleet Management Starter Application to your local environment by using the following console command:
git clone https://github.com/ibm-watson-iot/iota-starter-server-fm.git  
  1. Change to the directory that you created.
  2. Edit the manifest.yml file and change the values of <name> and <host> to something unique.
applications:
       :
  host: iota-starter-server-fleetmanagement
  name: iota-starter-server-fleetmanagement
  memory: 512M
  path: .
  instances: 1
       :

The host value is used to generate your application URL, which is in the following syntax:
<host>.mybluemix.net.

  1. Install the NPM package by using the following command. The installer observes the dependencies that are specified in your package.json file.
$ cd ./webclient
$ npm install
  1. Convert TypeScript to JavaScript:
$ npm run tsc
$ npm run gulp
$ cd ..
  1. By using the command line tool, connect to Bluemix and log in when prompted:
$ cf api https://api.ng.bluemix.net
$ cf login
  1. Create an instance of the IBM IoT for Automotive service in Bluemix:
$ cf create-service iotforautomotive free_shared FleetIoTForAuto
  1. Create an instance of the Cloudant NoSQL DB service in Bluemix:
$ cf create-service cloudantNoSQLDB Lite FleetCloudantDB
  1. Push the starter app to Bluemix by using the following command. Because you will need to perform more steps when the app is deployed, you must add the option --no-start when you run the push command.
$ cf push --no-start

Your very own instance of the IBM IoT for Automotive - Fleet Management Starter Application is now deployed on Bluemix.

Activating the Bluemix services

Before you can use the IBM IoT for Automotive - Fleet Management Starter Application, you need to do the following tasks:

Activating the IBM IoT for Automotive service

  1. If the app is already running on Bluemix, stop the app.

  2. Open the Bluemix dashboard in your browser.

  3. Open the IBM IoT for Automotive service and then wait for a few seconds until the user credentials display.

Configuring authentication

To secure the app, authentication is enabled by default for the IoT for Automotive - Fleet Management Starter Application. The default user credentials are as follows:

User name Password
starter Starter4Iot
  • To change the user name or password that is used by the app, edit the values that are specified for the APP_USER and APP_PASSWORD environment variables.

  • To remove authentication, set both the APP_USER and APP_PASSWORD environment variables to 'none'.

Starting the app

  • To start the Fleet Management Starter Application, open the Bluemix dashboard and start the app.

Congratulations! You are now ready to use your own instance of the IBM IoT for Automotive - Fleet Management Starter Application. Open http://<host>.mybluemix.net in your browser.

(Optional) Connecting to an OBDII dongle plugged in to your car

The starter app provides a mobile app to connect to an OBDII dongle plugged in to your car. The mobile app sends data from an OBDII dongle to the Fleet Management Starter Application via IoT Platform service and you can see the data in the app. Follow the steps below to enable this optional feature.

Bind the IoT Platform service to the app

  1. Open the Bluemix dashboard in your browser.

  2. Open the IBM IoT for Automotive service.

  3. Select Connections tab at the left navigation bar.

  4. Click Connect New

  5. Select Internet of Things Platform service and click Create to bind the service

Create a device type for your device

When you start a mobile app for the first time, your device is registered to the IoT Platform service automatically with a device type OBDII. The device type needs to be prepared beforehand.

  1. Launch the IoT Platform dashboard on Bluemix.

  2. Open Device page

  3. Open Device Types tab at top of the page

  4. Click +Create Type

  5. Click Create device type

  6. Input 'OBDII' in Name field

  7. Leave the other fields as default and click Next at the bottom right until a device type is created.

Set up the OBDII Fleet Management App

Refer IBM IoT for Automotive - OBDII Fleet Management App for Android to build and install a mobile app to your Android phone. Once you get ready to use it, start the mobile app on your phone.

Connect the device to the IoT for Automotive service

When you start the mobile app for the first time, a device is registered automatically to the IoT Platform service that you have specified in the mobile app, and corresponding vehicle is created automatically when you connect your device to the IoT Platform. Now, your device is connected to the Fleet Management Starter Application. Go to Map or Car Status page in the app and see the status.

If you no longer need a device, go to IoT Platform dashboard and delete your device manually. Then, after you delete it, update vehicles in the IBM IoT for Automotive service as follows.

  1. Open the Fleet Management Starter Application on your browser.

  2. Select Vehicle tab at the left navigation bar.

  3. Click Sync with IoT Platform at top right of the page.

A vehicle corresponding to deleted device must be removed from a table. Also, if you have added new device to IoT Platform manually, new vehicle is added to the table.

Reporting defects

To report a defect with the IoT for Automotive - Mobility Starter Application mobile app, go to the Issues section section.

Troubleshooting

To debug problems, check the Bluemix app logs. To view the logs, run the following command from the Cloud Foundry CLI:

$ cf logs <application-name> --recent

For more information about how to troubleshoot your application, see the Troubleshooting section in the Bluemix documentation.

Privacy Notice

The IoT for Automotive - Fleet Management Starter Application includes code to track deployments to IBM Bluemix and other Cloud Foundry platforms.

For each instance that you deploy, the following information is sent to a Deployment Tracker service:

  • Application name (application_name)
  • Space ID (space_id)
  • Application version (application_version)
  • Application URIs (application_uris)
  • Labels of bound services
  • Number of instances for each bound service

The tracked data is collected from the VCAP_APPLICATION and VCAP_SERVICES environment variables in IBM Bluemix and other Cloud Foundry platforms. We use the data to track metrics around deployments of sample applications to IBM Bluemix to measure the usefulness of our examples so that we can continuously improve the content that we offer to you. Only deployments of sample applications that include code to ping the Deployment Tracker service are tracked.

Disabling deployment tracking

You can disable the Deployment Tracker service by removing require("cf-deployment-tracker-client").track(); from the beginning of the app.js server file.

Questions, comments or suggestions

For your questions, comments or suggestions to us, visit [Watson IoT for Automotive Application community site] (https://www.ibm.com/developerworks/community/groups/service/html/communitystart?communityUuid=3b06ca1c-fd7c-4a59-a888-e5e3a8384091).

Useful links