HW4_second_com
This commit is contained in:
parent
7ec82f80d1
commit
1fbdae751c
@ -58,7 +58,7 @@ class Device(ABC):
|
||||
def action_descriptors(self) -> Collection[ActionDescriptor]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
#@abstractmethod
|
||||
def __getitem__(self, trait_name: str) -> Optional[Any]:
|
||||
"""Return logical state of trait `trait_name`."""
|
||||
pass
|
||||
|
@ -1,10 +1,11 @@
|
||||
from turtle import Turtle
|
||||
from device import SynchronyDevice
|
||||
from typing import Any
|
||||
from equipment.device import SynchronyDevice
|
||||
import inspect
|
||||
|
||||
class TurtleDevice(SynchronyDevice):
|
||||
|
||||
def open():
|
||||
def open(self):
|
||||
super().open()
|
||||
return Turtle()
|
||||
|
||||
@ -46,7 +47,7 @@ class TurtleDevice(SynchronyDevice):
|
||||
pass
|
||||
|
||||
|
||||
print(TurtleDevice.action_descriptors())
|
||||
#print(TurtleDevice.action_descriptors())
|
||||
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ import cmd
|
||||
import threading
|
||||
from threading import Thread
|
||||
from threading import Event
|
||||
import time
|
||||
|
||||
from queue import Queue
|
||||
|
||||
@ -16,11 +17,12 @@ class TurtleDeviceThread(threading.Thread):
|
||||
new_message = self.queue.get()
|
||||
print("Name and args of action are {}".format(new_message))
|
||||
#self.device.
|
||||
#time.sleep(30)
|
||||
self.queue.task_done()
|
||||
if self.event.is_set():
|
||||
break
|
||||
def __message_thread__(self):
|
||||
thread = Thread(target = __message_processing__, daemon=True)
|
||||
thread = Thread(target = self.__message_processing__, daemon=True)
|
||||
thread.start()
|
||||
# TODO(Homework 4) \end
|
||||
|
||||
@ -38,6 +40,7 @@ class NoBlockingTurtleShell(cmd.Cmd):
|
||||
|
||||
def __init__(self, turtle_thread: TurtleDeviceThread):
|
||||
# TODO(Homework 4) \begin
|
||||
super(NoBlockingTurtleShell, self).__init__()
|
||||
turtle_thread.__message_thread__()
|
||||
# TODO(Homework 4) \end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user