|
@@ -7,7 +7,6 @@ import settings
|
|
|
from .SerialIns import SerialIns
|
|
from .SerialIns import SerialIns
|
|
|
from .BaseClass import BaseClass
|
|
from .BaseClass import BaseClass
|
|
|
from sockets.connect_manager import ConnectionManager
|
|
from sockets.connect_manager import ConnectionManager
|
|
|
-from sockets.socket_client import socket_manager
|
|
|
|
|
|
|
|
|
|
# from .BlueToothMode import BlueToothMode
|
|
# from .BlueToothMode import BlueToothMode
|
|
|
class RemoteControlV2(BaseClass):
|
|
class RemoteControlV2(BaseClass):
|
|
@@ -144,6 +143,9 @@ class RemoteControlV2(BaseClass):
|
|
|
flag = "接收器已连接 {}".format(
|
|
flag = "接收器已连接 {}".format(
|
|
|
"蓝牙" if self.bluetooth_address else "串口"
|
|
"蓝牙" if self.bluetooth_address else "串口"
|
|
|
)
|
|
)
|
|
|
|
|
+ self.sendSocketMessage(code=0, msg="遥控设备V2 打开蓝牙成功", data=None,device_status=2)
|
|
|
|
|
+ self.connect_state = True
|
|
|
|
|
+ self.is_running = True
|
|
|
else:
|
|
else:
|
|
|
flag = "接收器未连接"
|
|
flag = "接收器未连接"
|
|
|
device_status = -1
|
|
device_status = -1
|
|
@@ -235,10 +237,27 @@ class RemoteControlV2(BaseClass):
|
|
|
},
|
|
},
|
|
|
"type": "run_mcu",
|
|
"type": "run_mcu",
|
|
|
}
|
|
}
|
|
|
- loop = asyncio.get_event_loop()
|
|
|
|
|
- async def sendControlData():
|
|
|
|
|
- await socket_manager.websocket.send(json.dumps(input_data))
|
|
|
|
|
- loop.create_task(sendControlData(), name="sendControlData")
|
|
|
|
|
|
|
+ # loop = asyncio.get_event_loop()
|
|
|
|
|
+ # session = SqlQuery()
|
|
|
|
|
+ # crud = CRUD(DeviceConfig)
|
|
|
|
|
+ # condtions = {"mode_type": control_program, "action_status": True}
|
|
|
|
|
+ # all_devices = crud.read_all(
|
|
|
|
|
+ # session, conditions=condtions, order_by="action_index", ascending=True
|
|
|
|
|
+ # )
|
|
|
|
|
+ # if len(all_devices) == 0:
|
|
|
|
|
+ # self.sendSocketMessage(
|
|
|
|
|
+ # code=1,
|
|
|
|
|
+ # msg=f"当前没有可用配置",
|
|
|
|
|
+ # data=input_data,
|
|
|
|
|
+ # device_status=2,
|
|
|
|
|
+ # )
|
|
|
|
|
+ # return
|
|
|
|
|
+ # action_list = [device.model_dump() for device in all_devices]
|
|
|
|
|
+ # print("action_list", action_list)
|
|
|
|
|
+ # loop.create_task(
|
|
|
|
|
+ # device_ctrl.run_mcu_config(action_list, self.goods_art_no),
|
|
|
|
|
+ # name="run_mcu_config",
|
|
|
|
|
+ # )
|
|
|
self.sendSocketMessage(
|
|
self.sendSocketMessage(
|
|
|
code=0,
|
|
code=0,
|
|
|
msg=f"准备执行[{control_program}]",
|
|
msg=f"准备执行[{control_program}]",
|