Skip to content
Bruce Schubert edited this page Aug 21, 2020 · 30 revisions
Contents
  1. Software Architecture
  2. Software Development Plan
  3. Software Project Setup
  4. Additional Information

Software Architecture

Architectural Viewpoints

Rational Unified Process 4+1 View

Alt text

Use Case View

Use Case Diagram

Alt text

Logical View

Class Diagram

Alt text

Process View

Activity Diagram

Alt text

Sequence Diagram

Alt text

Implementation View

Component Diagram

Alt text

Deployment View

Deployment Diagram

Alt text

Data View

Entity Relationship Diagram

Alt text


Software Development Plan

The development plan's phase objectives are captured in the GitHub projects.

  • Iteration #I1: v0.1
  • Iteration #E1: v0.2
  • Iteration #C1: v0.3
  • Iteration #C2: v0.4
  • Iteration #C3: v0.5
  • Iteration #T1: v1.0

Software Project Setup

Clone (or download) the Repository

You need a copy of this repository placed in a folder on your pi, e.g., /pi/home/callattendant. You can either clone this repository, or download a zip file, or download a specific release from Releases.

Clone with Git

Here's how clone the repository with git into your home folder:

cd 
git clone https://github.com/emxsys/callattendant.git
cd callattendant
Download Zip

If you download the latest code or a specific release, the unzpped folder will be named callattendant-master or callattendant-<release_tag> depending on what you downloaded. You can rename it if you wish. Here's how unzip it into your home folder.

cd
unzip ~/Downloads/callattendant-master.zip 
cd callattendant-master

Establish the Development Environment

The installation calls for Python3.x.

Note, if you are going to use a virtual environment, you will use the python command. Whereas, if you use the Python release provided by the Raspberry Pi you will be using the python3 command. If you use the python command outside the virtual environment you will be running Python2.x

Setup Virtual Environment

Optional

For development purposes, you might be best served by setting up a virtual environment. If you intend to simply install and run the callattendant on a dedicated Raspberry Pi, you can skip this step and proceed with Install Packages.

The following instructions create a virtual environment named python3 within the current folder:

sudo apt install virtualenv

virtualenv python3 --python=python3

source python3/bin/activate

Now you're operating with a virtual Python. To check, issue the following command:

$ which python

You should see output of the form:

(python3) pi@raspberryi:~/testing $ which python
/home/pi/testing/python3/bin/python

To make sure you're on 3.x as requested, issue:

$ python --version

You should see output of the form:

(python3) pi@raspberrypi:~/testing $ python --version
Python 3.7.3

Install Packages

We've provided a requirements file called requirements.txt. Let's use it to install the required packages. But first, navigate to the folder where the callattendant repository was placed, e.g., /pi/home/callattendant.

For the virtual environment:

$ pip install -r requirements.txt

or for the preinstalled Python version:

$ pip3 install -r requirements.txt

If you intend to run the callattendant as a service, you'll need to install the dependencies as the root user. E.g.,

$ sudo pip3 install -r requirements.txt

In my install, lxml took a long time to build (because Raspberry Pi) but it's worth the wait to get to that part of blocking spam calls. So chill and do whatever it is you do while software builds.

Initialization

In the callattendant/src directory, issue the following command:

python callattendant.py

You should see output of the form:

(python3) pi@raspberrypi:~/testing/callattendant/src $ python callattendant.py
CallLogger initialized
Blacklist initialized
Whitelist initialized
Modem COM Port is: /dev/ttyACM0
 * Serving Flask app "userinterface.webapp" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

Navigate to <pi_address> on port 5000 and you should see the home page. Make a few calls to yourself to test the service.


Additional Information

Python

twine requires Python 3.6 or greater. Here's how I upgraded from 3.5.3 to 3.8.5:

# Install prerequisites
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev tar wget vim

# Download Python
cd ~/Downloads/
wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

# Install Python (this takes awhile)
sudo tar zxf Python-3.8.5.tgz
cd Python-3.8.5
sudo ./configure --enable-optimizations
sudo make -j 4
sudo make altinstall

Unit Tests

pytest is used for unit testing.

# Install
pip3 install pytest
# Run from the top-level package 
cd ~/callattendant/callattendant

# Runnning "python -m pytest ..." adds the current directory to the sys.path
python -m pytest ../tests

PyPI

# Make sure you have the latest versions of setuptools and wheel installed:
python3 -m pip install --user --upgrade setuptools wheel

# Now run this command from the same directory where setup.py is located:
python3 setup.py sdist bdist_wheel
Uploading to TestPyPI

Go to https://test.pypi.org/manage/account/#api-tokens and create a new API token;

# You can use twine to upload the distribution packages. You’ll need to install Twine:
python3 -m pip install --user --upgrade twine

# Once intalled, run Twine to upload all of the archives under dist:
python3 -m twine upload --repository testpypi dist/*

Tools

SQLiteBrowser

You can use the SQLiteBrowser to examine and/or modify the callattendant database.

sudo apt-get install sqlitebrowser
sqlitebrowser callattendant.db

US Robotics 5637 Modem Resources

The following blogs from IoT Bytes by Pradeep Singh were very useful for learning to how to program the Raspberry Pi and the US Robotics 5637 modem. His blog site has many Raspberry Pi resources. Thanks Pradeep!