nm_rs/auto/device_olpc_mesh.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5#![allow(deprecated)]
6
7use crate::{ffi,Device,DeviceWifi,Object};
8use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*};
9use std::{boxed::Box as Box_};
10
11glib::wrapper! {
12 ///
13 ///
14 /// ## Properties
15 ///
16 ///
17 /// #### `active-channel`
18 /// The device's active channel.
19 ///
20 /// Readable
21 ///
22 ///
23 /// #### `companion`
24 /// The companion device.
25 ///
26 /// Readable
27 /// <details><summary><h4>Device</h4></summary>
28 ///
29 ///
30 /// #### `active-connection`
31 /// The #NMActiveConnection object that "owns" this device during activation.
32 ///
33 /// Readable
34 ///
35 ///
36 /// #### `autoconnect`
37 /// Whether the device can auto-activate a connection.
38 ///
39 /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
40 ///
41 /// Readable | Writeable
42 ///
43 ///
44 /// #### `available-connections`
45 /// The available connections of the device
46 ///
47 /// Readable
48 ///
49 ///
50 /// #### `capabilities`
51 /// The capabilities of the device.
52 ///
53 /// Readable
54 ///
55 ///
56 /// #### `device-type`
57 /// The numeric type of the device.
58 ///
59 /// Readable
60 ///
61 ///
62 /// #### `dhcp4-config`
63 /// The IPv4 #NMDhcpConfig of the device.
64 ///
65 /// Readable
66 ///
67 ///
68 /// #### `dhcp6-config`
69 /// The IPv6 #NMDhcpConfig of the device.
70 ///
71 /// Readable
72 ///
73 ///
74 /// #### `driver`
75 /// The driver of the device.
76 ///
77 /// Readable
78 ///
79 ///
80 /// #### `driver-version`
81 /// The version of the device driver.
82 ///
83 /// Readable
84 ///
85 ///
86 /// #### `firmware-missing`
87 /// When [`true`] indicates the device is likely missing firmware required
88 /// for its operation.
89 ///
90 /// Readable
91 ///
92 ///
93 /// #### `firmware-version`
94 /// The firmware version of the device.
95 ///
96 /// Readable
97 ///
98 ///
99 /// #### `hw-address`
100 /// The hardware address of the device.
101 ///
102 /// Readable
103 ///
104 ///
105 /// #### `interface`
106 /// The interface of the device.
107 ///
108 /// Readable
109 ///
110 ///
111 /// #### `interface-flags`
112 /// The interface flags.
113 ///
114 /// Readable
115 ///
116 ///
117 /// #### `ip-interface`
118 /// The IP interface of the device which should be used for all IP-related
119 /// operations like addressing and routing.
120 ///
121 /// Readable
122 ///
123 ///
124 /// #### `ip4-config`
125 /// The #NMIP4Config of the device.
126 ///
127 /// Readable
128 ///
129 ///
130 /// #### `ip4-connectivity`
131 /// The IPv4 connectivity state of the device.
132 ///
133 /// Readable
134 ///
135 ///
136 /// #### `ip6-config`
137 /// The IPv6 #NMIPConfig of the device.
138 ///
139 /// Readable
140 ///
141 ///
142 /// #### `ip6-connectivity`
143 /// The IPv6 connectivity state of the device.
144 ///
145 /// Readable
146 ///
147 ///
148 /// #### `lldp-neighbors`
149 /// The LLDP neighbors.
150 ///
151 /// Readable
152 ///
153 ///
154 /// #### `managed`
155 /// Whether the device is managed by NetworkManager.
156 ///
157 /// Readable
158 ///
159 ///
160 /// #### `metered`
161 /// Whether the device is metered.
162 ///
163 /// Readable
164 ///
165 ///
166 /// #### `mtu`
167 /// The MTU of the device.
168 ///
169 /// Readable
170 ///
171 ///
172 /// #### `nm-plugin-missing`
173 /// When [`true`] indicates that the NetworkManager plugin for the device
174 /// is not installed.
175 ///
176 /// Readable
177 ///
178 ///
179 /// #### `path`
180 /// The device path as exposed by the udev property ID_PATH.
181 ///
182 /// The string is backslash escaped (C escaping) for invalid
183 /// characters. The escaping can be reverted with g_strcompress(),
184 /// however the result may not be valid UTF-8.
185 ///
186 /// Readable
187 ///
188 ///
189 /// #### `physical-port-id`
190 /// The physical port ID of the device. (See
191 /// nm_device_get_physical_port_id().)
192 ///
193 /// Readable
194 ///
195 ///
196 /// #### `ports`
197 /// The port devices of the controller device. For devices that cannot be
198 /// controllers this is likely to be always empty.
199 ///
200 /// Readable
201 ///
202 ///
203 /// #### `product`
204 /// The product string of the device.
205 ///
206 /// Readable
207 ///
208 ///
209 /// #### `real`
210 /// Whether the device is real or is a placeholder device that could
211 /// be created automatically by NetworkManager if one of its
212 /// #NMDevice:available-connections was activated.
213 ///
214 /// Readable
215 ///
216 ///
217 /// #### `state`
218 /// The state of the device.
219 ///
220 /// Readable
221 ///
222 ///
223 /// #### `state-reason`
224 /// The reason for the device state.
225 ///
226 /// Readable
227 ///
228 ///
229 /// #### `udi`
230 /// An operating-system specific device hardware identifier; this is not
231 /// unique to a specific hardware device across reboots or hotplugs. It
232 /// is an opaque string which for some device types (Bluetooth, Modem)
233 /// contains an identifier provided by the underlying hardware service daemon
234 /// such as Bluez or ModemManager, and clients can use this property to
235 /// request more information about the device from those services.
236 ///
237 /// Readable
238 ///
239 ///
240 /// #### `vendor`
241 /// The vendor string of the device.
242 ///
243 /// Readable
244 /// </details>
245 /// <details><summary><h4>Object</h4></summary>
246 ///
247 ///
248 /// #### `client`
249 /// The NMClient instance as returned by nm_object_get_client().
250 ///
251 /// When an NMObject gets removed from the NMClient cache,
252 /// the NMObject:path property stays unchanged, but this client
253 /// instance gets reset to [`None`]. You can use this property to
254 /// track removal of the object from the cache.
255 ///
256 /// Readable
257 ///
258 ///
259 /// #### `path`
260 /// The D-Bus object path.
261 ///
262 /// The D-Bus path of an object instance never changes, even if the object
263 /// gets removed from the cache. To see whether the object is still in the
264 /// cache, check NMObject:client.
265 ///
266 /// Readable
267 /// </details>
268 ///
269 /// # Implements
270 ///
271 /// [`DeviceExt`][trait@crate::prelude::DeviceExt], [`ObjectExt`][trait@crate::prelude::ObjectExt]
272 #[doc(alias = "NMDeviceOlpcMesh")]
273 pub struct DeviceOlpcMesh(Object<ffi::NMDeviceOlpcMesh, ffi::NMDeviceOlpcMeshClass>) @extends Device, Object;
274
275 match fn {
276 type_ => || ffi::nm_device_olpc_mesh_get_type(),
277 }
278}
279
280impl DeviceOlpcMesh {
281 // rustdoc-stripper-ignore-next
282 /// Creates a new builder-pattern struct instance to construct [`DeviceOlpcMesh`] objects.
283 ///
284 /// This method returns an instance of [`DeviceOlpcMeshBuilder`](crate::builders::DeviceOlpcMeshBuilder) which can be used to create [`DeviceOlpcMesh`] objects.
285 pub fn builder() -> DeviceOlpcMeshBuilder {
286 DeviceOlpcMeshBuilder::new()
287 }
288
289
290 /// Returns the active channel of the #NMDeviceOlpcMesh device.
291 ///
292 /// # Returns
293 ///
294 /// active channel of the device
295 #[doc(alias = "nm_device_olpc_mesh_get_active_channel")]
296 #[doc(alias = "get_active_channel")]
297 #[doc(alias = "active-channel")]
298 pub fn active_channel(&self) -> u32 {
299 unsafe {
300 ffi::nm_device_olpc_mesh_get_active_channel(self.to_glib_none().0)
301 }
302 }
303
304 /// Gets the companion device of the #NMDeviceOlpcMesh.
305 ///
306 /// # Returns
307 ///
308 /// the companion of the device of [`None`]
309 #[doc(alias = "nm_device_olpc_mesh_get_companion")]
310 #[doc(alias = "get_companion")]
311 pub fn companion(&self) -> DeviceWifi {
312 unsafe {
313 from_glib_none(ffi::nm_device_olpc_mesh_get_companion(self.to_glib_none().0))
314 }
315 }
316
317 /// Gets the hardware (MAC) address of the #NMDeviceOlpcMesh
318 ///
319 /// # Deprecated since 1.24
320 ///
321 /// Use nm_device_get_hw_address() instead.
322 ///
323 /// # Returns
324 ///
325 /// the hardware address. This is the internal string used by the
326 /// device, and must not be modified.
327 #[cfg_attr(feature = "v1_24", deprecated = "Since 1.24")]
328 #[allow(deprecated)]
329 #[doc(alias = "nm_device_olpc_mesh_get_hw_address")]
330 #[doc(alias = "get_hw_address")]
331 pub fn hw_address(&self) -> glib::GString {
332 unsafe {
333 from_glib_none(ffi::nm_device_olpc_mesh_get_hw_address(self.to_glib_none().0))
334 }
335 }
336
337 #[doc(alias = "active-channel")]
338 pub fn connect_active_channel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
339 unsafe extern "C" fn notify_active_channel_trampoline<F: Fn(&DeviceOlpcMesh) + 'static>(this: *mut ffi::NMDeviceOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
340 let f: &F = &*(f as *const F);
341 f(&from_glib_borrow(this))
342 }
343 unsafe {
344 let f: Box_<F> = Box_::new(f);
345 connect_raw(self.as_ptr() as *mut _, c"notify::active-channel".as_ptr() as *const _,
346 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_active_channel_trampoline::<F> as *const ())), Box_::into_raw(f))
347 }
348 }
349
350 #[doc(alias = "companion")]
351 pub fn connect_companion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
352 unsafe extern "C" fn notify_companion_trampoline<F: Fn(&DeviceOlpcMesh) + 'static>(this: *mut ffi::NMDeviceOlpcMesh, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
353 let f: &F = &*(f as *const F);
354 f(&from_glib_borrow(this))
355 }
356 unsafe {
357 let f: Box_<F> = Box_::new(f);
358 connect_raw(self.as_ptr() as *mut _, c"notify::companion".as_ptr() as *const _,
359 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_companion_trampoline::<F> as *const ())), Box_::into_raw(f))
360 }
361 }
362}
363
364// rustdoc-stripper-ignore-next
365 /// A [builder-pattern] type to construct [`DeviceOlpcMesh`] objects.
366 ///
367 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
368#[must_use = "The builder must be built to be used"]
369pub struct DeviceOlpcMeshBuilder {
370 builder: glib::object::ObjectBuilder<'static, DeviceOlpcMesh>,
371 }
372
373 impl DeviceOlpcMeshBuilder {
374 fn new() -> Self {
375 Self { builder: glib::object::Object::builder() }
376 }
377
378 /// Whether the device can auto-activate a connection.
379 ///
380 /// The property setter is a synchronous D-Bus call. This is deprecated since 1.22.
381 pub fn autoconnect(self, autoconnect: bool) -> Self {
382 Self { builder: self.builder.property("autoconnect", autoconnect), }
383 }
384
385 // rustdoc-stripper-ignore-next
386 /// Build the [`DeviceOlpcMesh`].
387 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
388 pub fn build(self) -> DeviceOlpcMesh {
389assert_initialized_main_thread!();
390 self.builder.build() }
391}