コード例 #1
0
ファイル: LJVWrapper.cs プロジェクト: amittyyy/COM-Module
        /*Auther: Amity Timalsina
         * Date  : 11/18/2015
         * Reson : Read and Get the data from the navigator controller to the file in specified location. */

        #region getstoragedata

        /// <summary>
        /// "Amity:GetStorageData" button clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public string GetStorageData_value()
        {
            _sendCommand = SendCommand.GetStorageData;
            GetStorageDataForm getStorageData = new GetStorageDataForm();

            _measureDatas.Clear();
            LJV7IF_GET_STORAGE_REQ req = getStorageData.Req;
            // @Point
            // † dwReadArea is the target surface to read.
            //    The target surface to read indicates where in the internal memory usage area to read.
            // † The method to use in specifying dwReadArea varies depending on how internal memory is allocated.
            //   * Double buffer
            //      0 indicates the active surface, 1 indicates surface A, and 2 indicates surface B.
            //   * Entire area (overwrite)
            //      Fixed to 1
            //   * Entire area (do not overwrite)
            //      After a setting modification, data is saved in surfaces 1, 2, 3, and so on in order, and 0 is set as the active surface.
            // † For details, see "9.2.9.2 Internal memory."

            LJV7IF_STORAGE_INFO    storageInfo = new LJV7IF_STORAGE_INFO();
            LJV7IF_GET_STORAGE_RSP rsp         = new LJV7IF_GET_STORAGE_RSP();
            uint oneDataSize = (uint)(Marshal.SizeOf(typeof(uint)) + (uint)Utility.GetByteSize(Utility.TypeOfStruct.MEASURE_DATA) * (uint)NativeMethods.MeasurementDataCount);
            uint allDataSize = Math.Min(LJV_Dllconsolesample.Define.READ_DATA_SIZE, oneDataSize * getStorageData.Req.dwDataCnt);

            byte[] receiveData = new byte[allDataSize];

            using (PinnedObject pin = new PinnedObject(receiveData))
            {
                int rc = NativeMethods.LJV7IF_GetStorageData(0, ref req, ref storageInfo, ref rsp, pin.Pointer, allDataSize);
                AddLogResult(rc, Resources.SID_GET_STORAGE_DATA);
                // @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"

                if (rc == (int)Rc.Ok)
                {
                    // Temporarily retain the get data.
                    int byteSize = MeasureData.GetByteSize();
                    for (int i = 0; i < (int)rsp.dwDataCnt; i++)
                    {
                        _measureDatas.Add(new MeasureData(receiveData, byteSize * i));
                    }

                    //// Response data display
                    //AddLog(Utility.ConvertToLogString(storageInfo).ToString());
                    //AddLog(Utility.ConvertToLogString(rsp).ToString());
                }
                return(rc.ToString());
            }
        }
コード例 #2
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_STORAGE_INFO storageInfo)
        {
            StringBuilder sb = new StringBuilder();

            string status = string.Empty;

            switch (storageInfo.byStatus)
            {
            case STORAGE_INFO_STATUS_EMPTY:
                status = @"EMPTY";
                break;

            case STORAGE_INFO_STATUS_STORING:
                status = @"STORING";
                break;

            case STORAGE_INFO_STATUS_FINISHED:
                status = @"FINISHED";
                break;

            default:
                status = @"UNEXPECTED";
                break;
            }
            sb.AppendLine(string.Format(@"  Status		: {0}", status));
            sb.AppendLine(string.Format(@"  ProgNo		: {0}", storageInfo.byProgramNo));
            string target = string.Empty;;

            switch (storageInfo.byTarget)
            {
            case STORAGE_INFO_TARGET_DATA:
                target = @"DATA";
                break;

            case STORAGE_INFO_TARGET_PROFILE:
                target = @"PROFILE";
                break;

            case STORAGE_INFO_TARGET_BATCH:
                target = @"BATCH PROFILE";
                break;

            default:
                target = @"UNEXPECTED";
                break;
            }
            sb.AppendLine(string.Format(@"  Target		: {0}", target));
            sb.Append(string.Format(@"  StorageCnt	: {0}", storageInfo.dwStorageCnt));

            return(sb);
        }
コード例 #3
0
ファイル: NativeMethods.cs プロジェクト: amittyyy/COM-Module
 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);
コード例 #4
0
ファイル: NativeMethods.cs プロジェクト: amittyyy/COM-Module
 internal static extern int LJV7IF_GetStorageProfile(int lDeviceId, ref LJV7IF_GET_STORAGE_REQ pReq,
                                                     ref LJV7IF_STORAGE_INFO pStorageInfo, ref LJV7IF_GET_STORAGE_RSP pRes,
                                                     ref LJV7IF_PROFILE_INFO pProfileInfo, IntPtr pdwData, uint dwDataSize);
コード例 #5
0
ファイル: NativeMethods.cs プロジェクト: amittyyy/COM-Module
 internal static extern int LJV7IF_GetStorageData(int lDeviceId, ref LJV7IF_GET_STORAGE_REQ pReq,
                                                  ref LJV7IF_STORAGE_INFO pStorageInfo, ref LJV7IF_GET_STORAGE_RSP pRsp, IntPtr pdwData, uint dwDataSize);
コード例 #6
0
ファイル: NativeMethods.cs プロジェクト: amittyyy/COM-Module
 internal static extern int LJV7IF_GetStorageStatus(int lDeviceId, ref LJV7IF_GET_STRAGE_STATUS_REQ pReq,
                                                    ref LJV7IF_GET_STRAGE_STATUS_RSP pRsp, ref LJV7IF_STORAGE_INFO pStorageInfo);