-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLedDisplay.cs
More file actions
221 lines (176 loc) · 13.8 KB
/
Copy pathLedDisplay.cs
File metadata and controls
221 lines (176 loc) · 13.8 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace RADARMRM
{
class LedDisplay
{
private const string Ddll = "QYLED.dll";
//public delegate void mydelegate(int comMsg);
//串口通讯回调函数
//[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
// public static extern int SetComCallBack(mydelegate TComCallBack);
//设置超时
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern void SetReceiveTimeOut(int nTimeOut);
//设置失败重发次数
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern void SetReSendTimes(int nReSendTimes);
//设置中文编码
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern void SetChnCodeMode(int nCodeMode);
//开启服务(TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int OpenServer(int TIPPort);
//关闭服务(TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int CloseServer();
//发送实时采集(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendCollectionData_Net(string TshowContent, string TIP, int TnetProtocol, int TtypeNo, int TfontColor, int TfontBody, int TfontSize);
//发送实时采集(RS232;RS485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendCollectionData_Com(string TshowContent, string Trs485Address, int TrsType, int TcomPort, int TbaudRate, int TtypeNo, int TfontColor, int TfontBody, int TfontSize);
//实时采集批量发送(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendMulCollectionData_Net(string TshowContent, string TIP, int TnetProtocol, int TtypeNo, int TscreenColor, int TfontColor, int TfontBody, int TfontSize, int TdataIndex, int TdataCount);
//实时采集批量发送(RS232)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendMulCollectionData_Com(string TshowContent, string Trs485Address, int TrsType, int TcomPort, int TtypeNo, int TscreenColor, int TfontColor, int TfontBody, int TfontSize, int TdataIndex, int TdataCount);
//发送内码文字(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern byte SendInternalText_Net(string TshowContent, string TcardIP, int TnetProtocol, int TareaWidth, int TareaHigth, int Tuid, int TscreenColor, int TshowStyle, int TshowSpeed, int TstopTime, int TfontColor, int TfontBody, int TfontSize, int TupdateStyle, bool TpowerOffSave);
//发送内码文字(RS232;RS485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendInternalText_Com(string TshowContent, string Trs485Address, int rsType, int TcomPort, int TbaudRate, int TareaWidth, int TareaHigth, int Tuid, int TscreenColor, int TshowStyle, int TshowSpeed, int TstopTime, int TfontColor, int TfontBody, int TfontSize, int TupdateStyle, bool TpowerOffSave);
//内码文字批量发送(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendMulInternalText_Net(string TshowContent, string TcardIP, int TnetProtocol, int TareaWidth, int TareaHigth, int Tuid, int TscreenColor, int TshowStyle, int TshowSpeed, int TstopTime, int TfontColor, int TfontBody, int TfontSize, int TupdateStyle, bool TpowerOffSave, int TtextIndex, int TtextCount);
//内码文字批量发送(RS232)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendMulInternalText_Com(string TshowContent, string Trs485Address, int rsType, int TcomPort, int TbaudRat, int TareaWidth, int TareaHigth, int Tuid, int TscreenColor, int TshowStyle, int TshowSpeed, int TstopTime, int TfontColor, int TfontBody, int TfontSize, int TupdateStyle, bool TpowerOffSave, int TtextIndex, int TtextCount);
//语音播放(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int PlayVoice_Net(string TplayContent, string TcardIP, string Trs485Address, int TnetProtocol, int TrsPort);
//语音播放(RS232;RS485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int PlayVoice_Com(string TplayContent, string Trs485Address, int TrsType, int TcomPort, int TbaudRate);
//点播显示页(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int PlayShowPage_Net(string TcardIP, int TnetProtocol, int TshowPageNo);
//点播显示页(RS232;RS485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int PlayShowPage_Com(string Trs485Address, int TrsType, int Tcomport, int TbaudRate, int TshowPageNo);
//继电器控制(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int RelaySwitch_Net(string szCardIP, int nNetProtocol, int nCircuitNo, int nSwitchStatus);
//继电器控制(串口;485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int RelaySwitch_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nCircuitNo, int nSwitchStatus);
//发送继电器延时(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int RelayDelay_Net(string szCardIP, int nNetProtocol, int nCircuitNo, int nDelayTime);
//发送继电器延时(串口;485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int RelayDelay_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nCircuitNo, int nDelayTime);
//设置控制卡亮度(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SetBright_Net(string szCardIP, int nNetProtocol, int nPriority, int nBrightValue);
//发送设置亮度(串口)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SetBright_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nPriority, int nBrightValue);
//发送开始播放(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int StartPlay_Net(string szCardIP, int nNetProtocol);
//发送开始播放(串口)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int StartPlay_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate);
//发送停止播放(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int StopPlay_Net(string szCardIP, int nNetProtocol);
//发送停止播放(串口)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int StopPlay_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate);
//发送排队叫号(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendLineUp_Net(string szShowContent, string szCardIP, int nNetProtocol, int nStopTime, int nFontColor, int nLineUpWinAddrNo, bool bLineUpFlash);
//发送排队叫号(串口)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendLineUp_Com(string szShowContent, string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nStopTime, int nFontColor, int nLineUpWinAddrNo, bool bLineUpFlash);
//发送图片组(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendImageGroup_Net(string szImageFilePath, string szCardIP, int nNetProtocol, int nAreaWidth, int nAreaHigth, int nUID, int nScreenColor, int nShowStyle, int nShowSpeed,
int nStopTime, int nUpdateStyle, bool bPowerOffSave, int nImageIndex, int nImageCount);
//发送图片组(串口)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendImageGroup_Com(string szImageFilePath, string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nAreaWidth, int nAreaHigth, int nUID, int nScreenColor, int nShowStyle, int nShowSpeed, int nStopTime, int nUpdateStyle, bool bPowerOffSave, int nImageIndex, int nImageCount);
//点播图片组(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int PlayImageGroup_Net(string szCardIP, int nNetProtocol, int nPlayType, int nItemNum, int nAreaNo, int nImageStartNo, int nImageNum, int nShowStyle, int nShowSpeed,
int nStopTime, bool bUpdateNow, bool nPowerOffSave);
//点播图片组(串口;485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int PlayImageGroup_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nPlayType, int nItemNum, int nAreaNo, int nImageStartNo, int nImageNum, int nShowStyle, int nShowSpeed, int nStopTime, bool bUpdateNow, bool nPowerOffSave);
//发送日期时间(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendDateTime_Net(string szCardIP, int nNetProtocol, int nUID, int nScreenColor, int nNumColor, int nChrColor, int nFontBody, int nFontSize, int nYearLen, int nTimeFormat, int nShowFormat, int nTimeDifSet, int nHourSpan, int nMinSpan, int nStopTime);
//发送日期时间(串口)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendDateTime_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate, int nUID, int nScreenColor, int nNumColor, int nChrColor, int nFontBody, int nFontSize, int nYearLen, int nTimeFormat, int nShowFormat, int nTimeDifSet, int nHourSpan, int nMinSpan, int nStopTime);
//时间校验(UDP;TCP)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int TimeCheck_Net(string szCardIP, int nNetProtocol);
//时间校验(串口;485)
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int TimeCheck_Com(string szRS485Address, int nRSType, int nComPort, int nBaudRate);
//添加显示页
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddShowPage(string szStartTime, string szStopTime, int nWeekDay);
//添加区域
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddArea(int nXPos, int nYPos, int nAreaWidth, int nAreaHigth);
//添加内码文本模板
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddTemplate_InternalText(string szShowContent, int nUID, int nScreenColor, int nShowStyle, int nShowSpeed, int nStopTime, int nFontColor, int nFontBody, int nFontSize, bool bPowerOffSave);
//添加实时采集模板
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddTemplate_CollectData(string szShowContent, int nTypeNo, int nScreenColor, int nFontColor, int nFontBody, int nFontSize);
//添加日期时间模板
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddTemplate_DateTime(int nUID, int nScreenColor, int nNumColor, int nChrColor, int nFontBody, int nFontSize, int nYearLen, int nTimeFormat, int nShowFormat,
int nTimeDifSet, int nHourSpan, int nMinSpan, int nStopTime, bool bPowerOffSave);
//添加图片组模板
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddTemplate_ImageGroup(string szImageFilePaths, int nUID, int nScreenColor, int nShowStyle, int nShowSpeed, int nStopTime);
//添加排队叫号模板
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int AddTemplate_LineUp(string szShowContent, int nStopTime, int nFontColor, int nFontBody, int nFontSize, int nLineUpWinAddrNo, bool bLineUpFlash);
//发送模板
[DllImport(Ddll, CallingConvention = CallingConvention.StdCall)]
public static extern int SendTemplateData_Net(string szCardIP, int nNetProtocol);
Form1 ui;
string ip;
public bool LedReady { get; private set; }
public LedDisplay(Form1 uiForm, string ip)
{
ui = uiForm;
this.ip = ip;
int result;
result = TimeCheck_Net(ip, 1);
if (result == 0)
ui.UpdateStatus("LED时间校准成功");
else
ui.UpdateStatus("LED时间校准失败");
}
public void LedSendSound(string text)
{
SendInternalText_Net(text, ip, 1, 96, 32, 1, 1, 9, 1, 1, 1, 1, 1, 2, false);
}
public void LedSend(string text)
{
PlayVoice_Net(text, ip, "00", 1, 3);
}
}
}