Exemplo n.º 1
0
        bool getCellPower()
        {
            bool   bRet   = false;
            String cellON = "  <Subsystem Name=\"WWAN Radio\">" +
                            "   <Field Name=\"Radio Power State\"></Field> " +
                            "</Subsystem>";

            StringBuilder sb   = new StringBuilder(255);
            int           iLen = 255;
            uint          uRes = ITCSSApi.Get(cellON, sb, ref iLen, 2000);

            if (uRes != Intermec.DeviceManagement.SmartSystem.ITCSSErrors.E_SS_SUCCESS)
            {
                doLog("getCellPower error: " + uRes.ToString("X08"));
            }
            else
            {
                doLog("getCellPower OK");
                // "<Subsystem Name=\"WWAN Radio\"><Field Name=\"Radio Power State\">1</Field></Subsystem>"
                if (sb.ToString().ToLower().Contains("\"radio power state\">1<"))
                {
                    bRet = true;
                }
            }
            doLog("Cell power is " + bRet.ToString());
            return(bRet);
        }
Exemplo n.º 2
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;
            }
Exemplo n.º 3
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);
        }