| | |
| | | |
| | | class L2ActionCallback(object): |
| | | # 监听L2数据 |
| | | def OnSetL2Position(self, client_id, request_id, codes_data): |
| | | def OnSetL2Position(self, codes_data): |
| | | pass |
| | | |
| | | |
| | |
| | | |
| | | # L2指令管理 |
| | | class L2CommandManager: |
| | | action_callback = None |
| | | |
| | | @classmethod |
| | | def init(cls, l2_action_callback): |
| | |
| | | @classmethod |
| | | def process_command(cls, _type, client_id, result_json): |
| | | data = result_json["data"] |
| | | request_id = result_json["request_id"] |
| | | ctype = data["type"] |
| | | if not socket_util.is_client_params_sign_right(result_json): |
| | | # 签名出错 |
| | | SendResponseSkManager.send_error_response(_type, request_id, client_id, |
| | | {"code": -1, "msg": "签名错误"}) |
| | | return |
| | | codes_data = data["data"] |
| | | ctype = result_json["type"] |
| | | if ctype == CLIENT_TYPE_CMD_L2: |
| | | cls.action_callback.OnSetL2Position(client_id, request_id, codes_data) |
| | | cls.action_callback.OnSetL2Position(data) |
| | | |
| | | |
| | | if __name__ == "__main__": |