bklLiudl
2024-07-23 675b8bcc4a3630d95e3d0b97d933e63442075ecb
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
using NLog;
using NPOI.SS.Formula.PTG;
using System;
using System.Runtime.InteropServices;
namespace BLL.DAL
{
    public class LedDll
    {
        //颜色值 R 0x0000ff   G 0x00ff00   B 0xff0000
        public const int COLOR_RED = 0xff;          //红色
        public const int COLOR_GREEN = 0xff00;      //绿色
        public const int COLOR_YELLOW = 0xffff;     //黄色
 
        public const int ADDTYPE_STRING = 0;     //添加类型为字符串
        public const int ADDTYPE_FILE = 1;      //添加类型为文件
 
        public const int OK = 0;//函数返回成功
 
        //******节目定时启用日期时间星期的标志宏***************************************************************************
        public const int ENABLE_DATE = 0x01;
        public const int ENABLE_TIME = 0x02;
        public const int ENABLE_WEEK = 0x04;
        //*****************************************************************************************************************
 
        //******节目定时星期里某天启用宏***********************************************************
        public const int WEEK_MON = 0x01;
        public const int WEEK_TUES = 0x02;
        public const int WEEK_WEN = 0x04;
        public const int WEEK_THUR = 0x08;
        public const int WEEK_FRI = 0x10;
        public const int WEEK_SAT = 0x20;
        public const int WEEK_SUN = 0x40;
        //*****************************************************************************
 
        //[StructLayout(LayoutKind.Sequential, Size = 8, CharSet = CharSet.Unicode, Pack = 1)]
 
        //**通讯设置结构体*********************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct COMMUNICATIONINFO
        {
            public int LEDType;                ////LED类型    0.6代T系A系XC系    1.6代E系     2.X1X2        3.7代C系
            public int SendType;                //通讯方式    0.为Tcp发送(又称固定IP通讯),        1.广播发送(又称单机直连)        2.串口通讯        3.磁盘保存     4.广域网通讯
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
            public string IpStr;                //LED屏的IP地址,只有通讯方式为0时才需赋值,其它通讯方式无需赋值
            public int Commport;                //串口号,只有通讯方式为2时才需赋值,其它通讯方式无需赋值
            public int Baud;                    //波特率,只有通讯方式为2时才需赋值,其它通讯方式无需赋值,   0.9600   1.57600   2.115200  直接赋值 9600,19200,38400,57600,115200亦可
            public int LedNumber;                //LED的屏号,只有通讯方式为2时,且用485通讯时才需赋值,其它通讯方式无需赋值
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
            public string OutputDir;    //磁盘保存的目录,只有通讯方式为3时才需赋值,其它通讯方式无需赋值
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)]
            public string networkIdStr;                //网络ID,只有通讯方式为4时才需赋值,其它通讯方式无需赋值
        };
        //***********************************************************************
 
        //**区域坐标结构体*********************************************************
        public struct AREARECT
        {
            public int left;    //区域左上角横坐标
            public int top;    //区域左上角纵坐标
            public int width;    //区域的宽度
            public int height;    //区域的高度
        };
        //****************************************************************************
        //***字体属性结构对**********************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct FONTPROP
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
            public string FontName;        //字体名
            public int FontSize;            //字号(单位磅)
            public int FontColor;            //字体颜色
            public int FontBold;            //是否加粗
            public int FontItalic;            //是否斜体
            public int FontUnderLine;        //时否下划线
        };
        //****************************************************************************
 
        //**页面显示的属性结构体****************************************************
        public struct PLAYPROP
        {
            public int InStyle;    //入场特技值(取值范围 0-38)
            public int OutStyle;    //退场特技值(现无效,预留,置0)
            public int Speed;        //特技显示速度(取值范围1-255) 值越大,速度越慢
            public int DelayTime;    //页面留停时间(1-65535)   注:当入场特技为连续左移、连续右移、连续上移、连续下移时,此参数无效
        };
        /*  特技值对应
            0=立即显示
            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=下雪
         */
        //*******************************************************************************
        //**设置节目定时属性结构体****************************************************
        public struct PROGRAMTIME
        {
            public int EnableFlag;        //启用定时的标记,ENABLE_DATE为启用日期,ENABLE_TIME为启用时间,ENABLE_WEEK为启用星期,可用或运算进行组合,如 ENABLE_DATE | ENABLE_TIME | ENABLE_WEEK
            public int WeekValue;        //启用星期后,选择要定时的星期里的某些天,用宏 WEEK_MON,WEEK_TUES,WEEK_WEN,WEEK_THUR,WEEK_FRI,WEEK_SAT,WEEK_SUN 通过或运算进行组合
            public int StartYear;        //起始年
            public int StartMonth;        //起始月
            public int StartDay;        //起始日
            public int StartHour;        //起姐时
            public int StartMinute;    //起始分
            public int StartSecond;    //起始秒
            public int EndYear;        //结束年
            public int EndMonth;        //结束月
            public int EndDay;            //结束日
            public int EndHour;        //结束时
            public int EndMinute;        //结束分
            public int EndSecond;        //结束秒
        };
        //**********************************************************************************
        //数字时钟属性结构体*********************************************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct DIGITALCLOCKAREAINFO
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string ShowStr;            //自定义显示字符串
            //[MarshalAs(UnmanagedType.Struct)]
            public FONTPROP ShowStrFont;            //自定义显示字符串以及日期星期时间的字体属性,注意此字体属性里的FontColor只对自定义显示字体有效,其它项的颜色有单独的颜色属性,属性的赋值见FONTPROP结构体说明
            public int TimeLagType;            //时差类型 0为超前,1为滞后
            public int HourNum;                //时差小时数    
            public int MiniteNum;                //时差分钟数
            public int DateFormat;                //日期格式 0.YYYY年MM月DD日  1.YY年MM月DD日  2.MM/DD/YYYY  3.YYYY/MM/DD  4.YYYY-MM-DD  5.YYYY.MM.DD  6.MM.DD.YYYY  7.DD.MM.YYYY
            public int DateColor;                //日期字体颜色  格式是16进制 BBGGRR(如:红色0xff 绿色0xff00 黄色0xffff)
            public int WeekFormat;                //星期格式 0.星期X  1.Monday  2.Mon.
            public int WeekColor;                //星期字体颜色
            public int TimeFormat;                //时间格式 0.HH时mm分ss秒  1.HH時mm分ss秒  2.HH:mm:ss  3.上午 HH:mm:ss  4.AM HH:mm:ss  5.HH:mm:ss 上午  6.HH:mm:ss AM
            public int TimeColor;                //时间字体颜色
            public int IsShowYear;                //是否显示年 TRUE为显示 FALSE不显示 下同
            public int IsShowWeek;                //是否显示星期
            public int IsShowMonth;            //是否显示月
            public int IsShowDay;                //是否显示日
            public int IsShowHour;                //是否显示时
            public int IsShowMinute;            //是否显示分
            public int IsShowSecond;            //是否显示秒
            public int IsMutleLineShow;        //是否多行显示
        };
        //******************************************************************************
        //**模拟时钟属性结构体*********************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct CLOCKAREAINFO
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
            public string ShowStr;          //自定义显示字符串
            public FONTPROP ShowStrFont;            //自定义显示字符串字体属性
            public int TimeLagType;         //时差类型 0为超前,1为滞后
            public int HourNum;             //时差小时数
            public int MiniteNum;               //时差分钟数
            public int ClockType;               //表盘类型  0.圆形  1.正方形
            public int HourMarkColor;          //时标颜色    格式是16进制 BBGGRR(如:红色0xff 绿色0xff00 黄色0xffff)
            public int HourMarkType;            //时标类型    0.圆形  1.正方形
            public int HourMarkWidth;           //时标宽度    1~16
            public int MiniteMarkColor;     //分标颜色
            public int MiniteMarkType;          //分标类型    0.圆形  1.正方形
            public int MiniteMarkWidth;     //分标宽度  1~16
            public int HourPointerColor;        //时针颜色
            public int MinutePointerColor;      //分针颜色
            public int SecondPointerColor;      //秒针颜色
            public int HourPointerWidth;        //时针的宽度  1~5
            public int MinutePointerWidth;      //分针的宽度  1~5
            public int SecondPointerWidth;      //秒针的宽度  1~5
            public int IsShowDate;              //是否显示日期    
            public int DateFormat;              //日期格式 0.YYYY年MM月DD日  1.YY年MM月DD日  2.MM/DD/YYYY  3.YYYY/MM/DD  4.YYYY-MM-DD  5.YYYY.MM.DD  6.MM.DD.YYYY  7.DD.MM.YYYY
            public FONTPROP DateFont;               //日期字体属性
            public int IsShowWeek;              //是否显示星期
            public int WeekFormat;              //星期格式 0.星期X  1.Monday  2.Mon.
            public FONTPROP WeekFont;                //星期字体属性
        };
        //**************************************************************************************
 
        //**计时属性结构体**********************************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct TIMEAREAINFO
        {
            public int ShowFormat;              //显示格式    0.xx天xx时xx分xx秒  1.xx天xx時xx分xx秒  2.xxDayxxHourxxMinxxSec  3.XXdXXhXXmXXs  4.xx:xx:xx:xx
            public int nYear;                   //结束年
            public int nMonth;                  //结束月
            public int nDay;                    //结束日
            public int nHour;                   //结束时
            public int nMinute;             //结束分
            public int nSecond;             //结束秒
            public int IsShowDay;               //是否显示天
            public int IsShowHour;              //是否显示时
            public int IsShowMinute;            //是否显示分
            public int IsShowSecond;            //是否显示秒
            public int IsMutleLineShow;        //是否多行显示,指的是自定义文字与计时文字是否分行显示
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
            public string ShowStr;          //自定义文字字符串
            public int TimeStrColor;            //计时文字的颜色
            public FONTPROP ShowFont;                //自定义文字及计时文字颜色,其中FontColor只对文定义文字有效,计时文字颜色为TimeStrColor
        };
        //****************************************************************************************
 
 
        //**LED通讯参数修改结构体*****************************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct LEDCOMMUNICATIONPARAMETER
        {
            public int dwMask;                //要修改项的标记  0.修改网络通讯参数  1.修改串口通讯参数  2.修改网口和串口通讯参数
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
            public string IpStr;            //新的IP地址,只有dwMask为0或2时才需赋值,其它值无需赋值,格式例如 192.168.1.100
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
            public string NetMaskStr;        //新的子网掩码,只有dwMask为0或2时才需赋值,其它值无需赋值,格式例如 255.255.255.0
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
            public string GatewayStr;        //新的网关,只有dwMask为0或2时才需赋值,其它值无需赋值,格式例如 192.168.1.1
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 18)]
            public string MacStr;           //新的MAC地址,只有dwMask为0或2时才需赋值,其它值无需赋值,格式例如 12-34-56-78-9a-bc,如无需修改请设为 ff-ff-ff-ff-ff-ff
            public int Baud;                //波特率,只有dwMask为1或2时才需赋值,其它值无需赋值,0.9600  1.57600  2.115200
            public int LedNumber;            //LED屏号 1~255,网络通讯和232通讯赋值 1 即可,485必需和控制卡显示的屏号相同才可通讯
        };
        //*****************************************************************************************
 
 
        //**流水边框属性结构体************************************************************************
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct WATERBORDERINFO
        {
            public int Flag;                            //流水边框加载类型标志,0.为动态库预置的边框  1.为从文件加载的边框
            public int BorderType;                      //边框的类型,Flag为0是有效,0.单色边框  1.双基色边框  2.全彩边框
            public int BorderValue;                 //边框的值,Flag为0是有效,单色边框取值范围是0~39,双基色边框取值范围是0~34,全彩边框取值范围是0~21
            public int BorderColor;                 //边框线颜色,Flag为0并且BorderType为0是才有效
            public int BorderStyle;                 //边框显示的样式  0.固定  1.顺时针  2.逆时针  3.闪烁
            public int BorderSpeed;//边框流动的速度
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
            public string WaterBorderBmpPath;    //边框图片文件的路径,注意只能是bmp图片,图片大小必需是宽度为32点,取高度小于等于8
        };
        //*********************************************************************************************
 
 
 
        //**定时开关屏设置属性************************************************************************
        public struct ONOFFTIMEINFO
        {
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] TimeFlag;                            //支持3个定时,1代表打开  0关闭
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] StartHour;                            //开始时钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] StartMinute;                        //开始分钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] EndHour;                            //结束时钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] EndMinute;                            //结束分钟
        };
        //********************************************************************************************
 
        //**定时亮度设置属性**************************************************************************
        public struct BRIGHTNESSTIMEINFO
        {
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] TimeFlag;                            //支持3个定时,1代表打开  0关闭
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] StartHour;                            //开始时钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] StartMinute;                        //开始分钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] EndHour;                            //结束时钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] EndMinute;                            //结束分钟
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
            public int[] BrightnessValue;                    //亮度值0~15
        };
        //*******************************************************************************************
 
        [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
        public delegate int SERVERINFOCALLBACK(int Msg, int wParam, IntPtr ptr);
 
        public enum LV_MSG
        {
            LV_MSG_NONE,
            LV_MSG_CARD_ONLINE,//上线通知,通过CARD_INFO结构体指针获取详细上线信息
            LV_MSG_CARD_OFFLINE,//下线通知,通过CARD_INFO结构体指针获取详细下线信息
        };
 
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
        public struct CARD_INFO
        {
            public int port;                                        //控制卡端口
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
            public string ipStr;                                    //控制卡IP
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)]
            public string networkIdStr;                             //控制卡唯一网络ID(每张卡都贴有唯一网络ID)
        };
 
        /********************************************************************************************
         *    LV_CreateProgramEx            创建节目对象,返回类型为 HPROGRAM
         *
         *    参数说明
         *                LedWidth        屏的宽度
         *                LedHeight        屏的高度
         *                ColorType        屏的颜色 1.单色  2.双基色  3.三基色     注:C卡全彩参数为3      X系列卡参数固定为 4
         *                GrayLevel        灰度等级  赋值  1-5对应的灰度等级分别为 无,4,8,16,32  注:目前C系列的卡才支持,其它型号(T,A,U,XC,W,E,X)参数必须为0
         *                SaveType        节目保存位置,默认为0保存存为flash节目,3保存为ram节目
         *                                注:flash节目掉电不清除,ram节目掉电清除。应用场景需要实时刷新的,建议保存为ram节目
         *    返回值
         *                0                创建节目对象失败
         *                非0                创建节目对象成功
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_CreateProgramEx", CharSet = CharSet.Unicode)]
        public static extern IntPtr LV_CreateProgramEx(int LedWidth, int LedHeight, int ColorType, int GrayLevel, int SaveType);
 
        /*********************************************************************************************
         *    LV_AddProgram                添加一个节目
         *    
         *    参数说明
         *                hProgram        节目对象句柄
         *                ProgramNo        节目号 (取值范围0-255)(从0开始)
         *                ProgramTime        节目播放时长 0.节目播放时长  非0.指定播放时长
         *                LoopCount        循环播放次数  1-255
         *    返回值
         *                0                成功
         *                非0                失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddProgram", CharSet = CharSet.Unicode)]
        public static extern int LV_AddProgram(IntPtr hProgram, int ProgramNo, int ProgramTime, int LoopCount);
 
        /*********************************************************************************************
         *    LV_SetProgramTime            设置节目定时
         *    
         *    参数说明
         *                hProgram        节目对象句柄
         *                ProgramNo        节目号 (取值范围0-255)(从0开始)
         *                pProgramTime    节目定时属性,设置方式见PROGRAMTIME结构体注示
         *    返回值
         *                0                成功
         *                非0                失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_SetProgramTime", CharSet = CharSet.Unicode)]
        public static extern int LV_SetProgramTime(IntPtr hProgram, int ProgramNo, ref PROGRAMTIME pProgramTime);
 
        /*********************************************************************************************
        *    LV_AddImageTextArea                添加一个图文区域
        *    
        *    参数说明
        *                hProgram            节目对象句柄
        *                ProgramNo            节目号 (取值范围0-255)(从0开始)
        *                AreaNo                区域号 (取值范围1-255)
        *                pAreaRect            区域坐标属性,设置方式见AREARECT结构体注示
        *                nLayout                区域层号,0.前景区(默认) 1.背景区  注:除C系列,其它默认为1
        *    返回值
        *                0                    成功
        *                非0                    失败,调用LV_GetError来获取错误信息    
        ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddImageTextArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, int nLayout);
 
        /*********************************************************************************************
         *    LV_AddFileToImageTextArea            添加一个文件到图文区
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                FilePath                文件路径,支持的文件类型有 txt  rtf  bmp  gif  png  jpg jpeg tiff
         *                pPlayProp                显示的属性,设置方式见PLAYPROP结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddFileToImageTextArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddFileToImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, string FilePath, ref PLAYPROP pPlayProp);
 
        /*********************************************************************************************
         *    LV_AddSingleLineTextToImageTextArea    添加一个单行文本到图文区
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                AddType                    添加的类型  0.为字符串  1.文件(只支持txt和rtf文件)
         *                AddStr                    AddType为0则为字符串数据,AddType为1则为文件路径
         *                pFontProp                如果AddType为字符串类型或AddType为文件类型且文件为txt则可传入以赋值的该结构体,其它可赋NULL
         *                pPlayProp                显示的属性,设置方式见PLAYPROP结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddSingleLineTextToImageTextArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddSingleLineTextToImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, int AddType, string AddStr, ref FONTPROP pFontProp, ref PLAYPROP pPlayProp);
 
        /*********************************************************************************************
         *    LV_AddMultiLineTextToImageTextArea    添加一个多行文本到图文区
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                AddType                    添加的类型  0.为字符串  1.文件(只支持txt和rtf文件)
         *                AddStr                    AddType为0则为字符串数据,AddType为1则为文件路径   换行符(\n)
         *                pFontProp                如果AddType为字符串类型或AddType为文件类型且文件为txt则可传入以赋值的该结构体,其它可赋NULL
         *                pPlayProp                显示的属性,设置方式见PLAYPROP结构体注示
         *                nAlignment                水平对齐样式,0.左对齐  1.右对齐  2.水平居中  (注意:只对字符串和txt文件有效)
         *                IsVCenter                是否垂直居中  0.置顶(默认) 1.垂直居中
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddMultiLineTextToImageTextArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddMultiLineTextToImageTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, int AddType, string AddStr, ref FONTPROP pFontProp, ref PLAYPROP pPlayProp, int nAlignment, int IsVCenter);
 
        /*********************************************************************************************
         *    LV_AddStaticTextToImageTextArea        添加一个静止文本到图文区
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                AddType                    添加的类型  0.为字符串  1.文件(只支持txt和rtf文件)
         *                AddStr                    AddType为0则为字符串数据,AddType为1则为文件路径
         *                pFontProp                如果AddType为字符串类型或AddType为文件类型且文件为txt则可传入以赋值的该结构体,其它可赋NULL
         *                DelayTime                显示的时长 1~65535
         *                nAlignment                水平对齐样式,0.左对齐  1.右对齐  2.水平居中  (注意:只对字符串和txt文件有效)
         *                IsVCenter                是否垂直居中  0.置顶(默认) 1.垂直居中
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddStaticTextToImageTextArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddStaticTextToImageTextArea(int hProgram, int ProgramNo, int AreaNo, int AddType, string AddStr, ref FONTPROP pFontProp, int DelayTime, int nAlignment, int IsVCenter);
 
        /*********************************************************************************************
         *    LV_QuickAddSingleLineTextArea        快速添加一个向左移的单行文本区域
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                pAreaRect                区域坐标属性,设置方式见AREARECT结构体注示
         *                AddType                    添加的类型  0.为字符串  1.文件(只支持txt和rtf文件)
         *                AddStr                    AddType为0则为字符串数据,AddType为1则为文件路径
         *                pFontProp                如果AddType为字符串类型或AddType为文件类型且文件为txt则可传入以赋值的该结构体,其它可赋NULL
         *                nSpeed                    滚动速度 1~255
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_QuickAddSingleLineTextArea", CharSet = CharSet.Unicode)]
        public static extern int LV_QuickAddSingleLineTextArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, int AddType, string AddStr, ref FONTPROP pFontProp, int nSpeed);
 
        /*********************************************************************************************
         *    LV_AddDigitalClockArea                添加一个数字时钟区域
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                pAreaRect                区域坐标属性,设置方式见AREARECT结构体注示
         *                pDigitalClockAreaInfo    数字时钟属性,见DIGITALCLOCKAREAINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddDigitalClockArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddDigitalClockArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref DIGITALCLOCKAREAINFO pDigitalClockAreaInfo);
 
        /*********************************************************************************************
         *    LV_AddTimeArea                        添加一个计时区域
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号(取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                pAreaRect                区域坐标属性,设置方式见AREARECT结构体注示
         *                pTimeAreaInfo            计时属性,见TIMEAREAINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddTimeArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddTimeArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref TIMEAREAINFO pTimeAreaInfo);
 
        /*********************************************************************************************
         *    LV_AddClockArea                        添加一个模拟时钟区域
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                pAreaRect                区域坐标属性,设置方式见AREARECT结构体注示
         *                pClockAreaInfo            模拟时钟属性,见CLOCKAREAINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddClockArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddClockArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref CLOCKAREAINFO pClockAreaInfo);
 
        /*********************************************************************************************
         *    LV_AddNeiMaArea                        添加一个内码区域
         *  参数说明
         *              hProgram                节目对象句柄
         *              ProgramNo               节目号  从0开始(0-255)
         *              AreaNo                  区域号 (1-255)
         *              pAreaRect               区域坐标属性,设置方式见AREARECT结构体注示
         *              NeiMaStr                文本字符串   注:字符串编码是GB2312
         *              FontSize                字体大小 16 24 32
         *              FontColor               文字颜色 格式BBGGRR 0xff 红色  0xff00 绿色  0xffff黄色
         *              pPlayProp               显示的属性,设置方式见PLAYPROP结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddNeiMaArea", CharSet = CharSet.Unicode)]
        public static extern int LV_AddNeiMaArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, string NeiMaStr, int FontSize, int FontColor, ref PLAYPROP pPlayProp);
 
        /*********************************************************************************************
         *    LV_AddWaterBorder                    添加一个流水边框区域
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         *                ProgramNo                节目号 (取值范围0-255)(从0开始)
         *                AreaNo                    区域号 (取值范围1-255)
         *                pAreaRect                区域坐标属性,设置方式见AREARECT结构体注示
         *                pWaterBorderInfo        流水边框属性,见WATERBORDERINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AddWaterBorder", CharSet = CharSet.Unicode)]
        public static extern int LV_AddWaterBorder(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref WATERBORDERINFO pWaterBorderInfo);
 
        /*********************************************************************************************
         *    LV_DeleteProgram                    销毁节目对象(注意:如果此节目对象不再使用,请调用此函数销毁,否则会造成内存泄露)
         *    
         *    参数说明
         *                hProgram                节目对象句柄
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_DeleteProgram", CharSet = CharSet.Unicode)]
        public static extern void LV_DeleteProgram(IntPtr hProgram);
 
        /*********************************************************************************************
         *    LV_Send                                发送节目,此发送为一对一发送
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                hProgram                节目对象句柄
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_Send", CharSet = CharSet.Unicode)]
        public static extern int LV_Send(ref COMMUNICATIONINFO pCommunicationInfo, IntPtr hProgram);
 
        /*********************************************************************************************
         *    LV_TestOnline                        测试LED屏是否可连接上
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_TestOnline", CharSet = CharSet.Unicode)]
        public static extern int LV_TestOnline(ref COMMUNICATIONINFO pCommunicationInfo);
 
        /*********************************************************************************************
         *    LV_SetBasicInfoEx                        设置基本屏参
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                ColorType                屏的颜色 1.单色  2.双基色  3.三基色     注:C卡全彩参数为3      X系列卡参数固定为 4
         *                GrayLevel                灰度等级  赋值  1-5对应的灰度等级分别为 无,4,8,16,32  注:目前C系列的卡才支持,其它型号(T,A,U,XC,W,E,X)参数必须为0
         *                LedWidth                屏的宽度点数
         *                LedHeight                屏的高度点数
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_SetBasicInfoEx", CharSet = CharSet.Unicode)]
        public static extern int LV_SetBasicInfoEx(ref COMMUNICATIONINFO pCommunicationInfo, int ColorType, int GrayLevel, int LedWidth, int LedHeight);
 
        /*********************************************************************************************
         *    LV_SetOEDA                            设置OE DA
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                Oe                        OE  0.低有效  1.高有效
         *                Da                        DA  0.负极性  1.正极性
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_SetOEDA", CharSet = CharSet.Unicode)]
        public static extern int LV_SetOEDA(ref COMMUNICATIONINFO pCommunicationInfo, int Oe, int Da);
 
        /*********************************************************************************************
         *    LV_AdjustTime                        校时
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_AdjustTime", CharSet = CharSet.Unicode)]
        public static extern int LV_AdjustTime(ref COMMUNICATIONINFO pCommunicationInfo);
 
        /*********************************************************************************************
         *    LV_PowerOnOff                        开关屏
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                OnOff                    开关值  0.关屏  1.开屏  2.重启
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_PowerOnOff", CharSet = CharSet.Unicode)]
        public static extern int LV_PowerOnOff(ref COMMUNICATIONINFO pCommunicationInfo, int OnOff);
 
        /*********************************************************************************************
         *    LV_TimePowerOnOff                    定时开关屏
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                pTimeInfo                定时开关屏属性,详见ONOFFTIMEINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_TimePowerOnOff", CharSet = CharSet.Unicode)]
        public static extern int LV_TimePowerOnOff(ref COMMUNICATIONINFO pCommunicationInfo, ref ONOFFTIMEINFO pTimeInfo);
 
        /*********************************************************************************************
         *    LV_SetBrightness                    设置亮度
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                BrightnessValue            亮度值 0~15
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_SetBrightness", CharSet = CharSet.Unicode)]
        public static extern int LV_SetBrightness(ref COMMUNICATIONINFO pCommunicationInfo, int BrightnessValue);
 
        /*********************************************************************************************
         *    LV_TimeBrightness                    定时亮度
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                pBrightnessTimeInfo        定时亮度属性,详见BRIGHTNESSTIMEINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_TimeBrightness", CharSet = CharSet.Unicode)]
        public static extern int LV_TimeBrightness(ref COMMUNICATIONINFO pCommunicationInfo, ref BRIGHTNESSTIMEINFO pBrightnessTimeInfo);
 
        /*********************************************************************************************
         *    LV_LedTest                            LED测试
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                TestValue                测试值
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_LedTest", CharSet = CharSet.Unicode)]
        public static extern int LV_LedTest(ref COMMUNICATIONINFO pCommunicationInfo, int TestValue);
 
        /*********************************************************************************************
         *    LV_TimeLocker                        LED定时锁屏
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                LockerYear                锁屏年
         *                LockerMonth                锁屏月
         *                LockerDay                锁屏日
         *                LockerHour                锁屏时
         *                LockerMinute            锁屏分
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_TimeLocker", CharSet = CharSet.Unicode)]
        public static extern int LV_TimeLocker(ref COMMUNICATIONINFO pCommunicationInfo, int LockerYear, int LockerMonth, int LockerDay, int LockerHour, int LockerMinute);
 
        /*********************************************************************************************
         *    LV_CancelLocker                        取消定时锁屏
         *    
         *    参数说明
         *                pCommunicationInfo        通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_CancelLocker", CharSet = CharSet.Unicode)]
        public static extern int LV_CancelLocker(ref COMMUNICATIONINFO pCommunicationInfo);
 
        /*********************************************************************************************
         *    LV_SetLedCommunicationParameter            设置LED通讯参数
         *    
         *    参数说明
         *                pCommunicationInfo            通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
         *                pLedCommunicationParameter    详见LEDCOMMUNICATIONPARAMETER结构体注示
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_SetLedCommunicationParameter", CharSet = CharSet.Unicode)]
        public static extern int LV_SetLedCommunicationParameter(ref COMMUNICATIONINFO pCommunicationInfo, ref LEDCOMMUNICATIONPARAMETER pLedCommunicationParameter);
        /*********************************************************************************************
         *    LV_LedInitServer            启动控制卡心跳包服务 注:C2M、C4M才支持
         *    
         *    参数说明
         *                port            监听的端口
         *    返回值
         *                0                        成功
         *                非0                        失败,调用LV_GetError来获取错误信息    
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_LedInitServer", CharSet = CharSet.Unicode)]
        public static extern int LV_LedInitServer(int port);
        /*********************************************************************************************
         *    LV_LedShudownServer            断开控制卡心跳包服务 注:C2M、C4M才支持
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_LedShudownServer", CharSet = CharSet.Unicode)]
        public static extern int LV_LedShudownServer();
        /*********************************************************************************************
         *    LV_RegisterLedServerCallback            注册回调函数 注:C2M、C4M才支持
         *    
         *    参数说明
         *                serverCallback            回调函数
         ********************************************************************************************/
        [DllImport("lv_led_64.dll", EntryPoint = "LV_RegisterLedServerCallback", CharSet = CharSet.Unicode)]
        public static extern int LV_RegisterLedServerCallback(SERVERINFOCALLBACK serverCallback);
 
        /*********************************************************************************************
         *    LV_GetError                                获取错误信息(只支持中文)
         *    
         *    参数说明
         *                nErrCode                    函数执行返回的错误代码
         *    返回值 
         *            错误信息字符串
         ********************************************************************************************/
        public static string LS_GetError(int nErrCode)
        {
            string ErrStr;
            switch (nErrCode)
            {
                case -1:
                    ErrStr = "无效的节目句柄。"; break;
                case -2:
                    ErrStr = "节目已经存在。"; break;
                case -3:
                    ErrStr = "指定的节目不存在。"; break;
                case -4:
                    ErrStr = "定的区域不存在。"; break;
                case -5:
                    ErrStr = "创建socket失败。"; break;
                case -6:
                    ErrStr = "错误的回复包。"; break;
                case -7:
                    ErrStr = "不支持的文件类型。"; break;
                case -8:
                    ErrStr = "IP网关掩码或MAC字符串格式错误。"; break;
                case -9:
                    ErrStr = "错误的波特率。"; break;
                case -10:
                    ErrStr = "文件路径不存在。"; break;
                case -11:
                    ErrStr = "区域重叠。"; break;
                case -12:
                    ErrStr = "打开文件失败。"; break;
                case -14:
                    ErrStr = "区域已存在。"; break;
                case -15:
                    ErrStr = "无效的发送类型。"; break;
                case -16:
                    ErrStr = "绘图失败。"; break;
                case -17:
                    ErrStr = "创建文件夹失败。"; break;
                case -30:
                    ErrStr = "打开串口失败。"; break;
                case -31:
                    ErrStr = "设置串口超时失败。"; break;
                case -32:
                    ErrStr = "设置串口缓冲区失败。"; break;
                case -33:
                    ErrStr = "串口发送数据失败。"; break;
                case -34:
                    ErrStr = "串口接收数据失败。"; break;
                case -35:
                    ErrStr = "串口设置失败。"; break;
                case -36:
                    ErrStr = "串口接收数据超时。"; break;
                case -37:
                    ErrStr = "USB不支持群发。"; break;
                case -38:
                    ErrStr = "发送取消。"; break;
                case -100:
                    ErrStr = "网络连接失败。"; break;
                case -101:
                    ErrStr = "网络发送失败。"; break;
                case -102:
                    ErrStr = "网络接收数据失败。"; break;
                case -103:
                    ErrStr = "bind失败。"; break;
                case -104:
                    ErrStr = "无可用网卡。"; break;
                case 0xc140:
                    ErrStr = "Logo与参屏大小不适应。"; break;
                case 0xdaa3:
                    ErrStr = "控制器繁忙。"; break;
                case 0xd5b0:
                    ErrStr = "固件程序型号不匹配。"; break;
                case 0xd5b4:
                    ErrStr = "不是有效的固件程序。"; break;
                case 0xdab8:
                    ErrStr = "节目颜色或屏宽高与控制卡屏参设定值不一致。"; break;
                case 0xc1ba:
                    ErrStr = "超出控制卡带载。"; break;
                case 0xdab5:
                    ErrStr = "节目数据大小超过允许的最大值。"; break;
                default:
                    ErrStr = "未定义错误。"; break;
            }
            return ErrStr;
        }
 
 
        #region 调用方法
        private int m_ledWidth;
        private int m_ledHeight;
        private int m_ledColor;
        private int m_ledGrayLevel;
        #region [led]
        /// <summary>
        /// 发送给LED 三个区域同时更新
        /// </summary>
        /// <param name="m_ip">LED屏幕IP地址</param>
        /// <param name="palno">托盘区显示内容</param>
        /// <param name="palno1">中间区域多文本</param>
        /// <param name="strType">运行状态显示内容</param>
        public void LEDstr(string m_ip, string palno, string palno1, string strType)
        {
            m_ledWidth = 256;
            m_ledHeight = 160;
            m_ledColor = 1;
            m_ledGrayLevel = 0;
            
            try
            {
                Logger logger = LogManager.GetCurrentClassLogger();
                int nResult;
                LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO();
                CommunicationInfo.LEDType = 0;
                //TCP通讯********************************************************************************
                CommunicationInfo.SendType = 0;                                                     // 设为固定IP通讯模式,即TCP通讯
                CommunicationInfo.IpStr = m_ip;                                                     // 给IpStr赋值LED控制卡的IP
                CommunicationInfo.LedNumber = 1;                                                    // LED屏号为1,注意socket通讯和232通讯不识别屏号,默认赋1就行了,485必需根据屏的实际屏号进行赋值
                #region 创建一个节目
                IntPtr hProgram;                                                                    // 节目句柄
                //注意此处屏宽高及颜色参数必需与设置屏参的屏宽高及颜色一致,否则发送时会提示错误
                hProgram = LedDll.LV_CreateProgramEx(m_ledWidth, m_ledHeight, m_ledColor, m_ledGrayLevel, 0);
 
                nResult = LedDll.LV_AddProgram(hProgram, 0, 0, 1);                                  // 添加一个节目,参数说明见函数声明注示
                
                //if (nResult != 0)
                //{
                //    string ErrStr;
                //    ErrStr = LedDll.LS_GetError(nResult);                                           // liudl  此处需记录Log
                //    logger.Error("返回错误信息A2:", ErrStr);
                //    return;
                //}
                #endregion
 
                #region 区域属性设置
                // 区域范围变量 参数设定
                LedDll.AREARECT AreaRect = new LedDll.AREARECT();//区域坐标属性结构体变量
                AreaRect.left = 0;
                AreaRect.top = 0;
                AreaRect.width = m_ledWidth;
                AreaRect.height = 106;
 
                // 区域字体变量 参数设定
                LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//文字属性
                FontProp.FontName = "宋体";
                FontProp.FontSize = 12;
                FontProp.FontColor = LedDll.COLOR_RED;
                FontProp.FontBold = 0;
 
                // 区域字体运行速度 带入方式
                LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP();
                PlayProp.InStyle = 0;
                PlayProp.DelayTime = 3;
                PlayProp.Speed = 2;
                #endregion
 
 
                #region 创建区域
                AreaRect.left = 0;
                AreaRect.top = 0;
                AreaRect.width = m_ledWidth;
                AreaRect.height = 36;
                LedDll.LV_AddImageTextArea(hProgram, 0, 1, ref AreaRect, 1);
 
                FontProp.FontName = "宋体";
                FontProp.FontSize = 14;
                FontProp.FontColor = LedDll.COLOR_RED;
                FontProp.FontBold = 1;
                // 操作类型
                nResult = LedDll.LV_AddMultiLineTextToImageTextArea(hProgram, 0, 1, LedDll.ADDTYPE_STRING, palno, ref FontProp, ref PlayProp, 0, 0);
 
                AreaRect.left = 0;
                AreaRect.top = 36;
                AreaRect.width = m_ledWidth;
                AreaRect.height = 70;
                LedDll.LV_AddImageTextArea(hProgram, 0, 2, ref AreaRect, 1);
                FontProp.FontName = "宋体";
                FontProp.FontSize = 16;
                FontProp.FontColor = LedDll.COLOR_RED;
                FontProp.FontBold = 1;
                // 多文本区域 用于显示托盘信息
                nResult = LedDll.LV_AddMultiLineTextToImageTextArea(hProgram, 0, 2, LedDll.ADDTYPE_STRING, palno1, ref FontProp, ref PlayProp, 0, 0);
 
                FontProp.FontName = "宋体";
                FontProp.FontSize = 16;
                FontProp.FontColor = LedDll.COLOR_RED;
                FontProp.FontBold = 1;
 
                AreaRect.left = 0;
                AreaRect.top = 106;
                AreaRect.width = m_ledWidth;
                AreaRect.height = 53;
                // 字幕区域 用于显示运行状态 14 区域已存在
                nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 0, 3, ref AreaRect, LedDll.ADDTYPE_STRING, strType, ref FontProp, 32);
 
                // 发送到LED屏幕
                nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram);
                LedDll.LV_DeleteProgram(hProgram);
                #endregion
 
 
                if (nResult != 0)
                {
                    string ErrStr;
                    ErrStr = LedDll.LS_GetError(nResult);               // liudl 此处需要添加log
                    logger.Error("返回错误信息A04:", ErrStr);
                }
            }
            catch (Exception ex)
            {
                // 不抛出异常,防止阻碍主程序运行; Liudl:此处需添加log
                //throw ex;
                Logger logger = LogManager.GetCurrentClassLogger();
                logger.Error("测试trycatch捕捉的信息:", ex.Message);
            }
        }
 
        /// <summary>
        /// 发送给LED 单独更新字幕区域
        /// </summary>
        /// <param name="m_ip">LED屏幕IP地址</param>
        /// <param name="Mstr">运行状态显示内容</param>
        public void LEDstr(string m_ip, string Mstr)
        {
            m_ledWidth = 256;
            m_ledHeight = 160;
            m_ledColor = 1;
            m_ledGrayLevel = 0;
            try
            {
 
                int nResult;
                LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO();
                CommunicationInfo.LEDType = 0;
                //TCP通讯********************************************************************************
                CommunicationInfo.SendType = 0;                                                     // 设为固定IP通讯模式,即TCP通讯
                CommunicationInfo.IpStr = m_ip;                                                     // 给IpStr赋值LED控制卡的IP
                CommunicationInfo.LedNumber = 1;                                                    // LED屏号为1,注意socket通讯和232通讯不识别屏号,默认赋1就行了,485必需根据屏的实际屏号进行赋值
 
                #region 创建一个节目
                IntPtr hProgram;                                                                    // 节目句柄
                //注意此处屏宽高及颜色参数必需与设置屏参的屏宽高及颜色一致,否则发送时会提示错误
                hProgram = LedDll.LV_CreateProgramEx(m_ledWidth, m_ledHeight, m_ledColor, m_ledGrayLevel, 0);
                nResult = LedDll.LV_AddProgram(hProgram, 0, 0, 1);                                  // 添加一个节目,参数说明见函数声明注示
                if (nResult != 0)
                {
                    string ErrStr;
                    ErrStr = LedDll.LS_GetError(nResult);                                           // liudl  此处需记录Log
                    return;
                }
                #endregion
 
                #region 创建区域
                // 区域字体运行速度 带入方式
                LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP();
                PlayProp.InStyle = 0;
                PlayProp.DelayTime = 3;
                PlayProp.Speed = 2;
 
                // 区域字体变量 参数设定
                LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//文字属性
                FontProp.FontName = "宋体";
                FontProp.FontSize = 16;
                FontProp.FontColor = LedDll.COLOR_RED;
                FontProp.FontBold = 0;
 
                // 区域范围变量 参数设定
                LedDll.AREARECT AreaRect = new LedDll.AREARECT();//区域坐标属性结构体变量
                AreaRect.left = 0;
                AreaRect.top = 106;
                AreaRect.width = m_ledWidth;
                AreaRect.height = 53;
                // 字幕区域 用于显示运行状态 14 区域已存在
                nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 0, 3, ref AreaRect, LedDll.ADDTYPE_STRING, Mstr, ref FontProp, 32);
 
                // 发送到LED屏幕
                nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram);
                LedDll.LV_DeleteProgram(hProgram);
                #endregion
 
                if (nResult != 0)
                {
                    string ErrStr;
                    ErrStr = LedDll.LS_GetError(nResult);               // liudl 此处需要添加log
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 
        /// <summary>
        /// 设置led整屏字幕滚动
        /// </summary>
        /// <param name="m_ip">LED屏幕IP地址</param>
        /// <param name="palno">托盘区显示内容</param>
        public void SetLEDText(string IPStr, string ledText)
        {
            m_ledWidth = 256;
            m_ledHeight = 160;
            m_ledColor = 1;
            m_ledGrayLevel = 0;
 
            try
            {
                Logger logger = LogManager.GetCurrentClassLogger();
                int nResult;
                LedDll.COMMUNICATIONINFO CommunicationInfo = new LedDll.COMMUNICATIONINFO();
                CommunicationInfo.LEDType = 0;
                //TCP通讯********************************************************************************
                CommunicationInfo.SendType = 0;                                                     // 设为固定IP通讯模式,即TCP通讯
                CommunicationInfo.IpStr = IPStr;                                                     // 给IpStr赋值LED控制卡的IP
                CommunicationInfo.LedNumber = 1;                                                    // LED屏号为1,注意socket通讯和232通讯不识别屏号,默认赋1就行了,485必需根据屏的实际屏号进行赋值
                #region 创建一个节目
                IntPtr hProgram;                                                                    // 节目句柄
                //注意此处屏宽高及颜色参数必需与设置屏参的屏宽高及颜色一致,否则发送时会提示错误
                hProgram = LedDll.LV_CreateProgramEx(m_ledWidth, m_ledHeight, m_ledColor, m_ledGrayLevel, 0);
 
                nResult = LedDll.LV_AddProgram(hProgram, 0, 0, 1);                                  // 添加一个节目,参数说明见函数声明注示
                #endregion
 
                #region 区域属性设置
                // 区域范围变量 参数设定
                LedDll.AREARECT AreaRect = new LedDll.AREARECT();//区域坐标属性结构体变量
                AreaRect.left = 0;
                AreaRect.top = 20;
                AreaRect.width = m_ledWidth;
                AreaRect.height = 106;
 
                // 区域字体变量 参数设定
                LedDll.FONTPROP FontProp = new LedDll.FONTPROP();//文字属性
                FontProp.FontName = "宋体";
                FontProp.FontSize = 72;
                FontProp.FontColor = LedDll.COLOR_RED;
                FontProp.FontBold = 1;
 
                // 区域字体运行速度 带入方式
                LedDll.PLAYPROP PlayProp = new LedDll.PLAYPROP();
                PlayProp.InStyle = 0;
                PlayProp.DelayTime = 3;
                PlayProp.Speed = 2;
                #endregion
 
 
                #region 创建区域
                // 字幕区域 用于显示运行状态 14 区域已存在
                nResult = LedDll.LV_QuickAddSingleLineTextArea(hProgram, 0, 3, ref AreaRect, LedDll.ADDTYPE_STRING, ledText, ref FontProp, 32);
 
                // 发送到LED屏幕
                nResult = LedDll.LV_Send(ref CommunicationInfo, hProgram);
                LedDll.LV_DeleteProgram(hProgram);
                #endregion
 
 
                if (nResult != 0)
                {
                    string ErrStr;
                    ErrStr = LedDll.LS_GetError(nResult);               // liudl 此处需要添加log
                    logger.Error("返回错误信息A041:", ErrStr);
                }
            }
            catch (Exception ex)
            {
                // 不抛出异常,防止阻碍主程序运行; Liudl:此处需添加log
                //throw ex;
                Logger logger = LogManager.GetCurrentClassLogger();
                logger.Error("测试trycatch捕捉的信息1:", ex.Message);
            }
        }
        #endregion
 
 
        #endregion
    }
}