Esempio n. 1
0
 private static extern bool EleControl(ref ELE_DEVICE_CONTEXT EleDeviceContext, uint ulCtrlCode, byte[] pucInput, uint ulInputLen, byte[] pucOutput, uint ulOutputLen, ref uint pulActualLen);
Esempio n. 2
0
        public int ReadSenseLock()
        {
            if (strModal == "")
            {
                return(1);
            }

            uint ulErrRet = 0;
            bool bRet     = false;

            ELE_DEVICE_CONTEXT edc = new ELE_DEVICE_CONTEXT();

            edc.ulSize = (uint)Marshal.SizeOf(typeof(ELE_DEVICE_CONTEXT));

            //open first elite e
            bRet = EleOpenFirstDevice(null, null, null, ELE_SHARE_MODE, ref edc);
            if (!bRet)
            {
                ulErrRet = EleGetLastError();
                return(-1);
            }

            //verify pin of the found device
            byte[] Pin = { (byte)'1', (byte)'3', (byte)'5', (byte)'7', (byte)'9', (byte)'2', (byte)'4', (byte)'6', (byte)'8', (byte)'0', (byte)'8', (byte)'8', (byte)'6', (byte)'6', (byte)'2', (byte)'2' };

            bRet = EleVerifyPin(ref edc, Pin);
            if (!bRet)
            {
                ulErrRet = EleGetLastError();
                return(-1);
            }

            //close device
            bRet = EleClose(ref edc);
            if (!bRet)
            {
                ulErrRet = EleGetLastError();
                return(-1);
            }



            byte[] rbuff = new byte[MAXLENGTH];
            uint   rbLen = 0;

            uint uLRet = 0;


            uLRet = EleT2Read(iStart, rbuff, iLength, ref rbLen);

            if (uLRet != ELE_T2_SUCCESS)
            {
                return(1);
            }

            System.Text.UTF8Encoding u8Encoding = new UTF8Encoding();
            SenseLock = u8Encoding.GetString(rbuff);

            int i = SenseLock.IndexOf(strModal);

            if (i == -1)
            {
                return(-1);
            }

            if (i > SenseLock.Length - 1)
            {
                sVersion = "";
                return(0);
            }
            else
            {
                sVersion = SenseLock.Substring(i + strModal.Length, SenseLock.Length - strModal.Length);
                try
                {
                    sVersion = Int32.Parse(sVersion).ToString();
                }
                catch
                {
                    sVersion = "";
                }
            }
            return(0);
        }
Esempio n. 3
0
 private static extern bool EleOpenNextDevice(ref ELE_DEVICE_CONTEXT EleDeviceContext);
Esempio n. 4
0
 private static extern bool EleSetDevieInfo(ref ELE_DEVICE_CONTEXT EleDeviceContext, uint ulFlag, ref int pBuffer, uint ulBufferLen);
Esempio n. 5
0
 public static extern bool EleExecute(ref ELE_DEVICE_CONTEXT EleDeviceContext, string ModuleName, byte[] Input, uint InputLen, byte[] Output, uint OutputLen, ref uint ActualOutputLen);
Esempio n. 6
0
 private static extern bool EleClose(ref ELE_DEVICE_CONTEXT EleDeviceContext);
Esempio n. 7
0
 private static extern bool EleVerifyPin(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] Pin);
Esempio n. 8
0
 private static extern bool EleWriteModule(ref ELE_DEVICE_CONTEXT EleDeviceContext, string ModuleName, byte[] ModuleContent, uint ModuleContentLen, ref uint ActualWrittenLen);
Esempio n. 9
0
 private static extern bool EleNextModuleName(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] pcModuleNameBuffer, uint ulModuleNameBufferLen, ref uint pulModuleNameLen, ref uint pulIndex);
Esempio n. 10
0
 private static extern bool EleOpenFirstDevice(byte[] DeviceNumber, byte[] Desc, byte[] SerialNumber, uint ShareMode, ref ELE_DEVICE_CONTEXT EleDeviceContext);
Esempio n. 11
0
 private static extern bool EleChangeModuleName(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] pcOldModuleName, byte[] pcNewModuleName);
Esempio n. 12
0
 private static extern bool EleReadModule(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] pcModuleName, byte[] pucModuleBuffer, uint ulModuleBufferLen, ref uint pulActuralModuleLen);
Esempio n. 13
0
 private static extern bool EleChangePin(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] pucOldPin, byte[] pucNewPin);
Esempio n. 14
0
 private static extern bool EleUpdate(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] pucPkgContent, uint ulPkgLen);
Esempio n. 15
0
 private static extern bool EleSign(ref ELE_DEVICE_CONTEXT EleDeviceContext, byte[] pucSerial, byte[] pcModuleName, byte[] pucModuleContent, uint ulModuleSize, byte[] pPkgBuffer, uint ulPkgBufferLen, ref uint pulActualPkgLen);