2021-02-14 23:58:32 +00:00
|
|
|
from multiprocessing import Queue
|
2021-04-08 21:21:28 +00:00
|
|
|
from typing import Callable, List
|
|
|
|
|
2021-02-14 23:58:32 +00:00
|
|
|
|
2021-04-08 19:53:51 +00:00
|
|
|
class Controller:
|
2021-04-08 21:21:28 +00:00
|
|
|
# Main controller class. All implementations of controller support should inherit this.
|
2021-04-08 19:53:51 +00:00
|
|
|
callbacks: List[Callable] = []
|
|
|
|
player_to_q: List[Queue]
|
2021-09-24 20:11:39 +00:00
|
|
|
player_from_q: Queue
|
2021-04-08 19:53:51 +00:00
|
|
|
|
2021-09-24 20:11:39 +00:00
|
|
|
def __init__(self, player_to_q: List[Queue], player_from_q: Queue):
|
2021-04-08 19:53:51 +00:00
|
|
|
self.handler()
|
|
|
|
return
|
|
|
|
|
|
|
|
def _state_handler(self):
|
|
|
|
return
|
|
|
|
|
|
|
|
# Registers a function for the controller class to call to tell BAPSicle to do something.
|
|
|
|
def register_callback(self, callback: Callable):
|
|
|
|
self.callbacks.append(callback)
|
|
|
|
return
|
|
|
|
|
|
|
|
# Loop etc in here to process the data from your controller and call the callbacks.
|
|
|
|
def handler(self):
|
|
|
|
return
|