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);
 internal static extern int LJV7IF_PreStartHighSpeedDataCommunication(
 int lDeviceId, ref LJV7IF_HIGH_SPEED_PRE_START_REQ pReq,
 ref LJV7IF_PROFILE_INFO pProfileInfo);
 internal static extern int LJV7IF_GetProfileAdvance(int lDeviceId, ref LJV7IF_PROFILE_INFO pProfileInfo,
 IntPtr pdwProfileData, uint dwDataSize, [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);
 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);
 internal static extern int LJV7IF_GetBatchProfileAdvance(int lDeviceId, ref LJV7IF_GET_BATCH_PROFILE_ADVANCE_REQ pReq,
 ref LJV7IF_GET_BATCH_PROFILE_ADVANCE_RSP pRsp, ref LJV7IF_PROFILE_INFO pProfileInfo,
 IntPtr pdwBatchData, uint dwDataSize, [Out]LJV7IF_MEASURE_DATA[] pBatchMeasureData, [Out]LJV7IF_MEASURE_DATA[] pMeasureData);
Пример #7
0
 private void button_connect_Click(object sender, EventArgs e)
 {
     Rc rc2;
         LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO();
         NativeMethods.LJV7IF_StopHighSpeedDataCommunication(Define.DEVICE_ID);
         NativeMethods.LJV7IF_HighSpeedDataCommunicationFinalize(Define.DEVICE_ID);
         ThreadSafeBuffer.Clear(Define.DEVICE_ID);
         LJV7IF_HIGH_SPEED_PRE_START_REQ req = new LJV7IF_HIGH_SPEED_PRE_START_REQ();
         try
         {
             _ethernetConfig.abyIpAddress = new byte[] {
                 Convert.ToByte(textbox_ipaddress1.Text),
                 Convert.ToByte(textbox_ipaddress2.Text),
                 Convert.ToByte(textbox_ipaddress3.Text),
                 Convert.ToByte(textbox_ipaddress4.Text)
             };
             rc2 = (Rc)NativeMethods.LJV7IF_HighSpeedDataEthernetCommunicationInitalize(Define.DEVICE_ID, ref _ethernetConfig,
                 Convert.ToUInt16(textbox_hsport.Text), _callback, Convert.ToUInt32(textbox_frequency.Text), (uint)Define.DEVICE_ID);
             if (rc2 != Rc.Ok)
             {
                 textBox_status.AppendText("High Speed Data Communication Initialize Failed...\n");
                 return;
             }
             req.bySendPos = Convert.ToByte(textbox_stprofile.Text);
         }
         catch (FormatException ex)
         {
             textBox_status.Text = ex.ToString()+"\n";
             WriteLog(ex.ToString() + Environment.NewLine + "   at " + convertTimeZone(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).ToString()) + "\n");
             textBox_status.AppendText("Exception Occured. Please refer log file." + "\n");
             return;
         }
         catch (OverflowException ex)
         {
             textBox_status.Text = ex.ToString() + "\n";
             WriteLog(ex.ToString() + Environment.NewLine + "   at " + convertTimeZone(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).ToString()) + "\n");
             textBox_status.AppendText("Exception Occured. Please refer log file." + "\n");
             return;
         }
         rc2 = (Rc)NativeMethods.LJV7IF_PreStartHighSpeedDataCommunication(Define.DEVICE_ID, ref req, ref profileInfo);
         if (rc2 != Rc.Ok)
         {
             return;
         }
         rc2 = (Rc)NativeMethods.LJV7IF_StartHighSpeedDataCommunication(Define.DEVICE_ID);
         if (rc2 != Rc.Ok)
         {
             return;
         }
         highSpeedTimer.Start();
 }
Пример #8
0
        private void button_connect_Click(object sender, EventArgs e)
        {
            if (textbox_filename.Text.Trim().Equals(string.Empty))
                {
                    textBox_status.AppendText("Choose File to add Sensor Data...\n");
                    return;
                }
                Rc rc2;
                NativeMethods.LJV7IF_StopHighSpeedDataCommunication(Define.DEVICE_ID);
                NativeMethods.LJV7IF_HighSpeedDataCommunicationFinalize(Define.DEVICE_ID);
                ThreadSafeBuffer.Clear(Define.DEVICE_ID);
                LJV7IF_HIGH_SPEED_PRE_START_REQ req = new LJV7IF_HIGH_SPEED_PRE_START_REQ();
                try
                {
                    _ethernetConfig.abyIpAddress = new byte[] {
                        Convert.ToByte(textbox_ipaddress1.Text),
                        Convert.ToByte(textbox_ipaddress2.Text),
                        Convert.ToByte(textbox_ipaddress3.Text),
                        Convert.ToByte(textbox_ipaddress4.Text)
                    };
                    rc2 = (Rc)NativeMethods.LJV7IF_HighSpeedDataEthernetCommunicationInitalize(Define.DEVICE_ID, ref _ethernetConfig,
                        Convert.ToUInt16(textbox_hsport.Text), _callback, Convert.ToUInt32(textbox_frequency.Text), (uint)Define.DEVICE_ID);
                    if (rc2 != Rc.Ok)
                        textBox_status.AppendText("High Speed Data Communication Initialize Failed...\n");
                        return;
                    req.bySendPos = Convert.ToByte(textbox_stprofile.Text);
                }
                catch (FormatException ex)
                {
                    textBox_status.Text = ex.ToString()+"\n";
                    return;
                }
                catch (OverflowException ex)
                {
                    textBox_status.Text = ex.ToString() + "\n";
                    return;
                }
                LJV7IF_PROFILE_INFO profileInfo = new LJV7IF_PROFILE_INFO();
                rc2 = (Rc)NativeMethods.LJV7IF_PreStartHighSpeedDataCommunication(Define.DEVICE_ID, ref req, ref profileInfo);
                if (rc2 != Rc.Ok) return;

                rc2 = (Rc)NativeMethods.LJV7IF_StartHighSpeedDataCommunication(Define.DEVICE_ID);
                if (rc2 != Rc.Ok) return;
                highSpeedTimer.Start();
        }
Пример #9
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_PROFILE_INFO profileInfo)
        {
            StringBuilder sb = new StringBuilder();

            // Profile information of the profile obtained
            sb.AppendLine(string.Format(@"  Profile Data Num			: {0}", profileInfo.byProfileCnt));
            string envelope = profileInfo.byEnvelope == 0
                ? @"OFF"
                : @"ON";
            sb.AppendLine(string.Format(@"  Envelope			: {0}", envelope));
            sb.AppendLine(string.Format(@"  Profile Data Points			: {0}", profileInfo.wProfDataCnt));
            sb.AppendLine(string.Format(@"  X coordinate of the first point	: {0}", profileInfo.lXStart));
                sb.Append(string.Format(@"  X-direction interval		: {0}", profileInfo.lXPitch));

            return sb;
        }