This is a scratch space to write down some notes about the system.
See PopuFare-Documentation.md for a more thorough explanation.
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.
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_STATUSMAILBOX_STOP_STATUSMAILBOX_DRIVER_STATUSMAILBOX_PASS_STATUSMAILBOX_BILL_STATUSMAILBOX_EXITMAILBOX_HUPMAILBOX_PINGThe 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 outputDRIVER_UI_PORT - communication to the microcontroller managing the touchscreen, GPS, vault, clockPASSENGER_UI_PORT - communication to the microcontroller manaing the PIU LCD, RFID, magstripeMODEM_PORT - ppp connection to the GPRS modem for connectivityThe 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_servercommhub/piu_minderPIU/diu_minderDIU/avlsavls/MAILBOX_STATUS_REQUESTavls_server (port 2857)paddlemgravls/billdbbilldb/passdbpassdb/passdb loads the scheme rules file (rules.scm), the RFID patterns file (xx)
There are also a variety of scripts that run to keep track of all the services that are running on the BU.
update_loop.shclient_scripts/client_supervisor, downloads 'firmware' updates and configurationppp-dialer.shppp-dialer/etc/ppp/Testing:
(from SO)
socat -d -d pty,raw,echo=0,link=/tmp/ttyTEST0 pty,raw,echo=0,link=/tmp/ttyTEST1