Beispiel #1
0
 public BarcodeControl1()
 {
     InitializeComponent();
     try
     {
         System.Diagnostics.Debug.WriteLine("BarcodeControl1 loading...");
         bcr              = new BarcodeReader();
         bcr.BarcodeRead += new BarcodeReadEventHandler(bcr_BarcodeRead);
         bcr.ThreadedRead(true);
         Intermec.DeviceManagement.SmartSystem.ITCSSApi ssApi = new Intermec.DeviceManagement.SmartSystem.ITCSSApi();
         StringBuilder sb   = new StringBuilder(1024);
         uint          uErr = 0;
         string        sXml = "<Subsystem Name=\"Data Collection\">";
         sXml += "<Group Name=\"Scanners\" Instance=\"0\">";
         sXml += "<Group Name=\"Scanner Settings\">";
         sXml += "<Field Name=\"Hardware trigger\">1</Field>";
         sXml += "</Group>";
         sXml += "</Group>";
         sXml += "</Subsystem>";
         int iSize = sb.Capacity;
         uErr = ssApi.Set(sXml, sb, ref iSize, 3000);
         if (uErr != Intermec.DeviceManagement.SmartSystem.ITCSSErrors.E_SS_SUCCESS)
         {
             System.Diagnostics.Debug.WriteLine("could not change HardwareTrigger: 0x" + uErr.ToString("X"));
             MessageBox.Show("could not change HardwareTrigger");
         }
         System.Diagnostics.Debug.WriteLine("...BarcodeControl1 loaded");
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception: " + ex.Message);
     }
 }
Beispiel #2
0
        public wireless()
        {
            doLog("wireless class started");
            ITCSSApi = new Intermec.DeviceManagement.SmartSystem.ITCSSApi();
            if (!getBtPower())
            {
                powerBT();
            }
            if (!getCellPower())
            {
                powerCell();
            }

            thread      = new Thread(new ThreadStart(checkThread));
            thread.Name = "wireless checkthread";
            thread.Start();
        }
Beispiel #3
0
            private bool readIntermecXML()
            {
                bool bRet = false;
                Intermec.DeviceManagement.SmartSystem.ITCSSApi _ssAPI = new Intermec.DeviceManagement.SmartSystem.ITCSSApi();
                string sXML = "";

                int sbSize = 4000;
                StringBuilder sbRet = new StringBuilder(sbSize);
                uint uRes = _ssAPI.Get(sXML, sbRet, ref sbSize, 3000);
                if (uRes == Intermec.DeviceManagement.SmartSystem.ITCSSErrors.E_SS_SUCCESS)
                {
                    bRet = true;
                }
                return bRet;
            }
Beispiel #4
0
        public string getInfo(healthInfo hiInfo, ref uint uError)
        {
            string sReturn    = "";
            string ssHWconfig = "<Subsystem Name=\"Device Monitor\">\r\n";

            ssHWconfig += "<Group Name=\"ITCHealth\">\r\n";
            ssHWconfig += "<Field Name=\"" + hiInfo.sPath + "\"></Field>\r\n"; //removed {0} before </Field> too
            ssHWconfig += "</Group></Subsystem>";

            Intermec.DeviceManagement.SmartSystem.ITCSSApi ssAPI = new Intermec.DeviceManagement.SmartSystem.ITCSSApi();

            uint          uiRet     = 0;
            StringBuilder sbRetData = new StringBuilder(1024);
            int           iLen      = 1024;

            uiRet  = ssAPI.Get(ssHWconfig, sbRetData, ref iLen, 0);
            uError = uiRet;
            if (uiRet == Intermec.DeviceManagement.SmartSystem.ITCSSErrors.E_SS_SUCCESS)
            {
                string sVal    = sbRetData.ToString();
                string sSearch = hiInfo.sPath;// "FirmwareVersion\">"; // "<Field Name=\"System\\Info\\LastBoot\">"
                int    iIndex;
                iIndex = sVal.IndexOf(sSearch);
                if (iIndex >= 0)
                {
                    XmlDocument xDoc = new XmlDocument();
                    xDoc.LoadXml(sVal);
                    XmlNodeList xNodes = xDoc.GetElementsByTagName("Field");
                    XmlNode     root   = xDoc.FirstChild;
                    if (root != null)
                    {
                        sReturn = root.InnerText;
                    }
                }
            }
            else
            {
                string sVal   = sbRetData.ToString();
                int    iIndex = sVal.IndexOf("Error=\"");
                string sErr   = "";
                if (iIndex >= 0)
                {
                    XmlDocument xDoc = new XmlDocument();
                    xDoc.LoadXml(sVal);
                    //XmlNode xNode = xDoc.SelectSingleNode("/Subsystem/Group[1]/Field[1]");// "//Field[@Name='" + hiInfo.sPath + "']");
                    XmlNodeList xNodes = xDoc.GetElementsByTagName("Field");
                    for (int j = 0; j < xNodes.Count; j++)
                    {
                        System.Diagnostics.Debug.WriteLine(xNodes[j].InnerXml);
                        foreach (XmlAttribute xa in xNodes[j].Attributes)
                        {
                            System.Diagnostics.Debug.WriteLine(xa.Name);
                            if (xa.Name.Equals("Error"))
                            {
                                System.Diagnostics.Debug.WriteLine(xa.InnerXml);
                                sErr = xa.InnerXml;
                            }
                        }
                    }
                }
                uiRet = uint.Parse(sErr, System.Globalization.NumberStyles.AllowHexSpecifier);

                System.Diagnostics.Debug.WriteLine(uiRet.ToString("X8") + "\r\n" + sbRetData);
                System.Diagnostics.Debug.WriteLine(SSerrorStrings.getErrorString("0x" + uiRet.ToString("X8")));
                System.Diagnostics.Debug.WriteLine(SSAPIerrors.getErrString(uiRet));
                uError = uiRet;
            }
            ssAPI = null;
            return(sReturn);
        }