using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using EonaCat.HID.EventArguments;
using EonaCat.HID.Models;
namespace EonaCat.HID
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
///
/// Interface abstraction for a HID device.
///
public interface IHid : IDisposable
{
string DevicePath { get; }
ushort VendorId { get; }
ushort ProductId { get; }
string SerialNumber { get; }
string Manufacturer { get; }
string ProductName { get; }
int InputReportByteLength { get; }
int OutputReportByteLength { get; }
int FeatureReportByteLength { get; }
bool IsConnected { get;}
bool IsReadingSupport { get; }
bool IsWritingSupport { get; }
IDictionary Capabilities { get; }
///
/// Opens the device for communication
///
void Open();
///
/// Closes the device
///
void Close();
///
/// Writes an output report to the device
///
/// Complete report data including ReportID
Task WriteOutputReportAsync(HidReport report);
///
/// Reads an input report
///
/// Input report data
Task ReadInputReportAsync();
///
/// Sends a feature report
///
/// Complete feature report data including ReportID
Task SendFeatureReportAsync(HidReport report);
///
/// Gets a feature report
///
/// Feature report data
Task GetFeatureReportAsync(byte reportId);
///
/// Asynchronously read input reports and raise OnDataReceived event
///
///
Task StartListeningAsync(CancellationToken cancellationToken);
///
/// Occurs when data is received from the device asynchronously
///
event EventHandler OnDataReceived;
///
/// Errors occurring on device operations
///
event EventHandler OnError;
}
}