Server/Events/EventHidWindowsMediaCenter.cs
author StephaneLenclud
Thu, 18 Aug 2016 14:35:50 +0200
changeset 238 c92587ddabcd
parent 237 1a1c2ae3a29c
permissions -rw-r--r--
Support for launch action and WMC HID events.
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@238
     6
using System.Runtime.Serialization;
StephaneLenclud@238
     7
using Ear = SharpLib.Ear;
StephaneLenclud@238
     8
using Hid = SharpLib.Hid;
StephaneLenclud@237
     9
StephaneLenclud@238
    10
namespace SharpDisplayManager
StephaneLenclud@237
    11
{
StephaneLenclud@238
    12
    [DataContract]
StephaneLenclud@238
    13
    [Ear.AttributeObject(Id = "Event.Hid.WindowsMediaCenter", Name = "HID Windows Media Center", Description = "Corresponding HID message received.")]
StephaneLenclud@238
    14
    public class EventHidWindowsMediaCenter : Ear.Event
StephaneLenclud@237
    15
    {
StephaneLenclud@238
    16
        public EventHidWindowsMediaCenter()
StephaneLenclud@238
    17
        {
StephaneLenclud@238
    18
        }
StephaneLenclud@238
    19
StephaneLenclud@238
    20
        [DataMember]
StephaneLenclud@238
    21
        [Ear.AttributeObjectProperty
StephaneLenclud@238
    22
            (
StephaneLenclud@238
    23
            Id = "HID.WMC.Usage",
StephaneLenclud@238
    24
            Name = "Usage",
StephaneLenclud@238
    25
            Description = "The usage corresponding to your remote button."
StephaneLenclud@238
    26
            )]
StephaneLenclud@238
    27
        public Hid.Usage.WindowsMediaCenterRemoteControl Usage { get; set; }
StephaneLenclud@238
    28
StephaneLenclud@238
    29
        /// <summary>
StephaneLenclud@238
    30
        /// Make sure we distinguish between various configuration of this event 
StephaneLenclud@238
    31
        /// </summary>
StephaneLenclud@238
    32
        /// <returns></returns>
StephaneLenclud@238
    33
        public override string Brief()
StephaneLenclud@238
    34
        {
StephaneLenclud@238
    35
            return Name + ": " + Usage.ToString();
StephaneLenclud@238
    36
        }
StephaneLenclud@238
    37
StephaneLenclud@238
    38
        /// <summary>
StephaneLenclud@238
    39
        ///
StephaneLenclud@238
    40
        /// </summary>
StephaneLenclud@238
    41
        /// <param name="obj"></param>
StephaneLenclud@238
    42
        /// <returns></returns>
StephaneLenclud@238
    43
        public override bool Equals(object obj)
StephaneLenclud@238
    44
        {
StephaneLenclud@238
    45
            if (obj is EventHidWindowsMediaCenter)
StephaneLenclud@238
    46
            {
StephaneLenclud@238
    47
                EventHidWindowsMediaCenter e = (EventHidWindowsMediaCenter)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@238
    53
        }
StephaneLenclud@238
    54
StephaneLenclud@237
    55
    }
StephaneLenclud@237
    56
}