diff --git a/modem/p2p_connection.py b/modem/p2p_connection.py index 815dcae2..fd90ed5b 100644 --- a/modem/p2p_connection.py +++ b/modem/p2p_connection.py @@ -58,6 +58,8 @@ class P2PConnection: self.destination = destination self.origin = origin + self.bandwidth = 0 + self.states = state_manager self.modem = modem @@ -181,17 +183,22 @@ class P2PConnection: self.log("CONNECTED ISS...........................") self.set_state(States.CONNECTED) self.is_ISS = True + self.socket_command_handler.socket_respond_connected(self.origin, self.destination, self.bandwidth) self.process_data_queue() def connected_irs(self, frame): self.log("CONNECTED IRS...........................") self.set_state(States.CONNECTED) self.is_ISS = False + self.orign = frame["origin"] + self.destination = frame["destination"] + + self.socket_command_handler.socket_respond_connected(self.origin, self.destination, self.bandwidth) + session_open_frame = self.frame_factory.build_p2p_connection_connect_ack(self.destination, self.origin, self.session_id) self.launch_twr_irs(session_open_frame, self.ENTIRE_CONNECTION_TIMEOUT, mode=FREEDV_MODE.signalling) def session_failed(self): - self.log("FAILED...........................") self.set_state(States.FAILED) self.socket_command_handler.socket_respond_disconnected() diff --git a/modem/socket_interface_commands.py b/modem/socket_interface_commands.py index 33708b51..08885451 100644 --- a/modem/socket_interface_commands.py +++ b/modem/socket_interface_commands.py @@ -66,3 +66,6 @@ class SocketCommandHandler: def socket_respond_disconnected(self): self.send_response("DISCONNECTED") + def socket_respond_connected(self, mycall, dxcall, bandwidth): + message = f"CONNECTED {mycall} {dxcall} {bandwidth}" + self.send_response(message)