- def _port_connected_from_native(self, port_ptr, other_port_ptr):
- native_bt.get(port_ptr)
- native_bt.get(other_port_ptr)
- port = bt2.port._create_private_from_ptr(port_ptr)
- other_port = bt2.port._create_from_ptr(other_port_ptr)
-
- try:
- self._port_connected(port, other_port)
- except:
- if not _NO_PRINT_TRACEBACK:
- traceback.print_exc()
-
- def _port_disconnected(self, port):
- pass
-
- def _port_disconnected_from_native(self, port_ptr):
- native_bt.get(port_ptr)
- port = bt2.port._create_private_from_ptr(port_ptr)
-
- try:
- self._port_disconnected(port)
- except:
- if not _NO_PRINT_TRACEBACK:
- traceback.print_exc()
+ def _port_connected_from_native(self, self_port_ptr, self_port_type, other_port_ptr):
+ port = bt2.port._create_self_from_ptr_and_get_ref(
+ self_port_ptr, self_port_type)
+ other_port_type = native_bt.PORT_TYPE_INPUT if self_port_type == native_bt.PORT_TYPE_OUTPUT else native_bt.PORT_TYPE_OUTPUT
+ other_port = bt2.port._create_from_ptr_and_get_ref(
+ other_port_ptr, other_port_type)
+ self._port_connected(port, other_port)