@@ -138,6 +138,9 @@ public class AstalBluetooth.Bluetooth : Object {
138
138
[CCode (cname ="astal_bluetooth_iadapter_proxy_get_type ")]
139
139
extern static GLib .Type get_iadapter_proxy_type ();
140
140
141
+ [CCode (cname ="astal_bluetooth_ibattery_proxy_get_type ")]
142
+ extern static GLib .Type get_ibattery_proxy_type ();
143
+
141
144
private Type manager_proxy_get_type (DBusObjectManagerClient _ , string object_path , string ? interface_name ) {
142
145
if (interface_name == null )
143
146
return typeof (DBusObjectProxy );
@@ -147,6 +150,8 @@ public class AstalBluetooth.Bluetooth : Object {
147
150
return get_idevice_proxy_type();
148
151
case " org.bluez.Adapter1" :
149
152
return get_iadapter_proxy_type();
153
+ case " org.bluez.Battery1" :
154
+ return get_ibattery_proxy_type();
150
155
default:
151
156
return typeof (DBusProxy );
152
157
}
@@ -161,6 +166,15 @@ public class AstalBluetooth.Bluetooth : Object {
161
166
sync();
162
167
}
163
168
169
+ if (iface is IBattery ) {
170
+ var battery = new Battery ((IBattery )iface);
171
+ var device = _devices. lookup(iface. g_object_path);
172
+ if (device != null ) {
173
+ device. set_battery(battery);
174
+ }
175
+ sync();
176
+ }
177
+
164
178
if (iface is IAdapter ) {
165
179
var adapter = new Adapter ((IAdapter )iface);
166
180
_adapters. set (adapter. object_path, adapter);
0 commit comments