// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable MemberCanBePrivate.Global
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using CUE.NET.Devices.Generic;
using CUE.NET.Devices.Headset.Enums;
namespace CUE.NET.Devices.Headset
{
///
/// Represents the SDK for a corsair headset.
///
public class CorsairHeadset : AbstractCueDevice, IEnumerable
{
#region Properties & Fields
#region Indexer
///
/// Gets the with the specified ID.
///
/// The ID of the LED to get.
/// The LED with the specified ID.
/// is null.
public CorsairLed this[CorsairHeadsetLedId ledId]
{
get
{
CorsairLed led;
return base.Leds.TryGetValue((int)ledId, out led) ? led : null;
}
}
#endregion
///
/// Gets specific information provided by CUE for the headset.
///
public CorsairHeadsetDeviceInfo HeadsetDeviceInfo { get; }
///
/// Indicates if the headset has an active effect to deal with.
///
protected override bool HasEffect => false;
///
/// Gets a read-only collection containing all LEDs of the headset.
///
public new IEnumerable Leds => new ReadOnlyCollection(base.Leds.Values.ToList());
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The specific information provided by CUE for the headset
internal CorsairHeadset(CorsairHeadsetDeviceInfo info)
: base(info)
{
this.HeadsetDeviceInfo = info;
InitializeLeds();
}
#endregion
#region Methods
private void InitializeLeds()
{
GetLed((int)CorsairHeadsetLedId.LeftLogo);
GetLed((int)CorsairHeadsetLedId.RightLogo);
}
#region IEnumerable
///
/// Returns an enumerator that iterates over all LEDs of the headset.
///
/// An enumerator for all LDS of the headset.
public IEnumerator GetEnumerator()
{
return Leds.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
#endregion
}
}