-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
-
300
-
301
-
302
-
303
-
304
-
305
-
306
-
307
-
308
-
309
-
310
-
311
// Copyright 2025 Shota FUJI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0
[CCode (cheader_filename = "plac.h")]
namespace Plac {
namespace Discovery {
[CCode (
cname = "plac_discovery_server",
ref_function = "plac_discovery_server_retain",
unref_function = "plac_discovery_server_release"
)]
[Compact]
public class Server {
[CCode (cname = "plac_discovery_server_retain")]
public void @ref ();
[CCode (cname = "plac_discovery_server_release")]
public void unref ();
public string id;
public string name;
public string version;
public uint16 http_port;
}
[CCode (
cname = "plac_discovery_scan_result_code",
cprefix = "PLAC_DISCOVERY_SCAN_RESULT_",
has_type_id = false
)]
public enum ScanResultCode {
OK = 0,
UNKNOWN = 1,
NETWORK_UNAVAILABLE = 2,
SOCKET_PERMISSION_DENIED = 3,
SOCKET_ERROR = 4,
OUT_OF_MEMORY = 5,
}
[CCode (
cname = "plac_discovery_scan_result",
ref_function = "plac_discovery_scan_result_retain",
unref_function = "plac_discovery_scan_result_release"
)]
[Compact]
public class ScanResult {
[CCode (cname = "plac_discovery_scan_result_retain")]
public void @ref ();
[CCode (cname = "plac_discovery_scan_result_release")]
public void unref ();
[CCode (
cname = "servers_ptr",
array_length_cname = "servers_len",
array_length_type = "size_t"
)]
public Server[] servers;
public ScanResultCode code;
}
[CCode (cname = "plac_discovery_scan")]
public ScanResult? scan();
[CCode (cname = "plac_discovery_find")]
public ScanResult? find(string server_id);
}
namespace Transport {
[CCode (
cname = "plac_transport_now_playing",
ref_function = "plac_transport_now_playing_retain",
unref_function = "plac_transport_now_playing_release"
)]
[Compact]
public class NowPlaying {
public string one_line_line1;
public string two_line_line1;
public string? two_line_line2;
public string three_line_line1;
public string? three_line_line2;
public string? three_line_line3;
public uint64 seek_position;
public uint64 length;
public bool has_seek_position;
public bool has_length;
}
[CCode (
cname = "plac_transport_seek_change",
ref_function = "plac_transport_seek_change_retain",
unref_function = "plac_transport_seek_change_release"
)]
[Compact]
public class SeekChange {
public string zone_id;
public uint64 seek_position;
public bool has_seek_position;
}
[CCode (
cname = "plac_transport_playback_state",
cprefix = "PLAC_TRANSPORT_PLAYBACK_",
has_type_id = false
)]
public enum PlaybackState {
LOADING = 0,
STOPPED = 1,
PAUSED = 2,
PLAYING = 3,
}
[CCode (
cname = "plac_transport_zone",
ref_function = "plac_transport_zone_retain",
unref_function = "plac_transport_zone_release"
)]
[Compact]
public class Zone {
public string id;
public string name;
public PlaybackState playback;
public uint16 allowed_action;
public NowPlaying? now_playing;
[CCode (cname = "plac_transport_zone_retain")]
public void @ref ();
[CCode (cname = "plac_transport_zone_release")]
public void unref ();
}
[CCode (
cname = "plac_transport_zone_list_event",
ref_function = "plac_transport_zone_list_event_retain",
unref_function = "plac_transport_zone_list_event_release"
)]
[Compact]
public class ZoneListEvent {
[CCode (cname = "plac_transport_zone_list_event_retain")]
public void @ref ();
[CCode (cname = "plac_transport_zone_list_event_release")]
public void unref ();
[CCode (
cname = "added_zones_ptr",
array_length_cname = "added_zones_len",
array_length_type = "size_t"
)]
public Zone[] added;
[CCode (
cname = "changed_zones_ptr",
array_length_cname = "changed_zones_len",
array_length_type = "size_t"
)]
public Zone[] changed;
[CCode (
cname = "removed_zone_ids_ptr",
array_length_cname = "removed_zone_ids_len",
array_length_type = "size_t"
)]
public string[] removed;
[CCode (
cname = "seek_changes_ptr",
array_length_cname = "seek_changes_len",
array_length_type = "size_t"
)]
public SeekChange[] seek_changed;
}
[CCode (cname = "PLAC_TRANSPORT_ACTION_NEXT")]
public const uint16 ACTION_NEXT;
[CCode (cname = "PLAC_TRANSPORT_ACTION_PREV")]
public const uint16 ACTION_PREV;
[CCode (cname = "PLAC_TRANSPORT_ACTION_PAUSE")]
public const uint16 ACTION_PAUSE;
[CCode (cname = "PLAC_TRANSPORT_ACTION_PLAY")]
public const uint16 ACTION_PLAY;
[CCode (cname = "PLAC_TRANSPORT_ACTION_SEEK")]
public const uint16 ACTION_SEEK;
}
[CCode (
cname = "plac_connection_connection_error",
cprefix = "PLAC_CONNECTION_ERROR_",
has_type_id = false
)]
public enum ConnectionError {
UNKNOWN = 0,
CLOSED_BY_SERVER = 1,
OUT_OF_MEMORY = 2,
UNEXPECTED_RESPONSE = 3,
NETWORK_UNAVAILABLE = 4,
NETWORK_ERROR = 5,
}
[CCode (
cname = "plac_connection_connection_error_event",
ref_function = "plac_connection_connection_error_event_retain",
unref_function = "plac_connection_connection_error_event_release"
)]
[Compact]
public class ConnectionErrorEvent {
[CCode (cname = "plac_connection_connection_error_event_retain")]
public void @ref ();
[CCode (cname = "plac_connection_connection_error_event_release")]
public void unref ();
public ConnectionError code;
}
[CCode (
cname = "plac_connection_connected_event",
ref_function = "plac_connection_connected_event_retain",
unref_function = "plac_connection_connected_event_release"
)]
[Compact]
public class ConnectedEvent {
[CCode (cname = "plac_connection_connected_event_retain")]
public void @ref ();
[CCode (cname = "plac_connection_connected_event_release")]
public void unref ();
public string token;
}
[CCode (
cname = "plac_connection_event",
ref_function = "plac_connection_event_retain",
unref_function = "plac_connection_event_release"
)]
[Compact]
public class ConnectionEvent {
[CCode (cname = "plac_connection_event_retain")]
public void @ref ();
[CCode (cname = "plac_connection_event_release")]
public void unref ();
[CCode (
cname = "plac_connection_event_kind",
cprefix = "PLAC_CONNECTION_EVENT_",
has_type_id = false
)]
public enum Kind {
ERROR = 0,
CONNECTED = 1,
ZONE_LIST = 10,
}
public Kind kind;
[CCode (cname = "plac_connection_event_get_connection_error_event")]
public ConnectionErrorEvent get_connection_error_event();
[CCode (cname = "plac_connection_event_get_connected_event")]
public ConnectedEvent get_connected_event();
[CCode (cname = "plac_connection_event_get_zone_list_event")]
public Transport.ZoneListEvent get_zone_list_event();
}
[CCode (
cname = "plac_connection",
ref_function = "plac_connection_retain",
unref_function = "plac_connection_release"
)]
[Compact]
private class Connection {
[CCode (cname = "plac_connection_make")]
public Connection(Discovery.Server server, string? token);
[CCode (cname = "plac_connection_retain")]
public void @ref ();
[CCode (cname = "plac_connection_release")]
public void unref ();
[CCode (cname = "plac_connection_get_event")]
public ConnectionEvent get_event();
[CCode (cname = "plac_connection_subscribe_zones")]
public void subscribe_zones();
[CCode (cname = "plac_connection_control")]
public void control(Transport.Zone zone, uint16 action);
}
}