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_STORAGE_RSP storageRsp)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format(@"  StartNo	: {0}", storageRsp.dwStartNo));
            sb.AppendLine(string.Format(@"  DataCnt	: {0}", storageRsp.dwDataCnt));
            sb.Append(ConvertToLogString(storageRsp.stBaseTime).ToString());

            return(sb);
        }
Example #2
0
        /*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());
            }
        }
Example #3
0
 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);
Example #4
0
 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);