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