![Diality](images/logo.jpg) # Dialin This repository contains the source code for the Dialin API. The Dialin API supports cross-functional testing of the Denali system. It supports the Systems level testing, Software Verification & Validation, and pre-release SW and FW developmental testing by exposing and simulating interaction with the UI, HD, and DG sub-components. To use this API, it is recommended to install the API directly from this locally hosted git repository. It is also possible to install it from a pre-packaged .whl file. Once installed to your local virtual python environment with pip, you can import modules as needed to develop your tests. All released versions of this API will be officially versioned so backwards compatibility is maintained and API updates can continue without affecting day-to-day testing. Please understand that the structure of this repository is still under review and the architecture is likely to change as improvements are made. ## Using the API ### Install directly from this repository - Assumes your ssh key has already been setup with our internal BitBucket servers - Assumes your computer is in the office or that you are on the VPN How to install from the dialin_refactoring_3 branch (Available) ``` #!/bin/bash virtualenv --python=python3 venv source venv/bin/activate branch="dialin_refactoring_3" pip3 install git+ssh://git@dvm-linux02:7999/vv/dialin.git@$branch ``` All release versions will eventually be placed on their own separate branch to facilitate backwards compatibility and a fully accessible and testable API version history. How to install from the master branch (Not yet available) - Will be possible as soon as the dialin_refactoring_3 branch has been merged with the master branch ``` #!/bin/bash virtualenv --python=python3 venv source venv/bin/activate pip3 install git+ssh://git@dvm-linux02:7999/vv/dialin.git ``` ### Install from a pre-built .whl file: ``` #!/bin/bash virtualenv --python=python3 venv source venv/bin/activate pip3 install dialin-0.0.1-py3-none-any.whl ``` ### Modules - See the tests directory for examples of how to use this API - Also consult the Dialin API documentation which can be generated using the `tools/document.sh` script. ``` from dialin.hd.alarms import HDAlarms from dialin.hd.blood_flow import HDBloodFlow from dialin.hd.buttons import HDButtons from dialin.hd.constants import RESET, NO_RESET from dialin.hd.dialysate_inlet_flow import HDDialysateInletFlow from dialin.hd.dialysate_outlet_flow import HDDialysateOutletFlow from dialin.hd.hemodialysis_device import HD from dialin.hd.pressure_occlusion import HDPressureOcclusion from dialin.hd.rtc import HDRTC from dialin.hd.treatment import HDTreatment from dialin.hd.ui_proxy import HDUIProxy from dialin.hd.watchdog import HDWatchdog from dialin.dg.dialysate_generator import DG from dialin.protocols.CAN import (DenaliCanMessenger, DenaliMessage, DenaliChannels, LongDenaliMessageBuilder) from dialin.utils.conversions import (integer_to_bytearray, float_to_bytearray) ``` ## Dialin API Internal Development Environment ### Linux After cloning this repository, inside the repository root directory: ``` $ cd tools $ ./setup_environment.sh ``` ### Windows Note that windows support for the python-can library has not been validated. As a result, this API is not functional on windows and windows support may have to be removed in the future. For a brand new setup, after cloning this repository: ``` > setup_environment_windows.bat ``` If the windows environment has been previously set up: ``` > activate_environment_windows.bat ``` ## Unit Testing All internal tests of the dialin API can be found in the tests directory at the root of this git repository: ``` (venv) $ cd tests (venv) $ python3 dialin_unit_test_example.py ``` ## Building the Dialin package ``` $ ./build.sh ```