Index: dialin/common/prs_defs.py =================================================================== diff -u -rf33ee24b00b5a33c730ed539c072199a56c1c78f -r202904412c10730523596c96a2f5d885e5d019d0 --- dialin/common/prs_defs.py (.../prs_defs.py) (revision f33ee24b00b5a33c730ed539c072199a56c1c78f) +++ dialin/common/prs_defs.py (.../prs_defs.py) (revision 202904412c10730523596c96a2f5d885e5d019d0) @@ -34,3 +34,8 @@ VENOUS_PRESSURE_HIGH_DEF = +400 VENOUS_PRESSURE_HIGH_MAX = +600 +class AlarmPriority: + ALARM_HIGH = 3 + ALARM_MED = 2 + ALARM_LOW = 1 + ALARM_NONE = 0 Index: dialin/squish/unittests.py =================================================================== diff -u -r91dc90bd009bdbf5621dcaa1bc12ab3d691673f7 -r202904412c10730523596c96a2f5d885e5d019d0 --- dialin/squish/unittests.py (.../unittests.py) (revision 91dc90bd009bdbf5621dcaa1bc12ab3d691673f7) +++ dialin/squish/unittests.py (.../unittests.py) (revision 202904412c10730523596c96a2f5d885e5d019d0) @@ -16,9 +16,12 @@ import test import sys -from subprocess import check_output from dialin.squish import crc +from dialin.squish.utils import check_can0 + +from can import util +from can.interfaces.socketcan import utils MICRO = [8, 9] @@ -66,16 +69,8 @@ def test_can0(): """ - check if the can0 bus driver presents + tests if the can0 bus driver presents :return: """ - canid = "can0" - ipa = "ip a" - ipa = check_output(ipa, shell=True) - loc = str(ipa).find(canid) - fnd = loc >= 0 - if (fnd): - msg = "can device '{}' found".format(canid) - else: - msg = "No can device registered as '{}'".format(canid) - test.compare(loc >= 0, True, msg) + ok, msg = check_can0() + test.compare(ok, True, msg) Index: dialin/squish/utils.py =================================================================== diff -u -rf33ee24b00b5a33c730ed539c072199a56c1c78f -r202904412c10730523596c96a2f5d885e5d019d0 --- dialin/squish/utils.py (.../utils.py) (revision f33ee24b00b5a33c730ed539c072199a56c1c78f) +++ dialin/squish/utils.py (.../utils.py) (revision 202904412c10730523596c96a2f5d885e5d019d0) @@ -16,6 +16,7 @@ import time import struct +from subprocess import check_output def SRSUI(vSRSUI = ""): @@ -162,3 +163,18 @@ """ return vValue / 1000 +def check_can0(): + """ + check if the can0 bus driver presents + :return: (list) false if can0 not exists, msg as a message + """ + canid = "can0" + ipa = "ip a" + ipa = check_output(ipa, shell=True) + loc = str(ipa).find(canid) + fnd = loc >= 0 + if (fnd): + msg = "can device '{}' found".format(canid) + else: + msg = "No can device registered as '{}'".format(canid) + return loc >= 0, msg \ No newline at end of file