Beispiel #1
0
    def read_error_status(self) -> OmronErrorStatus:
        """
        環境センサーのError Statusを読み出す

        Returns:
            ErrorStatus
        """
        error_status = OmronErrorStatus()

        self.__MSG(DEBUG,
                   F'reading ErrorStatus(uuid={error_status.shortUuid:#04x})')
        (ble_chara, raw_data) = self.read_char_base(error_status.serviceUuid,
                                                    error_status.uuid)
        return error_status.parse(raw_data)
Beispiel #2
0
    def test_parse(self):
        error_status = OmronErrorStatus()
        data = b'\x00\x01\x01\x00'
        error_status.parse(data)
        dict_data = error_status.to_dict()

        # error_status = {'sensor_status': 0, 'cpu_status': 1, 'battery_status': 1, 'rfu': 0}
        assert type(dict_data) is dict
        assert dict_data["sensor_status"] == 0
        assert dict_data["cpu_status"] == 1
        assert dict_data["battery_status"] == 1
        assert dict_data["rfu"] == 0

        assert error_status.existsError()
Beispiel #3
0
    def test_existsError_error4(self):
        error_status = OmronErrorStatus()
        data = b'\x00\x00\x00\x01'
        error_status.parse(data)

        assert error_status.existsError()
Beispiel #4
0
    def test_existsError_noError(self):
        error_status = OmronErrorStatus()
        data = b'\x00\x00\x00\x00'
        error_status.parse(data)

        assert error_status.existsError() == False
Beispiel #5
0
 def test_short_uuid(self):
     error_status = OmronErrorStatus()
     assert F'{error_status.shortUuid:#0x}' == "0x3033"
Beispiel #6
0
 def test_uuid(self):
     error_status = OmronErrorStatus()
     assert str(error_status.uuid) == "0c4c3033-7700-46f4-aa96-d5e974e32a54"