/// <summary> /// Reads the serial Number /// returns zero on sucess, else non-zero erro /// </summary> public UInt32 GetDeviceInfo(ref UInt32 FamilyCode, ref UInt32 SerialNumber, ref UInt32 Version, ref UInt32 Date, ref UInt32 Month, ref UInt32 Year, ref UInt32 SecurityNumber, ref UInt32 ChipType) { try { Byte[] Ans = new Byte[16]; //Ans[0] = 10; //if (Hid.HidD_GetFeature(myDeviceHandle, Ans, 8) == false) return (1); //SerialNumber = Convert.ToUInt32(Ans[0]); //SerialNumber += Convert.ToUInt32(Ans[1] <<8); //SerialNumber += Convert.ToUInt32(Ans[2] << 16); //SerialNumber += Convert.ToUInt32(Ans[3] << 24); //Version = Convert.ToUInt32(Convert.ToByte(Ans[4])); //Date = Convert.ToUInt32(Convert.ToByte(Ans[5])); //Month = Convert.ToUInt32(Convert.ToByte(Ans[6])); //Year = Convert.ToUInt32(Convert.ToByte(Ans[7])); Ans[0] = 104; if (Hid.HidD_GetFeature(myDeviceHandle, Ans, 16) == false) { return(1); } FamilyCode = Convert.ToUInt32(Ans[0]); FamilyCode += Convert.ToUInt32(Ans[1] << 8); SecurityNumber = Convert.ToUInt32(Ans[2]); SecurityNumber += Convert.ToUInt32(Ans[3] << 8); Version = Convert.ToUInt32(Convert.ToByte(Ans[4])); Date = Convert.ToUInt32(Convert.ToByte(Ans[5])); Month = Convert.ToUInt32(Convert.ToByte(Ans[6])); Year = Convert.ToUInt32(Convert.ToByte(Ans[7])); SerialNumber = Convert.ToUInt32(Ans[8]); SerialNumber += Convert.ToUInt32(Ans[9] << 8); SerialNumber += Convert.ToUInt32(Ans[10] << 16); SerialNumber += Convert.ToUInt32(Ans[11] << 24); ChipType = Convert.ToUInt32(Ans[12]); return(0); } catch (Exception ex) { DisplayException(MODULE_NAME, ex); //throw; return(2); } }
/// <summary> /// Reads the currenly value at port zero /// returns zero on sucess, else non-zero erro /// </summary> public UInt32 ReadPort0(ref UInt32 Port0) { try { Byte[] Ans = new Byte[16]; Ans[0] = 100; if (Hid.HidD_GetFeature(myDeviceHandle, Ans, 8) == false) { return(1); } Port0 = Convert.ToUInt32(Ans[0]); return(0); } catch (Exception ex) { DisplayException(MODULE_NAME, ex); //throw; return(2); } }