private XmlElement GetBatchHighSpeedProfileValues() { // Specify the target batch to get. LJV7IF_GET_BATCH_PROFILE_REQ req = new LJV7IF_GET_BATCH_PROFILE_REQ(); req.byTargetBank = (byte)ProfileBank.Active; req.byPosMode = (byte)BatchPos.Commited; req.dwGetBatchNo = 0; req.dwGetProfNo = 0; req.byGetProfCnt = byte.MaxValue; req.byErase = 0; LJV7IF_GET_BATCH_PROFILE_RSP rsp = new LJV7IF_GET_BATCH_PROFILE_RSP(); LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO(); int profileDataSize = Define.MAX_PROFILE_COUNT + (Marshal.SizeOf(typeof(LJV7IF_PROFILE_HEADER)) + Marshal.SizeOf(typeof(LJV7IF_PROFILE_FOOTER))) / Marshal.SizeOf(typeof(int)); int[] receiveBuffer = new int[profileDataSize * req.byGetProfCnt]; List<ProfileData> profileDatas = new List<ProfileData>(); // Get profiles using (PinnedObject pin = new PinnedObject(receiveBuffer)) { Rc rc = (Rc)NativeMethods.LJV7IF_GetBatchProfile(Define.DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer, (uint)(receiveBuffer.Length * Marshal.SizeOf(typeof(int)))); if (rc != Rc.Ok) throw new Exception("Cannot Read Batch High Speed Profile"); // Output the data of each profile int unitSize = ProfileData.CalculateDataSize(profileInfo); for (int i = 0; i < rsp.byGetProfCnt; i++) { profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo)); } // Get all profiles within the batch. req.byPosMode = (byte)BatchPos.Spec; req.dwGetBatchNo = rsp.dwGetBatchNo; do { // Update the get profile position req.dwGetProfNo = rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt; req.byGetProfCnt = (byte)Math.Min((uint)(byte.MaxValue), (rsp.dwCurrentBatchProfCnt - req.dwGetProfNo)); rc = (Rc)NativeMethods.LJV7IF_GetBatchProfile(Define.DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer, (uint)(receiveBuffer.Length * Marshal.SizeOf(typeof(int)))); if (rc != Rc.Ok) throw new Exception("Cannot Read Batch High Speed Profile"); for (int i = 0; i < rsp.byGetProfCnt; i++) { profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo)); } } while (rsp.dwGetBatchProfCnt != (rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt)); } return GetHighSpeedProfileValueXML(profileDatas); }
internal static extern int LJV7IF_GetBatchProfile(int lDeviceId, ref LJV7IF_GET_BATCH_PROFILE_REQ pReq, ref LJV7IF_GET_BATCH_PROFILE_RSP pRsp, ref LJV7IF_PROFILE_INFO pProfileInfo, IntPtr pdwBatchData, uint dwDataSize);