Added prelim parallel architecture

This commit is contained in:
Brikwerk 2020-05-27 01:17:37 -07:00
commit ff9e1313b8
4 changed files with 158 additions and 26 deletions

31
demo.py
View file

@ -1,30 +1,15 @@
import threading
import time
from nxbt import ControllerServer
from nxbt import Nxbt
from nxbt import ControllerTypes
# con = ControllerServer(ControllerTypes.JOYCON_R)
# con.run()
# # con.run(reconnect_address="7C:BB:8A:D9:91:5A")
def thread_func_1():
print("Starting Thread 1")
con = ControllerServer(ControllerTypes.JOYCON_R)
con.run()
def thread_func_2():
print("Starting Thread 2")
time.sleep(10)
con = ControllerServer(ControllerTypes.JOYCON_L)
con.run()
if __name__ == "__main__":
x = threading.Thread(target=thread_func_1)
x.start()
nxbt = Nxbt()
index = nxbt.create_controller(
ControllerTypes.PRO_CONTROLLER, "/org/bluez/hci0")
while True:
time.sleep(1)
print(nxbt.get_state())