Software Engineering Practice Project. IoT Door Opener
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
The following is an overview of the files within the /src/python/
directory.
This is used for unit testing.
nosetests api_tests.py
This was used to populate the database with mockdata during the development process. This was important for testing and identifying edge cases such as issues with time formatting and time zones.
This was used as a proof of concept to determine the feasability of creating a backend in python
instead of node
. This file creates an object and adds it to the database and pulls it back and reproduces it as a usable object.
This is used to host a server locally that can give a response to the arduino
based on what card is provided to the /auth
route entry point. This critical in building a rapid prototype of the end-to-end communication between a server
and arduino
.
python server.py
The Web Application is broken down into two parts. The server
and the client
.
-
Server
The server lives in the
/src/SSWebApp/
folder and can be executed withcd src/SSWebApp/ npm run server
-
Client
The client lives in the
/src/SSWebApp/client/
folder and can be executed withcd src/SSWebApp/client/ npm run start
cd src/SSWebApp/
npm install
cd client
npm install
cd src/SSWebApp/
npm run dev
There are some issues when executing the server and client from command line and utilising VSCode as the editing environment. vscode
and nodemon
utilise the same method of watching for files. It is important to note that when running vscode
first, it will conflict with nodemon being run out of the vscode instanse. There are two main soltions for this problem.
- Execute the server and client before starting the
vscode
instanse - Execute the server and client from within the
vscode
terminal
Alternatively, this can be bypassed by not running these services with nodemon
but rather just node
.
A more indepth solution can be to run the two services on different listening ports for file watching, however this is unnesseracy for the scope of this potential issue.
The arduino
software is located in /src/arduino
. There is one primary file basic_nfc.ino
. This depends on a secondary file named secrets.h
which is not exposed in this repository.
This file is used to pass information to the arduino
that may change per deployment environment. For example, when deploying this system to multiple physical buildings. The arduino
may use different wifis and servers. These changes all occur in the secrets.h
file. This acts as the configuration file.
#define WIFI_SSID "{$SSID}"
#define WIFI_PASSOWRD "{$PASSWORD}"
#define ROOM_NAME "{$ROOM_NAME}"
#define PORT 5000
#define API_PATH "/api/authorizeDoor/"
int ips[] = {$IP1, $IP2, $IP3, $IP4};
An example of this:
#define WIFI_SSID "SSecurity"
#define WIFI_PASSWORD "SSPassword"
#define ROOM_NAME "Room1"
#define PORT 1337
#define API_PATH "/api/entry_point"
int ips[] {192, 168, 1, 1};
The arduino IDE may required these to compile the software. Install them by going to:
Sketch --> Incluide Library --> Manage Libraries... --> {Search for depedency}