add basic web protocol
This commit is contained in:
50
server/src/WebProtocol.cs
Normal file
50
server/src/WebProtocol.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
namespace WebProtocol
|
||||
{
|
||||
|
||||
public enum PackSign
|
||||
{
|
||||
SendAddr = 0x00,
|
||||
SendData = 0xFF,
|
||||
RecvData = 0x0F,
|
||||
RecvResp = 0xF0,
|
||||
}
|
||||
|
||||
public enum BurstType
|
||||
{
|
||||
ExtendBurst = 0b00,
|
||||
FixedBurst = 0b01,
|
||||
}
|
||||
|
||||
public struct SendAddrPackage
|
||||
{
|
||||
readonly byte Sign = (byte)PackSign.SendAddr;
|
||||
readonly byte commandType;
|
||||
readonly byte burstLength;
|
||||
readonly byte _reserved;
|
||||
readonly UInt32 address;
|
||||
|
||||
|
||||
public SendAddrPackage(BurstType burstType, byte commandID, bool isWrite)
|
||||
{
|
||||
commandType = (
|
||||
((byte)burstType << 5) |
|
||||
((commandID & (byte)0x03) << 3) |
|
||||
(isWrite ? (byte)0x01 : (byte)0x00)
|
||||
);
|
||||
}
|
||||
|
||||
public void toBytes()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public struct RecvRackage
|
||||
{
|
||||
|
||||
public void toBytes()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user