📄 yfopcsdk.cs
字号:
using System.Runtime.InteropServices;
using System.Text;
class YFOPCSDK
{
public delegate void AddOPCnameProxy(string Name, string clsid);
public delegate void AddLandHostIPProxy(string Host, string ip);
public delegate void AddProcessProxy(StringBuilder ev);
public delegate void ServerDataChangeProcProxy(int ServerHandle, int GroupHandle, int ItemHandle, object Value, double Ft, short Quality);
public delegate void ServerDataChangeProcProxyEx(int ServerHandle, int GroupHandle, ref object ItemHandle,ref object Value, ref object Ft, ref object Quality);
public delegate void ServerShutdownProcProxy(int ServerHandle);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetVersion();
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_Init();
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_Uninit();
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_ActiveCode(string regName, ref string regCode);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetServers(string Host, int Version, ref object ServerNames, ref object ServerClassIDs);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_Connect(string Host, string ServerClass, int Version);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_Disconnect(int ServerHandle);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetServerStatus(int ServerHandle, ref double StartTime, ref double CurrentTime, ref double LastUpdateTime, ref short State, ref int BandWidth, ref int GroupCount, ref short MajorVersion, ref short MinorVersion, ref short BuildNumber,
string vendor, int size);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_AddGroup(int ServerHandle, string Name, int Active, int UpdateRate, int TimeBias, float DeadBand, int LCID);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern bool OPC_RemoveGroup(int ServerHandle, int GroupHandle);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_SetGroupName(int ServerHandle, int GroupHandle, string Name);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_SetGroupStat(int ServerHandle, int GroupHandle, int UpdateRate, int Active, int TimeBias, float DeadBand, int LCID);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetGroupStat(int ServerHandle, int GroupHandle, ref int UpdateRate, ref int pActive, ref int pTimeBias, ref float pDeadBand, ref int pLCID);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_RefreshGroup(int ServerHandle, int GroupHandle, short DataSoure);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetNameSpace(int ServerHandle, ref short NameSpace_Renamed);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_ChangeBrowsePosition(int ServerHandle, short Direct, string NodeName);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_BrowseItems(int ServerHandle, short FilterType, string FilterString, short FilterDataType, short FilterAccessRight, ref object ItemNames);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetItemFullName(int ServerHandle, string Name, byte[] pFullName, int size);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetItemProperties(int ServerHandle, int GroupHandle, string Name, ref object IDList, ref object DataTypeList, ref object DescList);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_GetItemPropertyValue(int ServerHandle, int GroupHandle, string Name, int PropertyID, ref object Value);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_AddItem(int ServerHandle, int GroupHandle, string Name);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_RemoveItem(int ServerHandle, int GroupHandle, int ItemHandle);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_ActiveItem(int ServerHandle, int GroupHandle,int hItemHandle, int bActive);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_WriteItem(int ServerHandle, int GroupHandle, int ItemHandle, object Value, int DoAsync);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_ReadItem(int ServerHandle, int GroupHandle, int ItemHandle, ref object Value, ref double TimeStamp, ref short Quality);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_ValidateItem(int ServerHandle, int GroupHandle, string Name, ref short DataType, short AccessRight);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_SetDataChangeProc(int ServerHandle, ServerDataChangeProcProxy callback);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_SetDataChangeProcEx(int ServerHandle, ServerDataChangeProcProxyEx callback);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int OPC_SetShutdownProc(int ServerHandle, ServerShutdownProcProxy callback);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern bool EnumLanHostIPA(AddLandHostIPProxy lpAddHostIP);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern bool EnumOPCNameA(string hostname, int Version, AddOPCnameProxy lpAddOPCname);
[DllImport("YFOPCSDK.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern void OPC_SetProcessTiggerProcA(AddProcessProxy callback);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -