Server/Events/EventHidConsumerControl.cs
author Stephane Lenclud
Fri, 19 Aug 2016 17:12:54 +0200
changeset 243 cc2251d065db
parent 237 1a1c2ae3a29c
permissions -rw-r--r--
Optical drive eject action now functional.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 using System.Runtime.Serialization;
     7 using Ear = SharpLib.Ear;
     8 using Hid = SharpLib.Hid;
     9 
    10 namespace SharpDisplayManager
    11 {
    12         [DataContract]
    13         [Ear.AttributeObject(Id = "Event.Hid.ConsumerControl", Name = "HID Consumer Control", Description = "Corresponding HID message received.")]
    14         public class EventHidConsumerControl : Ear.Event
    15         {
    16             public EventHidConsumerControl()
    17             {
    18             }
    19 
    20         [DataMember]
    21         [Ear.AttributeObjectProperty
    22             (
    23             Id = "HID.ConsumerControl.Usage",
    24             Name = "Usage",
    25             Description = "The usage corresponding to your remote button."
    26             )]
    27         public Hid.Usage.ConsumerControl Usage { get; set; }
    28 
    29         /// <summary>
    30         /// Make sure we distinguish between various configuration of this event 
    31         /// </summary>
    32         /// <returns></returns>
    33         public override string Brief()
    34         {
    35             return Name + ": " + Usage.ToString();
    36         }
    37 
    38         /// <summary>
    39         ///
    40         /// </summary>
    41         /// <param name="obj"></param>
    42         /// <returns></returns>
    43         public override bool Equals(object obj)
    44         {
    45             if (obj is EventHidConsumerControl)
    46             {
    47                 EventHidConsumerControl e = (EventHidConsumerControl)obj;
    48                 bool res = (e.Usage == Usage);
    49                 return res;
    50             }
    51 
    52             return false;
    53         }
    54     }
    55 }