zaura_shell_client_protocol/
zaura_shell_client_protocol.rs

1// GENERATED FILE -- DO NOT EDIT
2//
3// Copyright 2017 The Chromium Authors.
4// 
5// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"),
7// to deal in the Software without restriction, including without limitation
8// the rights to use, copy, modify, merge, publish, distribute, sublicense,
9// and/or sell copies of the Software, and to permit persons to whom the
10// Software is furnished to do so, subject to the following conditions:
11// 
12// The above copyright notice and this permission notice (including the next
13// paragraph) shall be included in all copies or substantial portions of the
14// 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
19// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22// DEALINGS IN THE SOFTWARE.
23
24#![allow(warnings)]
25#![allow(clippy::all)]
26use anyhow;
27#[allow(unused_imports)]
28use fuchsia_wayland_core::{Array, Enum, Fixed, NewId, NewObject};
29use fuchsia_wayland_core::{ArgKind, Arg, FromArgs, IntoMessage, Message,
30                            MessageGroupSpec, MessageHeader, MessageSpec, MessageType,
31                            ObjectId, EncodeError, DecodeError, Interface};
32pub mod zaura_shell {
33use super::*;
34
35/// aura_shell
36///
37/// The global interface exposing aura shell capabilities is used to
38/// instantiate an interface extension for a wl_surface object.
39/// This extended interface will then allow the client to use aura shell
40/// specific functionality.
41#[derive(Debug)]
42pub struct ZauraShell;
43
44impl Interface for ZauraShell {
45    const NAME: &'static str = "zaura_shell";
46    const VERSION: u32 = 8;
47    const REQUESTS: MessageGroupSpec = MessageGroupSpec(&[
48        // get_aura_surface
49        MessageSpec(&[
50            ArgKind::NewId,
51            ArgKind::Object,
52        ]),
53        // get_aura_output
54        MessageSpec(&[
55            ArgKind::NewId,
56            ArgKind::Object,
57        ]),
58    ]);
59    const EVENTS: MessageGroupSpec = MessageGroupSpec(&[
60    ]);
61    type Incoming = Event;
62    type Outgoing = Request;
63}
64
65#[derive(Debug)]
66pub enum Request {
67
68    /// extend surface interface for aura shell
69    ///
70    /// Instantiate an interface extension for the given wl_surface to
71    /// provide aura shell functionality. If the given wl_surface is not
72    /// associated with a shell surface, the shell_surface_missing protocol
73    /// error is raised.
74    GetAuraSurface {
75        /// the new aura surface interface id
76        id: NewId,
77        /// the surface
78        surface: ObjectId,
79    },
80
81    /// extend output interface for aura shell
82    ///
83    /// Instantiate an interface extension for the given wl_output to
84    /// provide aura shell functionality.
85    GetAuraOutput {
86        /// the new aura output interface id
87        id: NewId,
88        /// the output
89        output: ObjectId,
90    },
91}
92
93impl MessageType for Request {
94    fn log(&self, this: ObjectId) -> String {
95        match *self {
96            Request::GetAuraSurface {
97                ref id,
98                ref surface,
99            } => {
100                format!("zaura_shell@{:?}::get_aura_surface(id: {:?}, surface: {:?})", this, id, surface)
101            }
102            Request::GetAuraOutput {
103                ref id,
104                ref output,
105            } => {
106                format!("zaura_shell@{:?}::get_aura_output(id: {:?}, output: {:?})", this, id, output)
107            }
108        }
109    }
110    fn message_name(&self) -> &'static std::ffi::CStr{
111        match *self {
112            Request::GetAuraSurface { .. } => c"zaura_shell::get_aura_surface",
113            Request::GetAuraOutput { .. } => c"zaura_shell::get_aura_output",
114        }
115    }
116}
117#[derive(Debug)]
118pub enum Event {
119}
120
121impl MessageType for Event {
122    fn log(&self, this: ObjectId) -> String {
123        match *self {
124        }
125    }
126    fn message_name(&self) -> &'static std::ffi::CStr{
127        match *self {
128        }
129    }
130}
131impl IntoMessage for Request {
132    type Error = EncodeError;
133    fn into_message(self, id: u32) -> Result<Message, <Self as IntoMessage>::Error> {
134        let mut header = MessageHeader {
135            sender: id,
136            opcode: 0,
137            length: 0,
138        };
139        let mut msg = Message::new();
140        msg.write_header(&header)?;
141        match self {
142        Request::GetAuraSurface {
143            id,
144            surface,
145        } => {
146            msg.write_arg(Arg::NewId(id))?;
147            msg.write_arg(Arg::Object(surface))?;
148            header.opcode = 0;
149        },
150        Request::GetAuraOutput {
151            id,
152            output,
153        } => {
154            msg.write_arg(Arg::NewId(id))?;
155            msg.write_arg(Arg::Object(output))?;
156            header.opcode = 1;
157        },
158        }
159        header.length = msg.bytes().len() as u16;
160        msg.rewind();
161        msg.write_header(&header)?;
162        Ok(msg)
163    }
164}
165impl FromArgs for Event {
166    fn from_args(op: u16, mut args: Vec<Arg>) -> Result<Self, anyhow::Error> {
167        match op {
168        _ => {
169            Err(DecodeError::InvalidOpcode(op).into())
170        },
171        }
172    }
173}
174#[derive(Copy, Clone, Debug, Eq, PartialEq)]
175#[repr(u32)]
176pub enum Error {
177    /// the surface already has an aura surface object associated,
178    AuraSurfaceExists = 0,
179    /// the output already has an aura output object associated,
180    AuraOutputExists = 1,
181}
182
183impl Error {
184    pub fn from_bits(v: u32) -> Option<Self> {
185        match v {
186        0 => Some(Error::AuraSurfaceExists),
187        1 => Some(Error::AuraOutputExists),
188        _ => None,
189        }
190    }
191
192    pub fn bits(&self) -> u32 {
193        *self as u32
194    }
195}
196impl Into<Arg> for Error {
197    fn into(self) -> Arg {
198        Arg::Uint(self.bits())
199    }
200}
201} // mod zaura_shell
202
203pub use crate::zaura_shell::ZauraShell;
204pub use crate::zaura_shell::Request as ZauraShellRequest;
205pub use crate::zaura_shell::Event as ZauraShellEvent;
206pub mod zaura_surface {
207use super::*;
208
209/// aura shell interface to a wl_surface
210///
211/// An additional interface to a wl_surface object, which allows the
212/// client to access aura shell specific functionality for surface.
213#[derive(Debug)]
214pub struct ZauraSurface;
215
216impl Interface for ZauraSurface {
217    const NAME: &'static str = "zaura_surface";
218    const VERSION: u32 = 8;
219    const REQUESTS: MessageGroupSpec = MessageGroupSpec(&[
220        // set_frame
221        MessageSpec(&[
222            ArgKind::Uint,
223        ]),
224        // set_parent
225        MessageSpec(&[
226            ArgKind::Object,
227            ArgKind::Int,
228            ArgKind::Int,
229        ]),
230        // set_frame_colors
231        MessageSpec(&[
232            ArgKind::Uint,
233            ArgKind::Uint,
234        ]),
235        // set_startup_id
236        MessageSpec(&[
237            ArgKind::String,
238        ]),
239        // set_application_id
240        MessageSpec(&[
241            ArgKind::String,
242        ]),
243        // set_client_surface_id
244        MessageSpec(&[
245            ArgKind::Int,
246        ]),
247        // set_occlusion_tracking
248        MessageSpec(&[
249        ]),
250        // unset_occlusion_tracking
251        MessageSpec(&[
252        ]),
253    ]);
254    const EVENTS: MessageGroupSpec = MessageGroupSpec(&[
255        // occlusion_changed
256        MessageSpec(&[
257            ArgKind::Fixed,
258            ArgKind::Uint,
259        ]),
260    ]);
261    type Incoming = Event;
262    type Outgoing = Request;
263}
264
265#[derive(Debug)]
266pub enum Request {
267
268    /// request a frame for surface
269    ///
270    /// Suggests a surface should use a specific frame.
271    SetFrame {
272        /// the new frame type
273        type_: u32,
274    },
275
276    /// set the parent of this surface
277    ///
278    /// Set the "parent" of this surface. "x" and "y" arguments specify the
279    /// initial position for surface relative to parent.
280    SetParent {
281        parent: ObjectId,
282        x: i32,
283        y: i32,
284    },
285
286    /// set the frame colors of this surface
287    ///
288    /// Set the frame colors.
289    SetFrameColors {
290        /// 32 bit ARGB color value, not premultiplied
291        active_color: u32,
292        /// 32 bit ARGB color value, not premultiplied
293        inactive_color: u32,
294    },
295
296    /// set the startup ID of this surface
297    ///
298    /// Set the startup ID.
299    SetStartupId {
300        startup_id: String,
301    },
302
303    /// set the application ID of this surface
304    ///
305    /// Set the application ID.
306    SetApplicationId {
307        application_id: String,
308    },
309
310    /// set the client surface ID of this surface
311    ///
312    /// Set the identifier of the surface assigned by the client.
313    SetClientSurfaceId {
314        client_surface_id: i32,
315    },
316
317    /// set tracked occlusion region
318    ///
319    /// Sets occlusion tracking on this surface. The client will be updated with a
320    /// new occlusion fraction when the amount of occlusion of this surface changes.
321    SetOcclusionTracking,
322
323    /// unset tracked occlusion region
324    ///
325    /// Unsets occlusion tracking for this surface.
326    UnsetOcclusionTracking,
327}
328
329impl MessageType for Request {
330    fn log(&self, this: ObjectId) -> String {
331        match *self {
332            Request::SetFrame {
333                ref type_,
334            } => {
335                format!("zaura_surface@{:?}::set_frame(type: {:?})", this, type_)
336            }
337            Request::SetParent {
338                ref parent,
339                ref x,
340                ref y,
341            } => {
342                format!("zaura_surface@{:?}::set_parent(parent: {:?}, x: {:?}, y: {:?})", this, parent, x, y)
343            }
344            Request::SetFrameColors {
345                ref active_color,
346                ref inactive_color,
347            } => {
348                format!("zaura_surface@{:?}::set_frame_colors(active_color: {:?}, inactive_color: {:?})", this, active_color, inactive_color)
349            }
350            Request::SetStartupId {
351                ref startup_id,
352            } => {
353                format!("zaura_surface@{:?}::set_startup_id(startup_id: {:?})", this, startup_id)
354            }
355            Request::SetApplicationId {
356                ref application_id,
357            } => {
358                format!("zaura_surface@{:?}::set_application_id(application_id: {:?})", this, application_id)
359            }
360            Request::SetClientSurfaceId {
361                ref client_surface_id,
362            } => {
363                format!("zaura_surface@{:?}::set_client_surface_id(client_surface_id: {:?})", this, client_surface_id)
364            }
365            Request::SetOcclusionTracking {
366            } => {
367                format!("zaura_surface@{:?}::set_occlusion_tracking()", this)
368            }
369            Request::UnsetOcclusionTracking {
370            } => {
371                format!("zaura_surface@{:?}::unset_occlusion_tracking()", this)
372            }
373        }
374    }
375    fn message_name(&self) -> &'static std::ffi::CStr{
376        match *self {
377            Request::SetFrame { .. } => c"zaura_surface::set_frame",
378            Request::SetParent { .. } => c"zaura_surface::set_parent",
379            Request::SetFrameColors { .. } => c"zaura_surface::set_frame_colors",
380            Request::SetStartupId { .. } => c"zaura_surface::set_startup_id",
381            Request::SetApplicationId { .. } => c"zaura_surface::set_application_id",
382            Request::SetClientSurfaceId { .. } => c"zaura_surface::set_client_surface_id",
383            Request::SetOcclusionTracking { .. } => c"zaura_surface::set_occlusion_tracking",
384            Request::UnsetOcclusionTracking { .. } => c"zaura_surface::unset_occlusion_tracking",
385        }
386    }
387}
388#[derive(Debug)]
389pub enum Event {
390
391    /// Notifies on an occlusion change
392    ///
393    /// Notifies when there is a change in the amount this surface is occluded.
394    /// The occlusion update is sent as a fixed point number from 0 to 1, representing
395    /// the proportion of occlusion.
396    OcclusionChanged {
397        occlusion_fraction: Fixed,
398        occlusion_reason: u32,
399    },
400}
401
402impl MessageType for Event {
403    fn log(&self, this: ObjectId) -> String {
404        match *self {
405            Event::OcclusionChanged {
406                ref occlusion_fraction,
407                ref occlusion_reason,
408            } => {
409                format!("zaura_surface@{:?}::occlusion_changed(occlusion_fraction: {:?}, occlusion_reason: {:?})", this, occlusion_fraction, occlusion_reason)
410            }
411        }
412    }
413    fn message_name(&self) -> &'static std::ffi::CStr{
414        match *self {
415            Event::OcclusionChanged { .. } => c"zaura_surface::occlusion_changed",
416        }
417    }
418}
419impl IntoMessage for Request {
420    type Error = EncodeError;
421    fn into_message(self, id: u32) -> Result<Message, <Self as IntoMessage>::Error> {
422        let mut header = MessageHeader {
423            sender: id,
424            opcode: 0,
425            length: 0,
426        };
427        let mut msg = Message::new();
428        msg.write_header(&header)?;
429        match self {
430        Request::SetFrame {
431            type_,
432        } => {
433            msg.write_arg(Arg::Uint(type_))?;
434            header.opcode = 0;
435        },
436        Request::SetParent {
437            parent,
438            x,
439            y,
440        } => {
441            msg.write_arg(Arg::Object(parent))?;
442            msg.write_arg(Arg::Int(x))?;
443            msg.write_arg(Arg::Int(y))?;
444            header.opcode = 1;
445        },
446        Request::SetFrameColors {
447            active_color,
448            inactive_color,
449        } => {
450            msg.write_arg(Arg::Uint(active_color))?;
451            msg.write_arg(Arg::Uint(inactive_color))?;
452            header.opcode = 2;
453        },
454        Request::SetStartupId {
455            startup_id,
456        } => {
457            msg.write_arg(Arg::String(startup_id))?;
458            header.opcode = 3;
459        },
460        Request::SetApplicationId {
461            application_id,
462        } => {
463            msg.write_arg(Arg::String(application_id))?;
464            header.opcode = 4;
465        },
466        Request::SetClientSurfaceId {
467            client_surface_id,
468        } => {
469            msg.write_arg(Arg::Int(client_surface_id))?;
470            header.opcode = 5;
471        },
472        Request::SetOcclusionTracking {
473        } => {
474            header.opcode = 6;
475        },
476        Request::UnsetOcclusionTracking {
477        } => {
478            header.opcode = 7;
479        },
480        }
481        header.length = msg.bytes().len() as u16;
482        msg.rewind();
483        msg.write_header(&header)?;
484        Ok(msg)
485    }
486}
487impl FromArgs for Event {
488    fn from_args(op: u16, mut args: Vec<Arg>) -> Result<Self, anyhow::Error> {
489        match op {
490        0 /* occlusion_changed */ => {
491            let mut iter = args.into_iter();
492            Ok(Event::OcclusionChanged {
493                occlusion_fraction: iter.next()
494                                             .ok_or(DecodeError::InsufficientArgs)?
495                                             .as_fixed()?.into(),
496                occlusion_reason: iter.next()
497                                             .ok_or(DecodeError::InsufficientArgs)?
498                                             .as_uint()?,
499
500            })
501        },
502        _ => {
503            Err(DecodeError::InvalidOpcode(op).into())
504        },
505        }
506    }
507}
508
509/// different frame types
510///
511/// Frame types that can be used to decorate a surface.
512#[derive(Copy, Clone, Debug, Eq, PartialEq)]
513#[repr(u32)]
514pub enum FrameType {
515    /// no frame,
516    None = 0,
517    /// caption with shadow,
518    Normal = 1,
519    /// shadow only,
520    Shadow = 2,
521}
522
523impl FrameType {
524    pub fn from_bits(v: u32) -> Option<Self> {
525        match v {
526        0 => Some(FrameType::None),
527        1 => Some(FrameType::Normal),
528        2 => Some(FrameType::Shadow),
529        _ => None,
530        }
531    }
532
533    pub fn bits(&self) -> u32 {
534        *self as u32
535    }
536}
537impl Into<Arg> for FrameType {
538    fn into(self) -> Arg {
539        Arg::Uint(self.bits())
540    }
541}
542
543/// occlusion change reason
544///
545/// Enum describing why an occlusion change happened. An occlusion change as a
546/// result of a user action could include things like the user moving a window,
547/// changing occlusion, or opening/closing a window, changing the occlusion.
548#[derive(Copy, Clone, Debug, Eq, PartialEq)]
549#[repr(u32)]
550pub enum OcclusionChangeReason {
551    /// occlusion changed as a result of a user action,
552    UserAction = 1,
553}
554
555impl OcclusionChangeReason {
556    pub fn from_bits(v: u32) -> Option<Self> {
557        match v {
558        1 => Some(OcclusionChangeReason::UserAction),
559        _ => None,
560        }
561    }
562
563    pub fn bits(&self) -> u32 {
564        *self as u32
565    }
566}
567impl Into<Arg> for OcclusionChangeReason {
568    fn into(self) -> Arg {
569        Arg::Uint(self.bits())
570    }
571}
572} // mod zaura_surface
573
574pub use crate::zaura_surface::ZauraSurface;
575pub use crate::zaura_surface::Request as ZauraSurfaceRequest;
576pub use crate::zaura_surface::Event as ZauraSurfaceEvent;
577pub mod zaura_output {
578use super::*;
579
580/// aura shell interface to a wl_output
581///
582/// An additional interface to a wl_output object, which allows the
583/// client to access aura shell specific functionality for output.
584#[derive(Debug)]
585pub struct ZauraOutput;
586
587impl Interface for ZauraOutput {
588    const NAME: &'static str = "zaura_output";
589    const VERSION: u32 = 6;
590    const REQUESTS: MessageGroupSpec = MessageGroupSpec(&[
591    ]);
592    const EVENTS: MessageGroupSpec = MessageGroupSpec(&[
593        // scale
594        MessageSpec(&[
595            ArgKind::Uint,
596            ArgKind::Uint,
597        ]),
598        // connection
599        MessageSpec(&[
600            ArgKind::Uint,
601        ]),
602        // device_scale_factor
603        MessageSpec(&[
604            ArgKind::Uint,
605        ]),
606    ]);
607    type Incoming = Event;
608    type Outgoing = Request;
609}
610
611#[derive(Debug)]
612pub enum Request {
613}
614
615impl MessageType for Request {
616    fn log(&self, this: ObjectId) -> String {
617        match *self {
618        }
619    }
620    fn message_name(&self) -> &'static std::ffi::CStr{
621        match *self {
622        }
623    }
624}
625#[derive(Debug)]
626pub enum Event {
627
628    /// advertise available scales for the output
629    ///
630    /// The scale event describes an available scale for the output.
631    /// 
632    /// The event is sent when binding to the output object and there
633    /// will always be one scale, the current scale. The event is sent
634    /// again if an output changes scale, for the scale that is now
635    /// current. In other words, the current scale is always the last
636    /// scale that was received with the current flag set.
637    Scale {
638        /// bitfield of scale flags
639        flags: Enum<ScaleProperty>,
640        /// output scale
641        scale: Enum<ScaleFactor>,
642    },
643
644    /// advertise connection for the output
645    ///
646    /// The connection event describes how the output is connected.
647    /// 
648    /// The event is sent when binding to the output object.
649    Connection {
650        /// output connection
651        connection: Enum<ConnectionType>,
652    },
653
654    /// advertise device scale factor for the output
655    ///
656    /// This event describes the device specific scale factor for the output.
657    /// 
658    /// The device specific scale factor is not expected the change during
659    /// the lifetime of the output. And it is not limited to an integer value
660    /// like the scale factor provided by wl_output interface. The exact
661    /// contents scale used by the compositor can be determined by combining
662    /// this device scale factor with the current output scale.
663    /// 
664    /// The event is sent when binding to the output object.
665    DeviceScaleFactor {
666        /// output device scale factor
667        scale: Enum<ScaleFactor>,
668    },
669}
670
671impl MessageType for Event {
672    fn log(&self, this: ObjectId) -> String {
673        match *self {
674            Event::Scale {
675                ref flags,
676                ref scale,
677            } => {
678                format!("zaura_output@{:?}::scale(flags: {:?}, scale: {:?})", this, flags, scale)
679            }
680            Event::Connection {
681                ref connection,
682            } => {
683                format!("zaura_output@{:?}::connection(connection: {:?})", this, connection)
684            }
685            Event::DeviceScaleFactor {
686                ref scale,
687            } => {
688                format!("zaura_output@{:?}::device_scale_factor(scale: {:?})", this, scale)
689            }
690        }
691    }
692    fn message_name(&self) -> &'static std::ffi::CStr{
693        match *self {
694            Event::Scale { .. } => c"zaura_output::scale",
695            Event::Connection { .. } => c"zaura_output::connection",
696            Event::DeviceScaleFactor { .. } => c"zaura_output::device_scale_factor",
697        }
698    }
699}
700impl IntoMessage for Request {
701    type Error = EncodeError;
702    fn into_message(self, id: u32) -> Result<Message, <Self as IntoMessage>::Error> {
703        let mut header = MessageHeader {
704            sender: id,
705            opcode: 0,
706            length: 0,
707        };
708        let mut msg = Message::new();
709        msg.write_header(&header)?;
710        match self {
711        }
712        header.length = msg.bytes().len() as u16;
713        msg.rewind();
714        msg.write_header(&header)?;
715        Ok(msg)
716    }
717}
718impl FromArgs for Event {
719    fn from_args(op: u16, mut args: Vec<Arg>) -> Result<Self, anyhow::Error> {
720        match op {
721        0 /* scale */ => {
722            let mut iter = args.into_iter();
723            Ok(Event::Scale {
724                flags: iter.next()
725                                             .ok_or(DecodeError::InsufficientArgs)?
726                                             .as_uint().map(|i| match ScaleProperty::from_bits(i) {
727                                      Some(e) => Enum::Recognized(e),
728                                      None => Enum::Unrecognized(i),
729                                 })?,
730                scale: iter.next()
731                                             .ok_or(DecodeError::InsufficientArgs)?
732                                             .as_uint().map(|i| match ScaleFactor::from_bits(i) {
733                                      Some(e) => Enum::Recognized(e),
734                                      None => Enum::Unrecognized(i),
735                                 })?,
736
737            })
738        },
739        1 /* connection */ => {
740            let mut iter = args.into_iter();
741            Ok(Event::Connection {
742                connection: iter.next()
743                                             .ok_or(DecodeError::InsufficientArgs)?
744                                             .as_uint().map(|i| match ConnectionType::from_bits(i) {
745                                      Some(e) => Enum::Recognized(e),
746                                      None => Enum::Unrecognized(i),
747                                 })?,
748
749            })
750        },
751        2 /* device_scale_factor */ => {
752            let mut iter = args.into_iter();
753            Ok(Event::DeviceScaleFactor {
754                scale: iter.next()
755                                             .ok_or(DecodeError::InsufficientArgs)?
756                                             .as_uint().map(|i| match ScaleFactor::from_bits(i) {
757                                      Some(e) => Enum::Recognized(e),
758                                      None => Enum::Unrecognized(i),
759                                 })?,
760
761            })
762        },
763        _ => {
764            Err(DecodeError::InvalidOpcode(op).into())
765        },
766        }
767    }
768}
769::bitflags::bitflags! {
770
771    /// scale information
772    ///
773    /// These flags describe properties of an output scale.
774    /// They are used in the flags bitfield of the scale event.
775    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
776    pub struct ScaleProperty: u32 {
777        /// indicates this is the current scale,
778        const Current = 1;
779        /// indicates this is the preferred scale,
780        const Preferred = 2;
781    }
782}
783impl Into<Arg> for ScaleProperty {
784    fn into(self) -> Arg {
785        Arg::Uint(self.bits())
786    }
787}
788#[derive(Copy, Clone, Debug, Eq, PartialEq)]
789#[repr(u32)]
790pub enum ScaleFactor {
791    _0400 = 400,
792    _0500 = 500,
793    _0550 = 550,
794    _0600 = 600,
795    _0625 = 625,
796    _0650 = 650,
797    _0700 = 700,
798    _0750 = 750,
799    _0800 = 800,
800    _0850 = 850,
801    _0900 = 900,
802    _0950 = 950,
803    _1000 = 1000,
804    _1050 = 1050,
805    _1100 = 1100,
806    _1150 = 1150,
807    _1125 = 1125,
808    _1200 = 1200,
809    _1250 = 1250,
810    _1300 = 1300,
811    _1400 = 1400,
812    _1450 = 1450,
813    _1500 = 1500,
814    _1600 = 1600,
815    _1750 = 1750,
816    _1800 = 1800,
817    _2000 = 2000,
818    _2200 = 2200,
819    _2250 = 2250,
820    _2500 = 2500,
821    _2750 = 2750,
822    _3000 = 3000,
823    _3500 = 3500,
824    _4000 = 4000,
825    _4500 = 4500,
826    _5000 = 5000,
827}
828
829impl ScaleFactor {
830    pub fn from_bits(v: u32) -> Option<Self> {
831        match v {
832        400 => Some(ScaleFactor::_0400),
833        500 => Some(ScaleFactor::_0500),
834        550 => Some(ScaleFactor::_0550),
835        600 => Some(ScaleFactor::_0600),
836        625 => Some(ScaleFactor::_0625),
837        650 => Some(ScaleFactor::_0650),
838        700 => Some(ScaleFactor::_0700),
839        750 => Some(ScaleFactor::_0750),
840        800 => Some(ScaleFactor::_0800),
841        850 => Some(ScaleFactor::_0850),
842        900 => Some(ScaleFactor::_0900),
843        950 => Some(ScaleFactor::_0950),
844        1000 => Some(ScaleFactor::_1000),
845        1050 => Some(ScaleFactor::_1050),
846        1100 => Some(ScaleFactor::_1100),
847        1150 => Some(ScaleFactor::_1150),
848        1125 => Some(ScaleFactor::_1125),
849        1200 => Some(ScaleFactor::_1200),
850        1250 => Some(ScaleFactor::_1250),
851        1300 => Some(ScaleFactor::_1300),
852        1400 => Some(ScaleFactor::_1400),
853        1450 => Some(ScaleFactor::_1450),
854        1500 => Some(ScaleFactor::_1500),
855        1600 => Some(ScaleFactor::_1600),
856        1750 => Some(ScaleFactor::_1750),
857        1800 => Some(ScaleFactor::_1800),
858        2000 => Some(ScaleFactor::_2000),
859        2200 => Some(ScaleFactor::_2200),
860        2250 => Some(ScaleFactor::_2250),
861        2500 => Some(ScaleFactor::_2500),
862        2750 => Some(ScaleFactor::_2750),
863        3000 => Some(ScaleFactor::_3000),
864        3500 => Some(ScaleFactor::_3500),
865        4000 => Some(ScaleFactor::_4000),
866        4500 => Some(ScaleFactor::_4500),
867        5000 => Some(ScaleFactor::_5000),
868        _ => None,
869        }
870    }
871
872    pub fn bits(&self) -> u32 {
873        *self as u32
874    }
875}
876impl Into<Arg> for ScaleFactor {
877    fn into(self) -> Arg {
878        Arg::Uint(self.bits())
879    }
880}
881#[derive(Copy, Clone, Debug, Eq, PartialEq)]
882#[repr(u32)]
883pub enum ConnectionType {
884    Unknown = 0,
885    Internal = 1,
886}
887
888impl ConnectionType {
889    pub fn from_bits(v: u32) -> Option<Self> {
890        match v {
891        0 => Some(ConnectionType::Unknown),
892        1 => Some(ConnectionType::Internal),
893        _ => None,
894        }
895    }
896
897    pub fn bits(&self) -> u32 {
898        *self as u32
899    }
900}
901impl Into<Arg> for ConnectionType {
902    fn into(self) -> Arg {
903        Arg::Uint(self.bits())
904    }
905}
906} // mod zaura_output
907
908pub use crate::zaura_output::ZauraOutput;
909pub use crate::zaura_output::Request as ZauraOutputRequest;
910pub use crate::zaura_output::Event as ZauraOutputEvent;