-
Notifications
You must be signed in to change notification settings - Fork 49
Design Overview
The RaspberryPi creates a local WiFi access point and hosts a small webserver. Users can connect to the app from any device (phone or computer) without internet access.
- User connects to the RaspberryPi's WiFi access point
- User navigates to the hosted webpage using an internet browser
- User interacts with scanner via webpage GUI
- Specify scan parameters
- Submit scan requests
- View list of recorded scan files
- Download a specific file
- Delete a specific file
- Trigger small troubleshooting scripts that test various components. To be used during device assembly or on error states.
- Shutdown or restart the RaspberryPi
- Simple dependencies or platform requirements
- Simple messaging and IPC (ie: printing stringied JSON)
- Simple languages (Javascript + python)
- Familiar/standard environments (Node + express)
- node webserver (app)
- express routing
- jade templates for front-end
- standard view + route directory structure
- simple client side JavaScript for user interaction
- app uses node's
child_process
module to spawn child processes that execute simple compartmentalized python scripts which interact with the sweep device (ie: perform scan) -
stdin
of the main process (node) and thestdout
of the child process (python) are piped together, such that print statements in python code are essentially messages received as JS events - python code provides updates about the scan progress using a simple message format encoded as stringified JSON, which the back-end JavaScript can easily decode and feed right off to the client side JavaScript at the client’s request
-
output_scans/
: where .csv output scan files are stored -
js/
: contains custom node modules used by various routes -
public/
: contains client-side static files (express will look here)-
javascript/
-
pages/
: browser/client-side JavaScript (1 script for every page) -
scanner/
: a library for code shared by various pages (front-end scanner settings, helper functions etc).
-
-
lib/
: libraries like jQuery -
stylesheets/
: style related stuff
-
-
routes/
: contains scripts which handle routing + back-end logic -
scanner/
: contains python scripts controlling the actual scanner -
views/
: contains jade templates (1 per page) which handle the front end view -
app.js
: the main entry point to the app
The idea is to let other libraries do all the heavy lifting (ie: libsweep
+ sweeppy
should handle all the low level communication with the device).
Simplicity is the overarching design philosophy for the main scanner application. But there are a lot of interesting directions to take the application in the future.
More powerful and expandable solutions could easily be explored. Distributed zeromq patterns with a message schema like protobuff could extend the capabilities beyond IPC, to messaging multiple external applications for real time viewing of data etc. A more simple upgrade might involve switching to a python app that runs in parallel and communicating between node and python via zeroRPC (see discussion here).
The sweeppy
python bindings don't seem as robust as a well organized c++ application that uses libsweep
directly. The scanner code could likely be cleaned up and re-written in c++ without too much effort.