Commit | Line | Data |
---|---|---|
811644b8 PP |
1 | /* |
2 | * The MIT License (MIT) | |
3 | * | |
4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> | |
5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
7 | * of this software and associated documentation files (the "Software"), to deal | |
8 | * in the Software without restriction, including without limitation the rights | |
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
10 | * copies of the Software, and to permit persons to whom the Software is | |
11 | * furnished to do so, subject to the following conditions: | |
12 | * | |
13 | * The above copyright notice and this permission notice shall be included in | |
14 | * all copies or substantial portions of the Software. | |
15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
22 | * THE SOFTWARE. | |
23 | */ | |
24 | ||
25 | /* Type */ | |
26 | struct bt_port; | |
27 | struct bt_private_port; | |
28 | ||
29 | /* Status */ | |
30 | enum bt_port_status { | |
31 | BT_PORT_STATUS_OK = 0, | |
32 | BT_PORT_STATUS_ERROR = -1, | |
33 | BT_PORT_STATUS_INVALID = -2, | |
34 | }; | |
35 | ||
36 | /* Port type */ | |
37 | enum bt_port_type { | |
38 | BT_PORT_TYPE_INPUT = 0, | |
39 | BT_PORT_TYPE_OUTPUT = 1, | |
40 | BT_PORT_TYPE_UNKOWN = -1, | |
41 | }; | |
42 | ||
43 | /* Functions (public) */ | |
44 | const char *bt_port_get_name(struct bt_port *port); | |
45 | enum bt_port_type bt_port_get_type(struct bt_port *port); | |
46 | struct bt_connection *bt_port_get_connection(struct bt_port *port); | |
47 | struct bt_component *bt_port_get_component(struct bt_port *port); | |
48 | enum bt_port_status bt_port_disconnect(struct bt_port *port); | |
49 | int bt_port_is_connected(struct bt_port *port); | |
50 | ||
51 | /* Functions (private) */ | |
52 | struct bt_port *bt_port_from_private_port(struct bt_private_port *private_port); | |
53 | struct bt_private_connection *bt_private_port_get_private_connection( | |
54 | struct bt_private_port *private_port); | |
55 | struct bt_private_component *bt_private_port_get_private_component( | |
56 | struct bt_private_port *private_port); | |
57 | enum bt_port_status bt_private_port_remove_from_component( | |
58 | struct bt_private_port *private_port); | |
59 | void *bt_private_port_get_user_data( | |
60 | struct bt_private_port *private_port); | |
dc43190b PP |
61 | |
62 | %{ | |
63 | static struct bt_notification_iterator *bt_py3_create_output_port_notif_iter( | |
64 | unsigned long long port_addr, const char *colander_name, | |
65 | PyObject *py_notif_types) | |
66 | { | |
67 | struct bt_notification_iterator *notif_iter; | |
68 | struct bt_port *output_port; | |
69 | enum bt_notification_type *notification_types; | |
70 | ||
71 | output_port = (void *) port_addr; | |
72 | assert(!PyErr_Occurred()); | |
73 | assert(output_port); | |
74 | ||
75 | notification_types = bt_py3_notif_types_from_py_list(py_notif_types); | |
76 | notif_iter = bt_output_port_notification_iterator_create(output_port, | |
77 | colander_name, notification_types); | |
78 | g_free(notification_types); | |
79 | return notif_iter; | |
80 | } | |
81 | %} | |
82 | ||
83 | struct bt_notification_iterator *bt_py3_create_output_port_notif_iter( | |
84 | unsigned long long port_addr, const char *colander_name, | |
85 | PyObject *py_notif_types); |