Преглед на файлове

some documentation

* Server.md is a rough start of describing the server daemons
* notes.md is scratch space for notes
clementinecomputing преди 6 години
родител
ревизия
b5d153fdb6
променени са 2 файла, в които са добавени 162 реда и са изтрити 0 реда
  1. 23 0
      Documentation/Server.md
  2. 139 0
      Documentation/notes.md

+ 23 - 0
Documentation/Server.md

@@ -0,0 +1,23 @@
+Server
+===
+
+There are five main server daemons that run to handle the fleet of buses.
+Here is a brief overview
+
+| Name | Default Port | Description |
+|------|--------------|-------------|
+| `avls_server` | `2857` | Receives automatic vehicle locations sytem (AVLS) information from buses and stores in database |
+| `billing_server` | `2455`| Updates database pass information based on usage communication from buses |
+| `buspass_server` | `7277`  | Updates bus units with most recent passes. Updates with delta changes or whole flush of active pass database. |
+| `hello_daemon` | `3566` | Responds to 'hello' requests from tunnel management processes on the bus unit |
+| `version_daemon` | `8377` | Responds to bus units requests for most recent 'config' and 'firmware' packages |
+
+
+| Name | Tables Affected |
+|------|-----------------|
+| `avls_server` | `avls_data` |
+| `billing_server` | `billing_log`, `active_rider_table`, `user_card`, `user_pass`, `rule_class`, `diagnostic_log` |
+| `buspass_server` | `active_rider_table` |
+| `version_daemon` | `bus_checkin_log`, `udpate_level` |
+
+

+ 139 - 0
Documentation/notes.md

@@ -0,0 +1,139 @@
+Popufare Notes
+===
+
+This is a scratch space to write down some notes about the system.
+
+See `PopuFare-Documentation.md` for a more thorough explanation.
+
+* **Location**:
+* **Description**:
+* **Mailboxes**:
+* **Server Connections**:
+
+There is a central server that maintains a database of passes, vehicle positions
+and administrator logins.
+Each deployed bus unit has a collection of processes that maintain a local copy
+of the database and communicate back to the central server to both push updates and receive
+updates.
+
+The bus units (BU) have a local communication pub/sub system.
+The BUs also have various processes connected to the central servers maintenance processes
+via an SSH tunnel through various ports.
+
+### BU Mailboxes
+
+| | | | | |
+|---|---|---|---|---|
+| `MAILBOX_BILLING_LOG` | `MAILBOX_BILL_STATUS` | `MAILBOX_BROADCAST`   | `MAILBOX_DRIVER_NOTIFY`       | `MAILBOX_DRIVER_STATUS` |
+| `MAILBOX_ERROR`       | `MAILBOX_EXIT`        | `MAILBOX_FLUSH_PASSES`        | `MAILBOX_GPS_STATUS`  | `MAILBOX_HELLO` |
+| `MAILBOX_HUP` | `MAILBOX_NAME_MAX`    | `MAILBOX_NEXT_STOP`   | `MAILBOX_PADDLE_ACK`  | `MAILBOX_PASS_STATUS` |
+| `MAILBOX_PING`        | `MAILBOX_PIU_MESSAGE` | `MAILBOX_PONG`        | `MAILBOX_PREV_STOP`   | `MAILBOX_RULE_CALL` |
+| `MAILBOX_SET_PADDLE`  | `MAILBOX_STATUS_REQUEST`      | `MAILBOX_STOP_STATUS` | `MAILBOX_SUBSCRIBE`   | `MAILBOX_TOKEN_MAG` |
+| `MAILBOX_TOKEN_RFID`  | `MAILBOX_UNSUBSCRIBE` | `MAILBOX_UPDATE_PASSES`       | `MAILBOX_VAULT_DROP`  | `MAILBOX_WIRETAP` |
+
+The 'system' mailboxes are:
+
+* `MAILBOX_GPS_STATUS`
+* `MAILBOX_STOP_STATUS`
+* `MAILBOX_DRIVER_STATUS`
+* `MAILBOX_PASS_STATUS`
+* `MAILBOX_BILL_STATUS`
+* `MAILBOX_EXIT`
+* `MAILBOX_HUP`
+* `MAILBOX_PING`
+
+### BU Peripheral Management
+
+The linux board communicates through the serial channels to microcontrollers that control the various peripherals.
+
+There are four (4) serial communication lines:
+
+* `CONSOLE_PORT` - for direct console output
+* `DRIVER_UI_PORT` - communication to the microcontroller managing the `touchscreen`, `GPS`, `vault`, `clock`
+* `PASSENGER_UI_PORT` - communication to the microcontroller manaing the PIU `LCD`, `RFID`, `magstripe`
+* `MODEM_PORT` - ppp connection to the GPRS modem for connectivity
+
+The only BU processes that are in 'direct' communication with the peripherals are the `diu_minder` and the `piu_minder`, both
+managing the appropriate peripherals listed above.
+
+Once an event is detected (for example, a magstripe read), the appropriate process can send a message to the mailboxes
+that need it for processing.
+
+`ipc_server`
+---
+
+* **Location**: `commhub/`
+* **Description**: A pub/sub message intermediary that takes care of message subscriptions and dispatch
+
+`piu_minder`
+---
+
+* **Location**: `PIU/`
+* **Description**: Communicates with the Passenger Interface Unit (PIU) to display messages, beep and get messages from the PIU such as magstripe swipes or RFID reads
+
+`diu_minder`
+---
+
+* **Location**: `DIU/`
+* **Description**: Screen updates, paddle stop advancement, driver login
+
+`avls`
+---
+
+* **Location**: `avls/`
+* **Description**: GPS messages
+* **Mailboxes**: `MAILBOX_STATUS_REQUEST` 
+* **Server Connections**: `avls_server` (port `2857`)
+
+`paddlemgr`
+---
+
+* **Location**: `avls/`
+* **Description**: Paddle maintenance while driving
+
+
+`billdb`
+---
+
+* **Location**: `billdb/`
+* **Description**: Communicates with the server to update pass information
+
+`passdb`
+---
+
+* **Location**: `passdb/`
+* **Description**: Updates local pass database with local pass updates as well as pass updates received from server
+
+`passdb` loads the scheme rules file (`rules.scm`), the RFID patterns file (`xx`)
+
+
+scripts
+---
+
+There are also a variety of scripts that run to keep track of all the services that are running on the BU.
+
+### `update_loop.sh`
+
+* **Location**: `client_scripts/`
+* **Description**: starts `client_supervisor`, downloads 'firmware' updates and configuration
+
+### `ppp-dialer.sh`
+
+* **Location**: `ppp-dialer/etc/ppp/`
+* **Description**: setup GPRS modem, create SSH tunnel back to central server
+
+
+
+Notes
+---
+
+Testing:
+
+(from [SO](https://stackoverflow.com/questions/52187/virtual-serial-port-for-linux)
+
+```
+socat -d -d pty,raw,echo=0,link=/tmp/ttyTEST0 pty,raw,echo=0,link=/tmp/ttyTEST1
+```
+
+
+