Ejemplo n.º 1
0
        public static IList <DEVICE_STATUS> QueryForList(string tableName, DEVICE_STATUS parameterObject = null)
        {
            Hashtable inparam = new Hashtable();

            if (parameterObject != null)
            {
                if (parameterObject.aDatetime != null)
                {
                    inparam.Add("aDatetime", parameterObject.aDatetime);
                }
            }
            inparam.Add("tableName", tableName);
            return(BaseDA.QueryForList <DEVICE_STATUS>("SelectDEVICE_STATUSQuery", inparam));
        }
Ejemplo n.º 2
0
        public static object Insert(DEVICE_STATUS parameterObject, string tableName)
        {
            Hashtable inparam = new Hashtable();

            if (parameterObject != null)
            {
                if (parameterObject.aDatetime != null)
                {
                    inparam.Add("aDatetime", parameterObject.aDatetime);
                }
                if (parameterObject.dltaH != null)
                {
                    inparam.Add("dltaH", parameterObject.dltaH);
                }
                if (parameterObject.dltaX != null)
                {
                    inparam.Add("dltaX", parameterObject.dltaX);
                }
                if (parameterObject.dltaY != null)
                {
                    inparam.Add("dltaY", parameterObject.dltaY);
                }
                if (parameterObject.GPSIndex != null)
                {
                    inparam.Add("GPSIndex", parameterObject.GPSIndex);
                }
                if (parameterObject.Height != null)
                {
                    inparam.Add("Height", parameterObject.Height);
                }
                if (parameterObject.X != null)
                {
                    inparam.Add("X", parameterObject.X);
                }
                if (parameterObject.Y != null)
                {
                    inparam.Add("Y", parameterObject.Y);
                }
            }
            inparam.Add("tableName", tableName);

            return(BaseDA.Insert2("InsertDEVICE_STATUS", inparam));
        }
Ejemplo n.º 3
0
 public static extern UInt32 LPR_CheckStatus(IntPtr pHandle , ref DEVICE_STATUS pConnStatus);
Ejemplo n.º 4
0
        private void btnCheck_Click(object sender, EventArgs e)
        {
            //while (true)
            {
                DEVICE_STATUS st = new DEVICE_STATUS();

                if (HighLevelInterface.CheckStatus(tbIpAddress.Text, ref st) == Result.OK)
                {
                    lbConnect.Text   = st.IsConnected ? "CONNECTED" : "LISTENING";
                    lbElapsed.Text   = st.GetElapsedTime().ToString();
                    lbKeepAlive.Text = st.IsKeepAlive ? "ON" : "OFF";
                    lbPower.Text     = st.IsPowerOn ? "ON" : "OFF";
                    lbReset.Text     = st.IsErrorReset ? "ON" : "OFF";
                    lbCrcFilter.Text = st.IsCRCFilter ? "ON" : "OFF";
                    tsStatus.Text    = "CheckStatus OK!";
                }
                else
                {
                    lbConnect.Text   = "UNKNOWN";
                    lbElapsed.Text   = "UNKNOWN";
                    lbKeepAlive.Text = "UNKNOWN";
                    lbPower.Text     = "UNKNOWN";
                    lbReset.Text     = "UNKNOWN";
                    lbCrcFilter.Text = "UNKNOWN";
                    tsStatus.Text    = "CheckStatus Failed!";
                }
                bool gpi0 = false, gpi1 = false;
                if (HighLevelInterface.GetGPIStatus(tbIpAddress.Text, ref gpi0, ref gpi1) == Result.OK)
                {
                    lbGPI0.Text   = gpi0 ? "ON" : "OFF";
                    lbGPI1.Text   = gpi1 ? "ON" : "OFF";
                    tsStatus.Text = "CheckGPI1Status OK!";
                }
                else
                {
                    lbGPI0.Text   = "UNKNOWN";
                    lbGPI1.Text   = "UNKNOWN";
                    tsStatus.Text = "CheckGPI1Status Failed!";
                }
                if (HighLevelInterface.GetGPOStatus(tbIpAddress.Text, ref gpi0, ref gpi1) == Result.OK)
                {
                    lbGPO0.Text   = gpi0 ? "ON" : "OFF";
                    lbGPO1.Text   = gpi1 ? "ON" : "OFF";
                    tsStatus.Text = "CheckGPI1Status OK!";
                }
                else
                {
                    lbGPO0.Text   = "UNKNOWN";
                    lbGPO1.Text   = "UNKNOWN";
                    tsStatus.Text = "CheckGPI1Status Failed!";
                }
                GPIOTrigger gpi0Trigger = GPIOTrigger.OFF, gpi1Trigger = GPIOTrigger.OFF;
                if (HighLevelInterface.GetGPIInterrupt(tbIpAddress.Text, ref gpi0Trigger, ref gpi1Trigger) == Result.OK)
                {
                    lbGPI0Interrupt.Text = gpi0Trigger.ToString();
                    lbGPI1Interrupt.Text = gpi1Trigger.ToString();
                    tsStatus.Text        = "GetGPIInterrupt OK!";
                }
                else
                {
                    lbGPI0Interrupt.Text = "UNKNOWN";
                    lbGPI1Interrupt.Text = "UNKNOWN";
                    tsStatus.Text        = "GetGPIInterrupt Failed!";
                }
                Application.DoEvents();
                System.Threading.Thread.Sleep(1);
            }
        }
Ejemplo n.º 5
0
 public static extern UInt32  LPR_CheckStatus(IntPtr pHandle, ref DEVICE_STATUS pConnStatus);
Ejemplo n.º 6
0
        static void Main()
        {
            DEVICE_STATUS s = new DEVICE_STATUS();



            /*for (; ; )
             * {
             *  if (ReaderXP.Connect("192.168.25.207", 30000) != Result.OK)
             *      MessageBox.Show("Error");
             *  ReaderXP.Disconnect();
             * }*/
            /*try
             * {
             *  System.Xml.Serialization.XmlSerializer mySerializer = new System.Xml.Serialization.XmlSerializer(typeof(AntennaList));
             * }
             * catch (Exception ex)
             * {
             *  Console.WriteLine(ex);
             * }*/
            CSLibrary.Constants.Result ret = CSLibrary.Constants.Result.OK;
            Application.EnableVisualStyles();
#if __DISABLE_CS468
            CSLibrary.Diagnostics.CoreDebug.Enable = true;
            XmlLoggingConfiguration xmlConfig = new XmlLoggingConfiguration(System.IO.Path.Combine(HighLevelInterface.CurrentPath, "CS468TagDebug.xml"));
            LogManager.Configuration = xmlConfig;
            tagLogger = LogManager.GetLogger("TAG_DEBUGGER");
#endif
            //First Step
            while (true)
            {
#if NET_BUILD
                using (NetFinderForm finder = new NetFinderForm())
                {
                    if (finder.ShowDialog() == DialogResult.OK)
                    {
                        IP  = finder.ConnectIP;
                        MAC = finder.MAC;
                    }
                    else
                    {
                        goto DEINIT;
                    }
                }
#endif
                CSLibrary.Windows.UI.SplashScreen.Show(CSLibrary.Windows.UI.SplashScreen.CSL.CS203);
                {
#if benchmark
                    Application.DoEvents();

                    DateTime time = DateTime.Now;
                    DateTime time1;

                    //int time = Environment.TickCount;
                    //int time1 = Environment.TickCount;
                    string timediff;

                    if ((ret = ReaderXP.Connect(IP, 30000)) != CSLibrary.Constants.Result.OK)
                    //                    if ((ret = ReaderXP.Connect("USB1", 0)) != CSLibrary.Constants.Result.OK)
                    //#else
                    //                    if ((ret = ReaderXP.Connect()) != CSLibrary.Constants.Result.OK)
                    //#endif
                    {
                        ReaderXP.Disconnect();
                        MessageBox.Show(String.Format("StartupReader Failed{0}", ret));
                        goto DEINIT;
                    }
                    time1 = DateTime.Now;

                    timediff = "Connect time tickcount" + (time1 - time).TotalMilliseconds;
                    MessageBox.Show(timediff);


                    //                    System.Diagnostics.Trace.WriteLine(string.Format("Connect time = {0}", Environment.TickCount - time));
#endif

                    Application.DoEvents();

                    //ReaderXP.EngModeEnable("CSL2006");
                    //ReaderXP.EngDebugModeSetLogFile ("CSLibraryDebug.txt");
                    //ReaderXP.EngDebugModeEnable(HighLevelInterface.DEBUGLEVEL.PERFORMANCE);

                    int time = Environment.TickCount;
#if NET_BUILD
                    if ((ret = ReaderXP.Connect(IP, 20000)) != CSLibrary.Constants.Result.OK)
#else
                    if ((ret = ReaderXP.Connect()) != CSLibrary.Constants.Result.OK)
#endif
                    {
                        ReaderXP.Disconnect();
                        MessageBox.Show(String.Format("StartupReader Failed{0}", ret));
                        goto DEINIT;
                    }
                    System.Diagnostics.Trace.WriteLine(string.Format("Connect time = {0}", Environment.TickCount - time));
                }
                //Load settings

                /*string path = Application.StartupPath;
                 * if (File.Exists(path + @"\settings.txt"))
                 * {
                 *  using (FileStream file = new FileStream(path + @"\settings.txt", FileMode.Open))
                 *  using (StreamReader sr = new StreamReader(file))
                 *  {
                 *      LocalSettings.ServerIP = sr.ReadLine();
                 *      LocalSettings.ServerName = sr.ReadLine();
                 *      LocalSettings.DBName = sr.ReadLine();
                 *      LocalSettings.UserID = sr.ReadLine();
                 *      LocalSettings.Password = sr.ReadLine();
                 *  }
                 * }
                 * else
                 * {
                 *  //Set to default
                 *  LocalSettings.ServerName = "SQLEXPRESS";
                 * }*/


                string MyDocumentFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\CSLReader";

                try
                {
                    System.IO.Directory.CreateDirectory(MyDocumentFolder);
                }
                catch (Exception ex)
                {
                }

                if ((SerialNumber = ReaderXP.GetPCBAssemblyCode()) == null)
                {
                    MessageBox.Show(String.Format("GetPCBAssemblyCode Failed"));
                }

                if (!System.IO.File.Exists(MyDocumentFolder + "\\" + SerialNumber + ".cfg"))
                {
                    LoadDefaultSettings();
                }
                else
                {
                    LoadSettings();
                }

                //Open MainForm and EnableVisualStyles
                Application.Run(new MenuForm());

                /*//Save settings
                 * using (FileStream file = new FileStream(path + @"\settings.txt", FileMode.Create))
                 * using (StreamWriter sw = new StreamWriter(file))
                 * {
                 *  sw.WriteLine(LocalSettings.ServerIP);
                 *  sw.WriteLine(LocalSettings.ServerName);
                 *  sw.WriteLine(LocalSettings.DBName);
                 *  sw.WriteLine(LocalSettings.UserID);
                 *  sw.WriteLine(LocalSettings.Password);
                 * }*/

                ReaderXP.Disconnect();
#if USB_BUILD
                break;
#endif
            }
DEINIT:
            CSLibrary.Windows.UI.SplashScreen.Stop();
        }