public int close(DeviceHandle handle) { if (handle.isInvalid()) { GlobalServices.ErrMsg("DDI_EZLINKUSB.close()", " was calleed with an invalid handle"); return -1; } this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Disconnect_Start; this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Disconnect_End; return -1; }
private unsafe bool isDeviceAlive(DeviceHandle handle) { byte* numPtr = stackalloc byte[0x40]; if (handle.isInvalid()) { GlobalServices.ErrMsg("DDI_EZLINKUSB.isDeviceAlive()", "called with INVALID handle"); return false; } int dev = handle.EZLinkhnd.dev; this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Status_DevAlive_Start; int num = 0; this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Status_DevAlive_End; return ((num == 0) && (numPtr[1] == 0)); }
private DeviceHandle open(int devIdx, int freqBand) { this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Connect_Start; this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Connect_End; return new DeviceHandle(); }
public unsafe int write(DeviceHandle handle, DataBuffer data) { byte* numPtr = stackalloc byte[0x100]; if (handle.isInvalid()) { GlobalServices.ErrMsg("DDI_EZLinkDongle.write()", "called with INVALID handle"); return -1; } Protocol protocol2 = data.ddi_getProtocol(); if (protocol2 == Protocol.Write) { string str; data.ddi_getCommand_Transmit(out str); numPtr[0] = (byte) (str.Length + 4); numPtr[1] = 170; numPtr[2] = 0x2d; numPtr[3] = 0xd4; numPtr[4] = (byte) str.Length; for (int i = 0; i < str.Length; i++) { numPtr[i + 5] = (byte) str[i]; } this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Transmit_Start; this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLink_Transmit_End; } else if (protocol2 == Protocol.WriteRegister) { uint num; uint num2; data.ddi_getCommand_WriteRegister(out num, out num2); this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLinkReg_Write_Start; this._ddi_EZLinkDLL_State = DDI_EZLinkDLL_State.EZLinkReg_Write_End; } else { GlobalServices.ErrMsg("DDI_EZLinkDongle.write()", "Unexpected protocol received"); } return 0; }