Esempio n. 1
0
        /// <summary>
        /// "High-speed mode get profiles" button pressed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _btnGetProfile_Click(object sender, EventArgs e)
        {
            LJV7IF_GET_PROFILE_REQ req = new LJV7IF_GET_PROFILE_REQ();

            req.byTargetBank = ProfileBank.Active;
            req.byPosMode    = ProfilePos.Current;
            req.dwGetProfNo  = 0;
            req.byGetProfCnt = 10;
            req.byErase      = 0;

            LJV7IF_GET_PROFILE_RSP rsp         = new LJV7IF_GET_PROFILE_RSP();
            LJV7IF_PROFILE_INFO    profileInfo = new LJV7IF_PROFILE_INFO();

            int profileDataSize = MAX_PROFILE_COUNT +
                                  (Marshal.SizeOf(typeof(LJV7IF_PROFILE_HEADER)) + Marshal.SizeOf(typeof(LJV7IF_PROFILE_FOOTER))) / sizeof(int);

            int[] receiveBuffer = new int[profileDataSize * req.byGetProfCnt];

            using (ProgressForm progressForm = new ProgressForm())
            {
                Cursor.Current = Cursors.WaitCursor;

                progressForm.Status = Status.Communicating;
                progressForm.Show(this);
                progressForm.Refresh();

                // Get profiles.
                using (PinnedObject pin = new PinnedObject(receiveBuffer))
                {
                    Rc rc = (Rc)NativeMethods.LJV7IF_GetProfile(DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer,
                                                                (uint)(receiveBuffer.Length * sizeof(int)));
                    if (!CheckReturnCode(rc))
                    {
                        return;
                    }
                }

                // Output profile data
                List <ProfileData> profileDatas = new List <ProfileData>();
                int unitSize = ProfileData.CalculateDataSize(profileInfo);
                for (int i = 0; i < rsp.byGetProfCnt; i++)
                {
                    profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo));
                }

                progressForm.Status = Status.Saving;
                progressForm.Refresh();

                // Save file
                SaveProfile(profileDatas, _txtSavePath.Text);
            }
        }
Esempio n. 2
0
 internal static extern int LJV7IF_GetProfile(int lDeviceId, ref LJV7IF_GET_PROFILE_REQ pReq,
                                              ref LJV7IF_GET_PROFILE_RSP pRsp, ref LJV7IF_PROFILE_INFO pProfileInfo, IntPtr pdwProfileData, uint dwDataSize);