wiki:CameraControllerspec

Version 12 (modified by tanmay, 6 years ago) (diff)

--

CPTMS Camera Controller

Specification


See the User Interface Prototype in the Subversion repository: trunk/webapps/cptms/CameraDisplay.html
Purpose: Display four camera views of current CPTMS highway conditions in a grid layout.

Functions;

  1. The user selects which of the four displays is to be updated.
  2. The user selects which route (highway) is to be displayed. The list of routes is 5 22 55 57 73 91 133 241 261 405 605.
    Once a route is selected, the camera drop down box filters the camera choices to just those on the selected route.
  3. The users selects a camera. The chosen camera view appears in the selected display.
  4. Our collection of images is incomplete; not every camera in the gson file has an image. So if the user requests a camera for which we have no image, display the "video unavailable" jpg.

Data Sources

  1. cptms/data_layers/cctv_locations_D12.gson is a static file containing the filename and locationName (among other things) for all the CCTV cameras. For each camera is also has a property "nearVDS" which is the ID of the nearest VDS to that camera.
  2. cptms/images/CCTV folder contains all camera images. The route name is the second field of the filename. The traffic speed is the last field in the filename. E.g. 12-005-CCTV-0084-slow.jpg is camera 84 on route 5 for slow traffic.
  3. webapps/dynamicdata/highway_status.json is updated every 30 seconds with traffic flow. The camera display controller reads this file every 30 seconds. For each camera currently being displayed it looks up the nearest VDS (using the "nearVDS" property). Then, based on the color property of that VDS (lime = freeflow, yellow = slow, red = stopped), it then chooses the corresponding image to display from the cptms/images folder.

Test Case 1

Purpose

This is a "smoke" test to verify the basic functionality of the application.

Configuration

These tests assume cptms/data_layers/cctv_locations_D12.gson, cptms/images/CCTV and

dynamicdata/highway_status.json are the data sources.

Application Startup

In a terminal window with webapps as the current directory, start the web server with the (Python 2.7) command: python -m CGIHTTPServer 8080

Open a web browser to localhost:8080/einotebook/

Four boxes appear with two drop-downs in each box, named "Choose Route" and "Choose Camera".

Selecting "Choose Route" reveals a drop-down with 5 22 55 57 73 91 133 241 261 405 605 as the options. Selecting "Choose Camera" however reveals no options.

Select route "005" from the "Choose Route" drop-down of the first box (on the top-left). By default the first option from the camera drop-down will be selected - 'SB 5 N/O MAGNOLIA AVE (S/O 91)'.

The corresponding CCTV camera image should load. To verify, right click on the image and inspect it too see the src containing '12-005-CCTV-0001-day-freeflow.jpg'.

Select route "022" from the "Choose Route" drop-down of the second box (on the top-right). By default the first option from the camera drop-down will be selected - 'EB 22 7TH ST'. Since there is no such image in the cptms/images/CCTV directory, a 'Video Unavailable' image is displayed.

Test Case 2

Purpose

Verify images get updated when traffic flow changes (when VDS colors change).

Configuration

These tests assume cptms/data_layers/cctv_locations_D12.gson, cptms/images/CCTV and

dynamicdata/highway_status.json are the data sources.

Application Startup

In a terminal window with webapps as the current directory, start the web server with the (Python 2.7) command: python -m CGIHTTPServer 8080

Open a web browser to localhost:8080/einotebook/

Select route "005" from the "Choose Route" drop-down of the first box (on the top-left). By default the first option from the camera drop-down will be selected - 'SB 5 17th ST (7TH)'.

The corresponding CCTV camera image should load. To verify, right click on the image and inspect it too see the src containing '12-005-CCTV-0001-day-freeflow.jpg'.

Now open highway_status.json file and find the feature containing the id "5 S 32.25" and change the color property from 'lime' to 'yellow' and save the file.

Wait 30 seconds. The CCTV image should have changed to another image with more traffic visible. To confirm, right-click to inspect it to see the src containing '12-005-CCTV-0029-day-slow.jpg'

Attachments