mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Cosmos.Hardware;
|
|
using Cosmos.Core.Network;
|
|
|
|
namespace Cosmos.Hardware
|
|
{
|
|
public delegate void DataReceivedHandler(byte[] packetData);
|
|
|
|
public abstract class NetworkDevice : Device
|
|
{
|
|
public static List<NetworkDevice> Devices { get; private set; }
|
|
|
|
static NetworkDevice()
|
|
{
|
|
Devices = new List<NetworkDevice>();
|
|
}
|
|
|
|
public DataReceivedHandler DataReceived;
|
|
|
|
protected NetworkDevice()
|
|
{
|
|
//mType = DeviceType.Network;
|
|
Devices.Add(this);
|
|
}
|
|
|
|
public abstract MACAddress MACAddress
|
|
{
|
|
get;
|
|
}
|
|
|
|
public abstract bool Ready
|
|
{
|
|
get;
|
|
}
|
|
|
|
//public DataReceivedHandler DataReceived;
|
|
|
|
public virtual bool QueueBytes(byte[] buffer)
|
|
{
|
|
return QueueBytes(buffer, 0, buffer.Length);
|
|
}
|
|
|
|
public abstract bool QueueBytes(byte[] buffer, int offset, int length);
|
|
|
|
public abstract bool ReceiveBytes(byte[] buffer, int offset, int max);
|
|
public abstract byte[] ReceivePacket();
|
|
|
|
public abstract int BytesAvailable();
|
|
|
|
public abstract bool Enable();
|
|
|
|
public abstract bool IsSendBufferFull();
|
|
public abstract bool IsReceiveBufferFull();
|
|
}
|
|
}
|