1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FObjBase
{
public interface IFConn
{
/// <summary>
/// 连接状态改变
/// </summary>
ConnectHandler ConnectAction { get; set; }
/// <summary>
/// 协议翻译器
/// </summary>
ParsePacketHandler ParsePacket { get; set; }
/// <summary>
/// 已经成功连接上
/// </summary>
bool IsConnected { get; }
/// <summary>
/// 运行中
/// </summary>
bool IsRunning { get; }
/// <summary>
/// 开始运行
/// </summary>
void Start();
/// <summary>
/// 结束运行
/// </summary>
void Stop();
/// <summary>
/// IsRunning = false 事件
/// </summary>
event ClosedHandler Closed;
bool HasCRC { get; set; }
/// <summary>
/// 发送数据
/// </summary>
/// <param name="buffer"></param>
void SendPacket(byte[] buffer);
}
public delegate void ConnectHandler(IFConn conn);
public delegate void ClosedHandler(IFConn conn);
}