File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import asyncio
44import logging
5+ from enum import Enum
56from typing import Dict
67
78from openlifu .io .LIFUHVController import HVController
1011from openlifu .io .LIFUUart import LIFUUart
1112from openlifu .plan .solution import Solution
1213
13- STATUS_COMMS_ERROR = - 1
14- STATUS_SYS_OFF = 0
15- STATUS_SYS_POWERUP = 1
16- STATUS_SYS_ON = 2
17- STATUS_PROGRAMMING = 3
18- STATUS_READY = 4
19- STATUS_NOT_READY = 5
20- STATUS_RUNNING = 6
21- STATUS_FINISHED = 7
22- STATUS_ERROR = 8
14+
15+ class LIFUInterfaceStatus (Enum ):
16+ STATUS_COMMS_ERROR = - 1
17+ STATUS_SYS_OFF = 0
18+ STATUS_SYS_POWERUP = 1
19+ STATUS_SYS_ON = 2
20+ STATUS_PROGRAMMING = 3
21+ STATUS_READY = 4
22+ STATUS_NOT_READY = 5
23+ STATUS_RUNNING = 6
24+ STATUS_FINISHED = 7
25+ STATUS_ERROR = 8
2326
2427logger = logging .getLogger (__name__ )
2528
@@ -183,9 +186,9 @@ def get_status(self):
183186 int: The device status.
184187 """
185188 if self ._test_mode :
186- return STATUS_READY
189+ return LIFUInterfaceStatus . STATUS_READY
187190
188- status = STATUS_ERROR
191+ status = LIFUInterfaceStatus . STATUS_ERROR
189192 return status
190193
191194 def stop_sonication (self ) -> bool :
Original file line number Diff line number Diff line change 1- from openlifu .io .LIFUInterface import LIFUInterface
1+ from openlifu .io .LIFUInterface import LIFUInterface , LIFUInterfaceStatus
22
33__all__ = [
44 "LIFUInterface" ,
5+ "LIFUInterfaceStatus" ,
56]
Original file line number Diff line number Diff line change 33
44from openlifu .bf import Pulse , Sequence
55from openlifu .geo import Point
6- from openlifu .io .LIFUInterface import STATUS_READY , LIFUInterface
6+ from openlifu .io .LIFUInterface import LIFUInterface , LIFUInterfaceStatus
77from openlifu .plan .solution import Solution
88
99
@@ -36,5 +36,5 @@ def test_lifuinterface_mock(example_solution:Solution):
3636 lifu_interface .set_solution (example_solution )
3737 lifu_interface .start_sonication ()
3838 status = lifu_interface .get_status ()
39- assert status == STATUS_READY
39+ assert status == LIFUInterfaceStatus . STATUS_READY
4040 lifu_interface .stop_sonication ()
You can’t perform that action at this time.
0 commit comments