/// <summary>
        /// Initialize Camera config string
        /// </summary>
        private void InitializeCameraDevice()
        {
            CoreComponent component     = null;
            string        cameraDevices = "";

            //get camera friendly names from
            try
            {
                component     = new CoreComponent();
                cameraDevices = component.GetCameraDevice();
            }
            catch (Exception ex)
            {
                Log.LogError("Cannot get Camera devices: " + ex.ToString());
            }
            finally
            {
                if (component != null)
                {
                    component.Dispose();
                    component = null;
                }
            }
            CameraConfig.Text = cameraDevices;
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes strings from SystemFunctionTestClass resources
        /// </summary>
        /// <param name="BTPara">BT device names list will need to be scaned.
        /// If users configure the BT devices list and scan time on SFTConfig.xml, this test will be auto-judge pass/fail.</param>
        private void BTScan(string[] BTPara)
        {
            string        BTInfo;
            bool          bFlag     = false;
            CoreComponent component = null;

            try
            {
                component = new CoreComponent();
                BTInfo    = component.TestBT(TestDuration);
            }
            finally
            {
                if (component != null)
                {
                    component.Dispose();
                    component = null;
                }
            }

            char[]   tok   = new Char[] { '\n' };
            string[] split = BTInfo.Split(tok, StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < split.Length; i++)
            {
                this.BTInFoList.Items.Add(split[i]);
                this.BTInFoList.Items.Add("\n");
                Log.LogComment(DllLog.Log.LogLevel.Info, "Scaned BT device: " + split[i]);
            }

            if (BTPara != null) // If BTlist para is not empty, test item will auto-judge pass/fail
            {
                for (int i = 0; i < BTPara.Length; i++)
                {
                    if (BTInfo.IndexOf(BTPara[i], StringComparison.Ordinal) >= 0)
                    {
                        bFlag = true;
                    }
                    else
                    {
                        bFlag = false;
                        break;
                    }
                }
                if (bFlag)
                {
                    Program.ExitApplication(0);
                }
                else
                {
                    Program.ExitApplication(255);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Form load event. On load register touch window and DisableTouch
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">The <see cref="object"/> instance containing the event data.</param>
        private void OnLoadHandler(Object sender, EventArgs e)
        {
            try
            {
                // Registering the window for multi-touch, using the default settings.
                // p/invoking into user32.dll
                if (!NativeMethods.RegisterTouchWindow(this.Handle, 0))
                {
                    Log.LogError("Could not register window for multi-touch");
                }
            }
            catch (Exception exception)
            {
                Log.LogError("RegisterTouchWindow API not available");
                Log.LogError(exception.ToString());
                MessageBox.Show("RegisterTouchWindow API not available", "MTScratchpadWMTouch ERROR",
                                MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
                Log.LogError("RegisterTouchWindow API not available");
            }

            CoreComponent component = null;

            try
            {
                component = new CoreComponent();
                component.DisableTouch(NativeMethods.GetActiveWindow());
            }
            catch (Exception ex)
            {
                Log.LogError("Cannot disable edge UI " + ex.ToString());
            }
            finally
            {
                if (component != null)
                {
                    component.Dispose();
                    component = null;
                }
            }
        }
        /// <summary>
        /// A thread function for brightness and it will call the function in the DllComponent.
        /// </summary>
        private void _ThreadFunction()
        {
            System.Threading.Thread.Sleep(500);
            Int32         hr;
            CoreComponent component = null;

            try
            {
                component = new CoreComponent();
                hr        = component.TestBrightness();
            }
            finally
            {
                if (component != null)
                {
                    component.Dispose();
                    component = null;
                }
            }
            PassBtn.Visible  = true;
            FailBtn.Visible  = true;
            RetryBtn.Visible = true;
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes strings from SystemFunctionTestClass resources
        /// </summary>
        /// <param name="APList">WiFi AP list will need to be researched and signal strength SPEC.
        /// If users configure the WiFi AP list and signal strength SPEC on SFTConfig.xml, this test will be auto-judge pass/fail.</param>
        public void WifiInformation(string[] APList, int iIfConnection)
        {
            string        WiFiInfo;
            string        ConnectAPSSID;
            bool          bFlag        = false;
            int           APCheckCount = 0;
            CoreComponent component    = null;

            try
            {
                component = new CoreComponent();
                if (APList == null)
                {
                    ConnectAPSSID = null;
                }
                else
                {
                    ConnectAPSSID = APList[0];
                }

                Log.LogComment(DllLog.Log.LogLevel.Info, "The SSID for wifi connection:" + ConnectAPSSID);
                WiFiInfo = component.TestWiFi(ConnectAPSSID, iIfConnection);
                if (WiFiInfo.IndexOf("WiFi_Connect_Fail", StringComparison.Ordinal) >= 0)
                {
                    APCheckCount = 999;
                    Log.LogComment(DllLog.Log.LogLevel.Error, "The SSID for wifi connection status : Fail");
                }
            }
            finally
            {
                if (component != null)
                {
                    component.Dispose();
                    component = null;
                }
            }

            char[]   tok   = new Char[] { '\n', ',' };
            string[] split = WiFiInfo.Split(tok, StringSplitOptions.RemoveEmptyEntries); // Query WiFi informarion from Dll.
            // Parser the scaned AP and signal into array
            for (int i = 0; i < split.Length; i++)
            {
                APScan[iWiFiCount] = split[i];
                i++;
                WifiListSignal[iWiFiCount] = Int32.Parse(split[i].ToString(), CultureInfo.InvariantCulture);
                iWiFiCount++;
            }
            // Add wifi signal amd SSID into dataview object
            for (int i = 0; i < iWiFiCount; i++)
            {
                DataGridViewRowCollection rows = WifiInfoGrid.Rows;
                rows.Add(new Object[] { WifiListSignal[i], APScan[i] });
                Log.LogComment(DllLog.Log.LogLevel.Info, "Signal = " + WifiListSignal[i] + " , SSID = " + APScan[i]);
            }

            if (APList != null)
            {
                for (int k = 0; k < APList.Length; k++)
                {
                    for (int i = 0; i < iWiFiCount; i++)
                    {
                        if (APScan[i].IndexOf(APList[k], StringComparison.Ordinal) >= 0 && WifiListSignal[i] > iSignalSpec)
                        {
                            APCheckCount++;
                            bFlag = true;
                            break;
                        }
                    }
                }
                if (bFlag && APCheckCount == APList.Length)  // All listed AP need to be searched.
                {
                    Program.ExitApplication(0);
                }
                else
                {
                    Program.ExitApplication(255);
                }
            }
        }