Пример #1
0
        private void btnXML_Click(object sender, EventArgs e)
        {
            IPEndPoint end = new IPEndPoint(IPAddress.Parse("192.168.10.146"), 21000);

            string                     id    = Guid.NewGuid().ToString();
            DeviceItemsRes             res   = new DeviceItemsRes();
            List <DeviceItemsRes.Item> items = new List <DeviceItemsRes.Item>();
            var item1 = new DeviceItemsRes.Item()
            {
                Name       = "1号摄像头",
                Address    = "东直门街道",
                RType      = 1,
                RSubType   = 1,
                Privilege  = 90,
                State      = 1,
                Longitude  = 114.7,
                Latitude   = 224.9,
                Elevation  = 3000,
                Roadway    = "东直门马路",
                PileNo     = 1,
                AreaNo     = 1,
                UpdateTime = "20160920T162627"
            };
            var item2 = new DeviceItemsRes.Item()
            {
                Name       = "2号摄像头",
                Address    = "东直门街道",
                RType      = 2,
                RSubType   = 2,
                Privilege  = 90,
                State      = 2,
                Longitude  = 114.7,
                Latitude   = 224.9,
                Elevation  = 3000,
                Roadway    = "东直门马路",
                PileNo     = 2,
                AreaNo     = 2,
                UpdateTime = "20160920T163019"
            };

            items.Add(item1);
            items.Add(item2);
            DeviceItemsRes.QueryResponse query = new DeviceItemsRes.QueryResponse()
            {
                Variable          = VariableType.ItemList,
                Parent            = "123123123",
                TotalSubNum       = 1000,
                TotalOnlineSubNum = 990,
                SubNum            = 200,
                FromIndex         = 1,
                ToIndex           = 200,
                SubListItem       = new DeviceItemsRes.SubList()
                {
                    Items = items
                }
            };
            res.Query = query;
            string xmlBody = DeviceItemsRes.Instance.Save(res);
        }
Пример #2
0
        /// <summary>
        /// sip响应消息指令
        /// </summary>
        /// <param name="response">sip响应</param>
        private VariableType ResMessageOK(string body)
        {
            DeviceItemsRes devItemRes = DeviceItemsRes.Instance.Read(body);
            DeviceRes      devRes     = DeviceRes.Instance.Read(body);
            RealVideoRes   realRes    = RealVideoRes.Instance.Read(body);

            VariableType variable = VariableType.Unknown;

            if (devItemRes != null && devItemRes.Query != null)         //设备目录查询响应
            {
                variable = devItemRes.Query.Variable;
            }
            else if (devRes != null && devRes.Query != null)        //设备信息查询响应
            {
                variable = devRes.Query.Variable;
            }
            else if (realRes != null && realRes.Variable != VariableType.Unknown)       //实时视频请求响应
            {
                variable = realRes.Variable;
            }
            return(variable);
        }