deviceInfo.html 9.14 KB
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../../css/frame.css" rel="stylesheet" />
    <link href="../../scripts/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="../../scripts/easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
        .tdTitle {
            width: 120px;
        }

        .basicTable {
            background-color: rgb(220, 223, 226);
            margin-top: 10px;
            margin-right: 10px;
            margin-bottom: 10px;
            margin-left: 10px;
            height: 226px;
            width: 420px;
            float: left;
        }
    </style>
</head>

<body>
    <form id="deviceInfoForm">
        <table class="settingsContainer basicTable">
		    <tr>
                <td class="tdTitle">型号:</td>
                <td class="tdContent">
                    <div id="10" name="10"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">分辨率:</td>
                <td class="tdContent">
                    <div id="0" name="0"></div>
                </td>
            </tr>
            <!--             <tr> -->
            <!--                 <td class="tdTitle">硬件版本:</td> -->
            <!--                 <td class="tdContent"> -->
            <!--                     <div id="1" name="1"></div> -->
            <!--                 </td> -->
            <!--             </tr> -->
            <tr>
                <td class="tdTitle">Fpga版本:</td>
                <td class="tdContent">
                    <div id="2" name="2"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">系统版本:</td>
                <td class="tdContent">
                    <div id="3" name="3"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">BSP版本:</td>
                <td class="tdContent">
                    <div id="4" name="4"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">软件版本:</td>
                <td class="tdContent">
                    <div id="5" name="5"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">算法版本:</td>
                <td class="tdContent">
                    <div id="6" name="6"></div>
                </td>
            </tr>
        </table>
        <table class="settingsContainer basicTable" style="height:100px; clear: both; ">
            <tr>
                <td class="tdTitle">设备ID:</td>
                <td class="tdContent">
                    <div id="7" name="7"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">授权状态:</td>
                <td class="tdContent">
                    <div id="8" name="8"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">授权信息:</td>
                <td class="tdContent">
                    <div id="9" name="9"></div>
                </td>
            </tr>
        </table>
        <table class="settingsContainer basicTable" style="display: block; clear: both; position: absolute; left: 440px;">
            <tr>
                <td class="tdTitle">经度:</td>
                <td class="tdContent">
                    <div id="Longitude" name="Longitude"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">纬度:</td>
                <td class="tdContent">
                    <div id="Latitude" name="Latitude"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">方向:</td>
                <td class="tdContent">
                    <div id="Direction" name="Direction"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">速度:</td>
                <td class="tdContent">
                    <div id="Velocity" name="Velocity"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">海拔:</td>
                <td class="tdContent">
                    <div id="Altitude" name="Altitude"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">GPS时钟:</td>
                <td class="tdContent">
                    <div id="GPSTime" name="GPSTime"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">搜星强度:</td>
                <td class="tdContent">
                    <div id="GPSSatelliteNumber" name="GPSSatelliteNumber"></div>
                </td>
            </tr>
        </table>
        <table class="settingsContainer basicTable" style="display: block; clear: both; position: absolute; left: 440px;top: 245px;height: 100px">
            <tr>
                <td class="tdTitle">方向:</td>
                <td class="tdContent">
                    <div id="CompassDirection" name="CompassDirection"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">俯仰角:</td>
                <td class="tdContent">
                    <div id="PitchAngle" name="PitchAngle"></div>
                </td>
            </tr>
            <tr>
                <td class="tdTitle">滚动角:</td>
                <td class="tdContent">
                    <div id="RotationAngle" name="RotationAngle"></div>
                </td>
            </tr>
        </table>
        <table class="settingsContainer basicTable" style="display: block; clear: both; height: 30px">
            <tr>
                <td class="tdTitle">温度:</td>
                <td class="tdContent">
                    <div id="Temperature" name="Temperature"></div>
                </td>
            </tr>
        </table>
    </form>
    <script src="../../scripts/easyui/jquery.min.js"></script>
    <script src="../../scripts/easyui/jquery.easyui.min.js"></script>
    <script src="../../scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="../../scripts/utilities.js"></script>
    <script src="../../scripts/console-polyfill/index.js"></script>
    <script type="text/javascript">

        var parameterAdaptor = new ParameterAdaptor();
        var interval;
        $().ready(function () {
            loadDeviceInfo();
            interval = setInterval(queryGpsSensorData, 500);
        });

        function PreProcessJsonMsg(PreProcessMsg) {
            var Msg1 = PreProcessMsg.replace("\\\"", "\"");
            var Msg2 = Msg1.replace("\\n", "");
            return Msg2;
        }

        function queryGpsSensorData() {
            var url = '../../do/trafficController/getExtraData?type=gps_sensor';
            //			url = 'json/gps_sensor.json';

            $.get(url, null, function (data) {
                //var msg = eval("("+data.feedback.Msg+")");
                var msg;
                try {
                    msg = $.parseJSON(data.feedback.Msg.replace("\\n", ""));
                } catch (error) {
                    console.error("从" + url + "获取到的gps传感器数据非合法的Json格式! 数据:" + data.feedback.Msg);
                }
                // 数据不空,后面不再执行
                if (!msg) {
                    return;
                }
                var allInfo = msg.gps_sensor;
                $.each(allInfo, function (i, info) {

                    if (info.Type == "NineAxisSensor") {
                        $.each(info.Content, function (key, value) {
                            if (key == "Magnetic") {
                                var html = "";
                                $.each(value, function (childKey, childValue) {
                                    html += "," + childValue;
                                });
                                $("div[name='CompassDirection']").html(html.substring(1));
                                return true;
                            }
                            $.each(value, function (childKey, childValue) {
                                $("div[name='" + childKey + "']").html(childValue);
                            });
                        });
                        return true;
                    }
                    //赋值
                    $.each(info.Content, function (key, value) {
                        $("div[name='" + key + "']").html(value);

                    })
                });
            }, "json");
        }

        window.onbeforeunload = function () {
            window.clearInterval(interval);
        };


        function loadDeviceInfo() {
            var RefererInfo = "deviceInfo";
            parameterAdaptor.getParameters(RefererInfo, bindDeviceInfo);
        }

        //绑定数据
        function bindDeviceInfo(data) {
            //处理一下授权信息
            data.feedback["9"] = data.feedback["9"].replace(/\\r\\n/g, "<br/>");
            for (var key in data.feedback) {
                $("#" + key).html(data.feedback[key]);
            }
        }
    </script>
</body>

</html>