-
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
// 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
const std = @import("std");
const rc = @import("../rc.zig");
const json = @import("../json.zig");
const allocator = std.heap.c_allocator;
pub const ControlType = enum(c_int) {
pub const cname = "roon_transport_ControlType";
play,
pause,
playpause,
stop,
previous,
next,
};
pub const SeekMode = enum(c_int) {
pub const cname = "roon_transport_SeekMode";
relative,
absolute,
};
pub const ChangeVolumeMode = enum(c_int) {
pub const cname = "roon_transport_ChangeVolumeMode";
absolute,
relative,
relative_step,
};
pub const SubscribeZoneChanges = struct {
pub const Request = json.Serializable(rc.RefCounted(struct {
pub const cname = "roon_transport_SubscribeZoneChanges_Request";
subscription_key: []const u8,
pub fn init(subscription_id: []const u8) @This() {
return .{ .subscription_key = subscription_id };
}
pub fn deinit(self: *const @This()) void {
allocator.free(self.subscription_key);
}
}), .{});
export fn roon_transport_SubscribeZoneChanges_Request_new(
subscription_id: [*:0]const u8,
) callconv(.C) ?*Request {
const copy = allocator.dupe(u8, std.mem.span(subscription_id)) catch {
std.log.err("Unable to copy subscription_id: out of memory", .{});
return null;
};
return Request.new(.init(copy)) catch {
std.log.err("Unable to create SubscribeZoneChange request: out of memory", .{});
allocator.free(copy);
return null;
};
}
};
pub const Control = struct {
pub const Request = json.Serializable(rc.RefCounted(struct {
pub const cname = "roon_transport_Control_Request";
zone_or_output_id: []const u8,
control: ControlType,
pub fn init(zone_or_output_id: []const u8, control: ControlType) @This() {
return .{
.zone_or_output_id = zone_or_output_id,
.control = control,
};
}
pub fn deinit(self: *const @This()) void {
allocator.free(self.zone_or_output_id);
}
}), .{});
export fn roon_transport_Control_Request_new(
zone_or_output_id: [*:0]const u8,
control: ControlType,
) callconv(.C) ?*Request {
const copy = allocator.dupe(u8, std.mem.span(zone_or_output_id)) catch {
std.log.err("Unable to copy zone_or_output_id: out of memory", .{});
return null;
};
return Request.new(.init(copy, control)) catch {
std.log.err("Unable to create Control request: out of memory", .{});
allocator.free(copy);
return null;
};
}
};
pub const Seek = struct {
pub const Request = json.Serializable(rc.RefCounted(struct {
pub const cname = "roon_transport_Seek_Request";
zone_or_output_id: []const u8,
how: SeekMode = .relative,
seconds: i64 = 0,
pub fn init(zone_or_output_id: []const u8) @This() {
return .{ .zone_or_output_id = zone_or_output_id };
}
pub fn deinit(self: *const @This()) void {
allocator.free(self.zone_or_output_id);
}
}), .{});
export fn roon_transport_Seek_Request_new(zone_or_output_id: [*:0]const u8) callconv(.C) ?*Request {
const copy = allocator.dupe(u8, std.mem.span(zone_or_output_id)) catch {
std.log.err("Unable to copy zone_or_output_id: out of memory", .{});
return null;
};
return Request.new(.init(copy)) catch {
std.log.err("Unable to create Seek request: out of memory", .{});
allocator.free(copy);
return null;
};
}
};
pub const ChangeVolume = struct {
pub const Request = json.Serializable(rc.RefCounted(struct {
pub const cname = "roon_transport_ChangeVolume_Request";
output_id: []const u8,
how: ChangeVolumeMode = .relative,
value: f64 = 0,
pub fn init(output_id: []const u8) @This() {
return .{ .output_id = output_id };
}
pub fn deinit(self: *const @This()) void {
allocator.free(self.output_id);
}
}), .{});
export fn roon_transport_ChangeVolume_Request_new(output_id: [*:0]const u8) callconv(.C) ?*Request {
const copy = allocator.dupe(u8, std.mem.span(output_id)) catch {
std.log.err("Unable to copy output_id: out of memory", .{});
return null;
};
return Request.new(.init(copy)) catch {
std.log.err("Unable to create ChangeVolume request: out of memory", .{});
allocator.free(copy);
return null;
};
}
};