コード例 #1
0
        private XmlElement GetProfileAdvanceValues()
        {
            LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO();
            LJV7IF_MEASURE_DATA[] measureData = new LJV7IF_MEASURE_DATA[NativeMethods.MeasurementDataCount];

            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];	 // 3,207 (total of the header, the footer, and the 3,200 data entries)
            using (PinnedObject pin = new PinnedObject(receiveBuffer))
            {
                Rc rc = (Rc)NativeMethods.LJV7IF_GetProfileAdvance(Define.DEVICE_ID, ref profileInfo, pin.Pointer,
                (uint)(receiveBuffer.Length * Marshal.SizeOf(typeof(int))), measureData);
                if (rc != Rc.Ok) throw new Exception("Cannot Read Profile Advance Data");
            }
            List<ProfileData> profileDatas = new List<ProfileData>();
            // Output the data of each profile
            profileDatas.Add(new ProfileData(receiveBuffer, 0, profileInfo));
            return GetProfileAdvanceValueXML(new MeasureData(measureData), profileDatas);
        }
コード例 #2
0
 private XmlElement GetMeasurementValues()
 {
     LJV7IF_MEASURE_DATA[] measureData = new LJV7IF_MEASURE_DATA[NativeMethods.MeasurementDataCount];
     Rc rc = (Rc)NativeMethods.LJV7IF_GetMeasurementValue(Define.DEVICE_ID, measureData);
     if (rc != Rc.Ok) throw new Exception("Cannot Get Measurement Value");
     MeasureData data = new MeasureData(measureData);
     return GetMeasurementValueXML(data);
 }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="offsetTime">Elapsed time</param>
 /// <param name="data">Measurement results</param>
 public MeasureData(uint offsetTime, LJV7IF_MEASURE_DATA[] data)
 {
     _offsetTime = offsetTime;
     _data = data;
 }
コード例 #4
0
        private XmlElement GetBatchProfileAdvanceValues()
        {
            LJV7IF_GET_BATCH_PROFILE_ADVANCE_REQ req = new LJV7IF_GET_BATCH_PROFILE_ADVANCE_REQ();
            req.byPosMode = (byte)BatchPos.Commited;
            req.dwGetBatchNo = 0;
            req.dwGetProfNo = 0;
            req.byGetProfCnt = byte.MaxValue;

            LJV7IF_GET_BATCH_PROFILE_ADVANCE_RSP rsp = new LJV7IF_GET_BATCH_PROFILE_ADVANCE_RSP();
            LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO();
            LJV7IF_MEASURE_DATA[] batchMeasureData = new LJV7IF_MEASURE_DATA[NativeMethods.MeasurementDataCount];
            LJV7IF_MEASURE_DATA[] measureData = new LJV7IF_MEASURE_DATA[NativeMethods.MeasurementDataCount];

            int profileDataSize = Define.MAX_PROFILE_COUNT +
                (Marshal.SizeOf(typeof(LJV7IF_PROFILE_HEADER)) + Marshal.SizeOf(typeof(LJV7IF_PROFILE_FOOTER))) / Marshal.SizeOf(typeof(int));
            int measureDataSize = Marshal.SizeOf(typeof(LJV7IF_MEASURE_DATA)) * NativeMethods.MeasurementDataCount / Marshal.SizeOf(typeof(int));
            int[] receiveBuffer = new int[(profileDataSize + measureDataSize) * req.byGetProfCnt];

            List<ProfileData> profileDatas = new List<ProfileData>();
            // Get profiles.
            using (PinnedObject pin = new PinnedObject(receiveBuffer))
            {
                Rc rc = (Rc)NativeMethods.LJV7IF_GetBatchProfileAdvance(Define.DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer,
                    (uint)(receiveBuffer.Length * Marshal.SizeOf(typeof(int))), batchMeasureData, measureData);
                if (rc != Rc.Ok) throw new Exception("Cannot Read Batch Profile Advance Data");

                // Output the data of each profile
                int unitSize = ProfileData.CalculateDataSize(profileInfo) + measureDataSize;
                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.dwGetBatchProfCnt - req.dwGetProfNo));

                    rc = (Rc)NativeMethods.LJV7IF_GetBatchProfileAdvance(Define.DEVICE_ID, ref req, ref rsp, ref profileInfo, pin.Pointer,
                        (uint)(receiveBuffer.Length * Marshal.SizeOf(typeof(int))), batchMeasureData, measureData);
                    if (rc != Rc.Ok) throw new Exception("Cannot Read Batch Profile Advance Data");
                    for (int i = 0; i < rsp.byGetProfCnt; i++)
                    {
                        profileDatas.Add(new ProfileData(receiveBuffer, unitSize * i, profileInfo));
                    }
                } while (rsp.dwGetBatchProfCnt != (rsp.dwGetBatchTopProfNo + rsp.byGetProfCnt));
            }
            return GetBatchProfileAdvanceValueXML(new MeasureData(batchMeasureData),new MeasureData(measureData),profileDatas);
        }
コード例 #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="data">Measurement results</param>
 public MeasureData(LJV7IF_MEASURE_DATA[] data)
 {
     _data = data;
 }