Example #1
0
        /// <summary>
        /// Get the string for log output.
        /// </summary>
        /// <param name="obj">Structure that you want to convert to a string</param>
        /// <returns>String for log output</returns>
        public static StringBuilder ConvertToLogString(LJV7IF_GET_BATCH_PROFILE_STORAGE_RSP rsp)
        {
            StringBuilder sb = new StringBuilder();

            // Profile information of the profile obtained
            sb.AppendLine(string.Format(@"  BatchNo		 : {0}", rsp.dwGetBatchNo));
            sb.AppendLine(string.Format(@"  BatchProfCnt	 : {0}", rsp.dwGetBatchProfCnt));
            sb.AppendLine(string.Format(@"  BatchTopProfNo	 : {0}", rsp.dwGetBatchTopProfNo));
            sb.AppendLine(string.Format(@"  ProfCnt		 : {0}", rsp.byGetProfCnt));
            sb.Append(ConvertToLogString(rsp.stBaseTime).ToString());

            return(sb);
        }
Example #2
0
        internal static extern int LJV7IF_GetStorageBatchProfile(int lDeviceId,
		ref LJV7IF_GET_BATCH_PROFILE_STORAGE_REQ pReq, ref LJV7IF_STORAGE_INFO pStorageInfo,
		ref LJV7IF_GET_BATCH_PROFILE_STORAGE_RSP pRes, ref LJV7IF_PROFILE_INFO pProfileInfo,
		IntPtr pdwData, uint dwDataSize, ref uint pTimeOffset, [Out]LJV7IF_MEASURE_DATA[] pMeasureData);
 internal static extern int LJV7IF_GetStorageBatchProfile(int lDeviceId,
                                                          ref LJV7IF_GET_BATCH_PROFILE_STORAGE_REQ pReq, ref LJV7IF_STORAGE_INFO pStorageInfo,
                                                          ref LJV7IF_GET_BATCH_PROFILE_STORAGE_RSP pRes, ref LJV7IF_PROFILE_INFO pProfileInfo,
                                                          IntPtr pdwData, uint dwDataSize, ref uint pTimeOffset, [Out] LJV7IF_MEASURE_DATA[] pMeasureData);
Example #4
0
        /// <summary>
        /// "GetStorageBatchProfile" button clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGetStorageBatchProfile_Click(object sender, EventArgs e)
        {
            _sendCommand = SendCommand.GetStorageBatchProfile;

            using (GetStorageBatchProfileForm getStorageBatchProfileForm = new GetStorageBatchProfileForm())
            {
                if (DialogResult.OK == getStorageBatchProfileForm.ShowDialog())
                {
                    _deviceData[_currentDeviceId].ProfileData.Clear();
                    _deviceData[_currentDeviceId].MeasureData.Clear();
                    _measureDatas.Clear();
                    // Set the function data
                    LJV7IF_GET_BATCH_PROFILE_STORAGE_REQ req = getStorageBatchProfileForm.Req;
                    LJV7IF_STORAGE_INFO storageInfo = new LJV7IF_STORAGE_INFO();
                    LJV7IF_GET_BATCH_PROFILE_STORAGE_RSP rsp = new LJV7IF_GET_BATCH_PROFILE_STORAGE_RSP();
                    LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO();
                    uint oneDataSize = GetOneProfileDataSize() + (uint)(Utility.GetByteSize(Utility.TypeOfStruct.MEASURE_DATA) * (uint)NativeMethods.MeasurementDataCount);
                    uint allDataSize = oneDataSize * getStorageBatchProfileForm.Req.byGetProfCnt;
                    LJV7IF_MEASURE_DATA[] measureData = new LJV7IF_MEASURE_DATA[NativeMethods.MeasurementDataCount];
                    int[] profileData = new int[allDataSize / Marshal.SizeOf(typeof(int))];
                    uint offsetTime = 0;

                    using (PinnedObject pin = new PinnedObject(profileData))
                    {
                        // Send the command
                        int rc = NativeMethods.LJV7IF_GetStorageBatchProfile(_currentDeviceId, ref req, ref storageInfo,
                            ref rsp, ref profileInfo, pin.Pointer, allDataSize, ref offsetTime, measureData);
                        // @Point
                        // # Terminology
                        //  * Base time … time expressed with 32 bits (<- the time when the setting was changed)
                        //  * Accumulated date and time	 … counter value that indicates the elapsed time, in units of 10 ms, from the base time
                        // # The accumulated date and time are stored in the accumulated data.
                        // # The accumulated time of read data is calculated as shown below.
                        //   Accumulated time = "base time (stBaseTime of LJV7IF_GET_STORAGE_RSP)" + "accumulated date and time × 10 ms"

                        // @Point
                        // # When reading all the profiles from a single batch, the specified number of profiles may not be read.
                        // # To read the remaining profiles after the first set of profiles have been read,
                        //   specify the batch number (dwGetBatchNo), and then set the number to start reading profiles
                        //   from (dwGetTopProfNo) and the number of profiles to read (byGetProfCnt) to values
                        //   that specify a range of profiles that have not been read to read the profiles in order.
                        // # For the basic code, see "btnGetBatchProfileEx_Click."

                        // Result output
                        AddLogResult(rc, Resources.SID_GET_STORAGE_BATCH_PROFILE);
                        if (rc == (int)Rc.Ok)
                        {
                            AnalyzeBatchData((int)rsp.byGetProfCnt, ref profileInfo, false, profileData, 0);

                            _measureDatas.Add(new MeasureData(offsetTime, measureData));
                            // Response data display
                            AddLog(Utility.ConvertToLogString(storageInfo).ToString());
                            AddLog(Utility.ConvertToLogString(rsp).ToString());
                            AddLog(Utility.ConvertToLogString(profileInfo).ToString());
                            AddLog(string.Format(@"offsetTime	:{0}", offsetTime));
                        }
                    }
                }
            }
        }
Example #5
0
        /// <summary>
        /// Get the string for log output.
        /// </summary>
        /// <param name="obj">Structure that you want to convert to a string</param>
        /// <returns>String for log output</returns>
        public static StringBuilder ConvertToLogString(LJV7IF_GET_BATCH_PROFILE_STORAGE_RSP rsp)
        {
            StringBuilder sb = new StringBuilder();

            // Profile information of the profile obtained
            sb.AppendLine(string.Format(@"  BatchNo		 : {0}", rsp.dwGetBatchNo));
            sb.AppendLine(string.Format(@"  BatchProfCnt	 : {0}", rsp.dwGetBatchProfCnt));
            sb.AppendLine(string.Format(@"  BatchTopProfNo	 : {0}", rsp.dwGetBatchTopProfNo));
            sb.AppendLine(string.Format(@"  ProfCnt		 : {0}", rsp.byGetProfCnt));
            sb.Append(ConvertToLogString(rsp.stBaseTime).ToString());

            return sb;
        }