Commit | Line | Data |
---|---|---|
0235b0db | 1 | # SPDX-License-Identifier: MIT |
811644b8 PP |
2 | # |
3 | # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> | |
811644b8 | 4 | |
57081273 | 5 | from bt2 import native_bt |
3fb99a22 PP |
6 | from bt2 import port as bt2_port |
7 | from bt2 import object as bt2_object | |
811644b8 PP |
8 | |
9 | ||
c7e5224b | 10 | class _ConnectionConst(bt2_object._SharedObject): |
2c67587a SM |
11 | _get_ref = staticmethod(native_bt.connection_get_ref) |
12 | _put_ref = staticmethod(native_bt.connection_put_ref) | |
811644b8 PP |
13 | |
14 | @property | |
15 | def downstream_port(self): | |
2c67587a | 16 | port_ptr = native_bt.connection_borrow_downstream_port_const(self._ptr) |
5813b3a3 | 17 | return bt2_port._create_from_const_ptr_and_get_ref( |
cfbd7cf3 FD |
18 | port_ptr, native_bt.PORT_TYPE_INPUT |
19 | ) | |
811644b8 PP |
20 | |
21 | @property | |
22 | def upstream_port(self): | |
2c67587a | 23 | port_ptr = native_bt.connection_borrow_upstream_port_const(self._ptr) |
5813b3a3 | 24 | return bt2_port._create_from_const_ptr_and_get_ref( |
cfbd7cf3 FD |
25 | port_ptr, native_bt.PORT_TYPE_OUTPUT |
26 | ) |