public int CloseDevice() { if (!IsDeviceOpen) { return((int)ErrorDef.Success); } if (DASK.Release_Card((ushort)_cardIndex) != 0) { return((int)ErrorDef.InvokeFailed); } _dioMD.Close(); _dioMD = null; IsDeviceOpen = false; return((int)ErrorDef.Success); }
short _devHandle = -1; //SDK打开卡时返回的句柄 public int OpenDevice() { if (!IsInitOK) { return((int)ErrorDef.NotInitialed); } if (IsDeviceOpen) { return(0); } _devHandle = DASK.Register_Card((ushort)_cardType, (ushort)_cardIndex); if (_devHandle < 0) { return((int)ErrorDef.InvokeFailed); } _dioMD = new JFAdlinkPciDio(_cardType, _devHandle); _dioMD.Open(); IsDeviceOpen = true; return((int)ErrorDef.Success); }