1097 lines
65 KiB
C#
1097 lines
65 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Runtime.InteropServices;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace RFIDReaderJilin.Common
|
||
{
|
||
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; //时否下划线
|
||
};
|
||
|
||
|
||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||
public struct QRAREAINFO
|
||
{
|
||
public int nLowVersion;//QR的最低版本,0~39
|
||
public int nHighVersion;//QR的最高版本,0~39,一般都是固定成39
|
||
public int nErrorCorrectionLevel;//纠错等级0:自适应 1:L 2:M 3:Q 4:H
|
||
public int nMaskVersion;//掩膜版本 0xff 自适应 0~7 手动选择
|
||
public int nBlankPointNum;//QR 码周边空白的点数,默认为 4,一般这个值要大于等于 4,当屏幕点数很紧张时,且不够 4 的时候可选择 0,表示区域内周边全做空白处理
|
||
public int nBaseCodeColor;//QR 码底颜色,一般要求是白底,白底识别率会高,也可以设置为其他色,0---红色,1---绿色,2---黄色,3---蓝色,4---紫色(RB 组合),5---青色(GB 组合),6---白色
|
||
public int isColorReverse;//QR 码颜色是否翻转,0---不翻转,1---翻转
|
||
public int nDefaultShow;//默认显示状态,0---黑屏,1---显示默认码
|
||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
|
||
public string strDefaultCode;//默认码,字符长度不能超过512字节)
|
||
};
|
||
//****************************************************************************
|
||
|
||
//**页面显示的属性结构体****************************************************
|
||
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; //Flag 为1才有效, 边框图片文件的路径,注意只能是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_InitLed 初始化屏的类型和颜色顺序(C卡)
|
||
* 当Led上显示的文字区域的颜色与下发的不一致, 请的确认Led 屏的RGB顺序,并调用此接口
|
||
* 参数说明
|
||
* nLedType 屏类型
|
||
* 0.6代T系A系XC系
|
||
* 1.6代E系列
|
||
* 2.X1X2系列
|
||
* 3.7代C系列(C2M,C4M)
|
||
* 4: E5,E6,C8
|
||
* nRgb 模组的RGB顺序,仅C卡有效,其他卡固定为0. C卡时, 0: R->G->B 1: G->R->B 2:R->B->G 3:B->R->G 4:B->G->R 5:G->B->R
|
||
* 返回值 无
|
||
*
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_InitLed", CharSet = CharSet.Unicode)]
|
||
public static extern void LV_InitLed(int nLedType, int nRgb);
|
||
|
||
|
||
/********************************************************************************************
|
||
* 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节目, 目前仅C卡程序才支持切换,
|
||
* 其他卡默认出货为flash程序,如果需要RAM程序请联系业务或者在官网下载,然后使用Led Player对卡进行升级
|
||
* 返回值
|
||
* 0 创建节目对象失败
|
||
* 非0 创建节目对象成功
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.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.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.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 区域层号,1.前景区(默认) 0.背景区 注:除C系列,其它默认为1
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败,调用LV_GetError来获取错误信息
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.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.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.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.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.dll", EntryPoint = "LV_AddStaticTextToImageTextArea", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_AddStaticTextToImageTextArea(IntPtr 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.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.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.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.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结构体注示
|
||
* 除C卡外的其他卡,内码区域的起点X和Y坐标必须为8的整数倍,如0,8,16等, 宽高必须大于所用字体大小
|
||
* NeiMaStr 文本字符串 注:字符串编码是GB2312
|
||
* FontSize 字体大小 16 24 32
|
||
* FontColor 文字颜色 格式BBGGRR 0xff 红色 0xff00 绿色 0xffff黄色
|
||
* pPlayProp 显示的属性,设置方式见PLAYPROP结构体注示
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败,调用LV_GetError来获取错误信息
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.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);
|
||
/// <summary>
|
||
/// 添加语音区域
|
||
/// </summary>
|
||
/// <param name="hProgram"></param>
|
||
/// <param name="ProgramNo"></param>
|
||
/// <param name="AreaNo"></param>
|
||
/// <param name="VoiceStr"></param>
|
||
/// <param name="DelayTime"></param>
|
||
/// <param name="PlayCount"></param>
|
||
/// <returns></returns>
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_AddVoiceArea", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_AddVoiceArea(IntPtr hProgram, int ProgramNo, int AreaNo, string VoiceStr, int DelayTime, int PlayCount);
|
||
|
||
/// <summary>
|
||
/// 添加二维码区域,仅C卡支持
|
||
/// </summary>
|
||
/// <param name="hProgram"></param>
|
||
/// <param name="ProgramNo"></param>
|
||
/// <param name="AreaNo"></param>
|
||
/// <param name="pAreaRect"></param>
|
||
/// <param name="pQRAreaInfo"></param>
|
||
/// <returns></returns>
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_AddQRCodeArea", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_AddQRCodeArea(IntPtr hProgram, int ProgramNo, int AreaNo, ref AREARECT pAreaRect, ref QRAREAINFO pQRAreaInfo);
|
||
|
||
/*********************************************************************************************
|
||
* LV_RefreshNeiMaArea 刷新内码区域
|
||
*
|
||
* 参数说明
|
||
* pCommunicationInfo 通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
|
||
* NeiMaStr 刷新的数据字符串,格式可以查看<<内码区域局部更新协议>>文档
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败,调用LV_GetError来获取错误信息
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_RefreshNeiMaArea", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_RefreshNeiMaArea(ref COMMUNICATIONINFO pCommunicationInfo, string NeiMaStr);
|
||
|
||
|
||
/*********************************************************************************************
|
||
* LV_RefreshVoiceArea 更新语音播报
|
||
*
|
||
* 参数说明
|
||
* pCommunicationInfo 通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
|
||
* VoiceStr 刷新的语音字符串
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败,调用LV_GetError来获取错误信息
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_RefreshVoiceArea", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_RefreshVoiceArea(ref COMMUNICATIONINFO pCommunicationInfo, string VoiceStr);
|
||
/// <summary>
|
||
/// 刷新二维码内容的显示
|
||
/// </summary>
|
||
/// <param name="pCommunicationInfo"></param>
|
||
/// <param name="CodeStr"></param>
|
||
/// <returns></returns>
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_RefreshVoiceArea", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_RefreshQRCodeArea(ref COMMUNICATIONINFO pCommunicationInfo, string CodeStr);
|
||
|
||
/*********************************************************************************************
|
||
* LV_AddWaterBorder 添加一个流水边框区域
|
||
*
|
||
* 参数说明
|
||
* hProgram 节目对象句柄
|
||
* ProgramNo 节目号 (取值范围0-255)(从0开始)
|
||
* AreaNo 区域号 (取值范围1-255)
|
||
* pAreaRect 区域坐标属性,设置方式见AREARECT结构体注示
|
||
* pWaterBorderInfo 流水边框属性,见WATERBORDERINFO结构体注示
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败,调用LV_GetError来获取错误信息
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.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);
|
||
|
||
//[DllImport("lv_led.dll", EntryPoint = "LV_AddVoiceArea", CharSet = CharSet.Unicode)]
|
||
//public static extern int LV_AddVoiceArea(IntPtr hProgram, int ProgramNo, int AreaNo,ref VOICEAREAINFO pVoiceAreaInfo);
|
||
|
||
|
||
/*********************************************************************************************
|
||
* LV_DeleteProgram 销毁节目对象(注意:如果此节目对象不再使用,请调用此函数销毁,否则会造成内存泄露)
|
||
*
|
||
* 参数说明
|
||
* hProgram 节目对象句柄
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.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.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.dll", EntryPoint = "LV_TestOnline", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_TestOnline(ref COMMUNICATIONINFO pCommunicationInfo);
|
||
|
||
/*********************************************************************************************
|
||
* LV_SetBasicInfoEx 设置基本屏参
|
||
* 不要频繁地调用屏参设置接口,会把控制卡的flash硬件弄坏
|
||
* 参数说明
|
||
* 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.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.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.dll", EntryPoint = "LV_AdjustTime", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_AdjustTime(ref COMMUNICATIONINFO pCommunicationInfo);
|
||
|
||
/*********************************************************************************************
|
||
* LV_PowerOnOff 开关屏
|
||
*
|
||
* 参数说明
|
||
* pCommunicationInfo 通讯参数,赋值方式见COMMUNICATIONINFO结构体注示
|
||
* OnOff 开关值 0.开屏 1.关屏 2.重启(仅支持C卡)
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败,调用LV_GetError来获取错误信息
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.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.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.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.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.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.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.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.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.dll", EntryPoint = "LV_LedInitServer", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_LedInitServer(int port);
|
||
/*********************************************************************************************
|
||
* LV_LedShudownServer 断开控制卡心跳包服务 注:C2M、C4M才支持
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_LedShudownServer", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_LedShudownServer();
|
||
/*********************************************************************************************
|
||
* LV_RegisterLedServerCallback 注册回调函数 注:C2M、C4M才支持
|
||
*
|
||
* 参数说明
|
||
* serverCallback 回调函数
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_RegisterLedServerCallback", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_RegisterLedServerCallback(SERVERINFOCALLBACK serverCallback);
|
||
|
||
|
||
/*********************************************************************************************
|
||
* SetLedServerInfo 设置LED屏的服务器信息
|
||
*
|
||
* 参数说明
|
||
* IpStr LED屏的IP
|
||
* IsClient 1为启动客户端模式 0为不启动(当前带有广域网功能的卡默认为启动)
|
||
* ServerIp 服务器IP
|
||
* ServerPort 端口
|
||
* HeartBeatTime LED心跳包时间(最小20秒)
|
||
* 返回值
|
||
* 0 成功
|
||
* 非0 失败
|
||
********************************************************************************************/
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_SetServerInfo", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_SetServerInfo(ref COMMUNICATIONINFO pCommunicationInfo, int isClient, string ServerIp, int ServerPort, int HeartbeatTime);
|
||
|
||
/// <summary>
|
||
/// 设置继电器 C8 T8支持
|
||
/// </summary>
|
||
/// <param name="pCommunicationInfo">通讯参数,赋值方式见COMMUNICATIONINFO结构体注示</param>
|
||
/// <param name="type">控制模式 0:手动模式 1:定时模式</param>
|
||
/// <param name="nManualSwitch">手动模式时的开关值 0:关 1:开</param>
|
||
/// <param name="flag1">定时模式的第一组时间标志 0:无效 1:有效</param>
|
||
/// <param name="startTime1">定时模式的第一组起始时间,格式如:"12:00:00"</param>
|
||
/// <param name="endTime1">定时模式的第一组结束时间,格式如:"13:59:59"</param>
|
||
/// <param name="flag2">定时模式的第二组时间标志 0:无效 1:有效</param>
|
||
/// <param name="startTime2">定时模式的第二组起始时间,格式如:"14:00:00"</param>
|
||
/// <param name="endTime2">定时模式的第二组结束时间,格式如:"15:59:59"</param>
|
||
/// <param name="flag3">定时模式的第三组时间标志 0:无效 1:有效</param>
|
||
/// <param name="startTime3">定时模式的第三组起始时间,格式如:"16:00:00"</param>
|
||
/// <param name="endTime3">定时模式的第三组结束时间,格式如:"17:59:59"</param>
|
||
/// <returns></returns>
|
||
[DllImport("lv_led.dll", EntryPoint = "LV_SetRelay", CharSet = CharSet.Unicode)]
|
||
public static extern int LV_SetRelay(ref COMMUNICATIONINFO pCommunicationInfo, int type, int nManualSwitch
|
||
, int flag1, string startTime1, string endTime1
|
||
, int flag2, string startTime2, string endTime2
|
||
, int flag3, string startTime3, string endTime3);
|
||
/*********************************************************************************************
|
||
* LV_GetError 获取错误信息(只支持中文)
|
||
*
|
||
* 参数说明
|
||
* nErrCode 函数执行返回的错误代码
|
||
* 返回值
|
||
* 错误信息字符串
|
||
********************************************************************************************/
|
||
public static string LS_GetError(int nErrCode)
|
||
{
|
||
string ErrStr;
|
||
switch (nErrCode)
|
||
{
|
||
case -1:
|
||
ErrStr = "无效的节目句柄。(Invalid program handle.)"; break;
|
||
case -2:
|
||
ErrStr = "节目已经存在。(The program already exists.)"; break;
|
||
case -3:
|
||
ErrStr = "指定的节目不存在。The specified program does not exist."; break;
|
||
case -4:
|
||
ErrStr = "指定的区域不存在。The specified region does not exist."; break;
|
||
case -5:
|
||
ErrStr = "创建socket失败。Creating a socket has failed."; break;
|
||
case -6:
|
||
ErrStr = "错误的回复包。Error of the response package."; break;
|
||
case -7:
|
||
ErrStr = "不支持的文件类型。Unsupported file type."; break;
|
||
case -8:
|
||
ErrStr = "IP网关掩码或MAC字符串格式错误。The IP gateway mask or the MAC string is incorrectly formed."; break;
|
||
case -9:
|
||
ErrStr = "错误的波特率。The incorrect aud rate."; break;
|
||
case -10:
|
||
ErrStr = "文件路径不存在。File path does not exist."; break;
|
||
case -11:
|
||
ErrStr = "区域重叠。zone overlapping."; break;
|
||
case -12:
|
||
ErrStr = "打开文件失败。 Failed to open the file."; break;
|
||
case -14:
|
||
ErrStr = "区域已存在。The Area already exists."; break;
|
||
case -15:
|
||
ErrStr = "无效的发送类型。Invalid send type."; break;
|
||
case -16:
|
||
ErrStr = "绘图失败。Drawing failed."; break;
|
||
case -17:
|
||
ErrStr = "创建文件夹失败。 Failed to create a folder."; break;
|
||
case -30:
|
||
ErrStr = "打开串口失败。Failed to open the serial port."; break;
|
||
case -31:
|
||
ErrStr = "设置串口超时失败。Failed to set the serial port timeout."; break;
|
||
case -32:
|
||
ErrStr = "设置串口缓冲区失败。Failed to set the serial port buffer."; break;
|
||
case -33:
|
||
ErrStr = "串口发送数据失败。Serial port failed to send data."; break;
|
||
case -34:
|
||
ErrStr = "串口接收数据失败。The Serial port failed to receive the data."; break;
|
||
case -35:
|
||
ErrStr = "串口设置失败。Serial port settings have failed."; break;
|
||
case -36:
|
||
ErrStr = "串口接收数据超时。Serial port receives data timeout."; break;
|
||
case -37:
|
||
ErrStr = "USB不支持群发。USB does not support mass sending."; break;
|
||
case -38:
|
||
ErrStr = "发送取消。Send a cancellation."; break;
|
||
case -100:
|
||
ErrStr = "网络连接失败。The network connection has failed."; break;
|
||
case -101:
|
||
ErrStr = "网络发送失败。The network sending has failed."; break;
|
||
case -102:
|
||
ErrStr = "网络接收数据失败。The network has failed to receive the data."; break;
|
||
case -103:
|
||
ErrStr = "bind失败。The bind has failed."; break;
|
||
case -104:
|
||
ErrStr = "无可用网卡。No network card is available."; break;
|
||
case 0xc140:
|
||
ErrStr = "Logo与参屏大小不适应。Logo is not suitable to the screen size."; break;
|
||
case 0xdaa3:
|
||
ErrStr = "控制器繁忙。 The controller is busy."; break;
|
||
case 0xd5b0:
|
||
ErrStr = "固件程序型号不匹配。Firmware program model does not match."; break;
|
||
case 0xd5b4:
|
||
ErrStr = "不是有效的固件程序。Is not a valid firmware program."; break;
|
||
case 0xdab8:
|
||
ErrStr = "节目颜色或屏宽高与控制卡屏参设定值不一致。The program color or screen width and height is inconsistent with the set value of the control card screen parameter."; break;
|
||
case 0xc1ba:
|
||
ErrStr = "超出控制卡带载。 Out of the control cartridge load."; break;
|
||
case 0xdab5:
|
||
ErrStr = "节目数据大小超过允许的最大值。The program data size exceeds the maximum allowed value."; break;
|
||
default:
|
||
ErrStr = "未定义错误。 No error is defined.Error code is" + nErrCode.ToString(); break;
|
||
}
|
||
return ErrStr;
|
||
}
|
||
}
|
||
|
||
|
||
public static class IniFunc
|
||
{
|
||
/// <summary>
|
||
/// 获取值
|
||
/// </summary>
|
||
/// <param name="section">段落名</param>
|
||
/// <param name="key">键名</param>
|
||
/// <param name="defval">读取异常是的缺省值</param>
|
||
/// <param name="retval">键名所对应的的值,没有找到返回空值</param>
|
||
/// <param name="size">返回值允许的大小</param>
|
||
/// <param name="filepath">ini文件的完整路径</param>
|
||
/// <returns></returns>
|
||
[DllImport("kernel32.dll")]
|
||
private static extern int GetPrivateProfileString(
|
||
string section,
|
||
string key,
|
||
string defval,
|
||
StringBuilder retval,
|
||
int size,
|
||
string filepath);
|
||
|
||
/// <summary>
|
||
/// 写入
|
||
/// </summary>
|
||
/// <param name="section">需要写入的段落名</param>
|
||
/// <param name="key">需要写入的键名</param>
|
||
/// <param name="val">写入值</param>
|
||
/// <param name="filepath">ini文件的完整路径</param>
|
||
/// <returns></returns>
|
||
[DllImport("kernel32.dll")]
|
||
private static extern int WritePrivateProfileString(
|
||
string section,
|
||
string key,
|
||
string val,
|
||
string filepath);
|
||
|
||
|
||
/// <summary>
|
||
/// 获取数据
|
||
/// </summary>
|
||
/// <param name="section">段落名</param>
|
||
/// <param name="key">键名</param>
|
||
/// <param name="def">没有找到时返回的默认值</param>
|
||
/// <param name="filename">ini文件完整路径</param>
|
||
/// <returns></returns>
|
||
public static string GetString(string section, string key, string def, string filename)
|
||
{
|
||
StringBuilder sb = new StringBuilder(1024);
|
||
GetPrivateProfileString(section, key, def, sb, 1024, filename);
|
||
return sb.ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 写入数据
|
||
/// </summary>
|
||
/// <param name="section">段落名</param>
|
||
/// <param name="key">键名</param>
|
||
/// <param name="val">写入值</param>
|
||
/// <param name="filename">ini文件完整路径</param>
|
||
public static void WriteString(string section, string key, string val, string filename)
|
||
{
|
||
WritePrivateProfileString(section, key, val, filename);
|
||
}
|
||
}
|
||
|
||
public class CLedBasicInfo
|
||
{
|
||
/// <summary>
|
||
/// 屏类型
|
||
/// 0.6代T系A系XC系
|
||
/// 1.6代E系列
|
||
/// 2.X1X2系列
|
||
/// 3.7代C系列(C2M,C4M)
|
||
/// 4: E5,E6,C8
|
||
/// </summary>
|
||
public int m_ledType;
|
||
/// <summary>
|
||
/// 屏宽度
|
||
/// </summary>
|
||
public int m_ledWidth;
|
||
/// <summary>
|
||
/// 屏高度
|
||
/// </summary>
|
||
public int m_ledHeight;
|
||
/// <summary>
|
||
/// 屏颜色 1:单色 2:双色 3:七彩
|
||
/// 注:C卡全彩参数为3 X系列卡参数固定为 4
|
||
/// </summary>
|
||
public int m_ledColor;
|
||
/// <summary>
|
||
/// 屏灰度等级
|
||
/// 目前C系列的卡才支持,其它型号(T,A,U,XC,W,E,X)参数必须为0
|
||
/// 1-5对应的灰度等级分别为 无,4,8,16,32
|
||
/// </summary>
|
||
public int m_ledGrayLevel;
|
||
}
|
||
}
|