Exemple #1
0
        static public Proxy.Scope CreateConfigurableScope(string scopeValue)
        {
            Proxy.Scope res = new Proxy.Scope();

            res.ScopeDef  = Proxy.ScopeDefinition.Configurable;
            res.ScopeItem = scopeValue;

            return(res);
        }
Exemple #2
0
        public static void Serialize()
        {
            ONVIFDeviceManagementConfiguration tmp = new ONVIFDeviceManagementConfiguration();

            //DiscoveryMode
            tmp.DiscoveryMode       = Proxy.DiscoveryMode.Discoverable;
            tmp.RemoteDiscoveryMode = Proxy.DiscoveryMode.NonDiscoverable;

            //Configurable Scopes
            tmp.ConfigurableScopes = new List <Proxy.Scope>();

            Proxy.Scope scope = new Proxy.Scope();
            scope.ScopeDef  = Proxy.ScopeDefinition.Configurable;
            scope.ScopeItem = "onvif://www.onvif.org/Location/Novgorod";
            tmp.ConfigurableScopes.Add(scope);

            //DateTime
            tmp.DateTimeType    = Proxy.SetDateTimeType.Manual;
            tmp.DaylightSavings = true;
            tmp.TimeOfset       = 0;
            tmp.TimeZone        = "UTC0:0";

            //DNSFromDHCP
            tmp.DNSFromDHCP = new List <Proxy.IPAddress>();

            Proxy.IPAddress DNSFromDHCP = new Proxy.IPAddress();
            DNSFromDHCP.Type        = Proxy.IPType.IPv4;
            DNSFromDHCP.IPv4Address = "192.168.10.4";

            tmp.DNSFromDHCP.Add(DNSFromDHCP);

            //DNSInformation
            tmp.DNSInformation          = new Proxy.DNSInformation();
            tmp.DNSInformation.FromDHCP = false;

            //DynamicDNSInformation
            tmp.DynamicDNSInformation = new Proxy.DynamicDNSInformation();

            //Hostname
            tmp.HostnameFromDHCP             = "hostnamefromDHCP";
            tmp.HostnameInformation          = new Proxy.HostnameInformation();
            tmp.HostnameInformation.Name     = "duthostname";
            tmp.HostnameInformation.FromDHCP = false;

            //NetworkInterface
            tmp.NetworkInterface = new List <Proxy.NetworkInterface>();

            //NotFixedUsers
            tmp.NotFixedUsersList = new List <Proxy.User>();

            Proxy.User User = new Proxy.User();
            User.Username  = "******";
            User.UserLevel = Proxy.UserLevel.User;
            User.Password  = "******";

            tmp.NotFixedUsersList.Add(User);


            //NTP
            tmp.NTPInformation                          = new Proxy.NTPInformation();
            tmp.NTPInformation.FromDHCP                 = false;
            tmp.NTPInformation.NTPManual                = new Proxy.NetworkHost[1];
            tmp.NTPInformation.NTPManual[0]             = new Proxy.NetworkHost();
            tmp.NTPInformation.NTPManual[0].Type        = Proxy.NetworkHostType.IPv4;
            tmp.NTPInformation.NTPManual[0].IPv4Address = "192.168.10.3";

            tmp.NTPFromDHCP = new List <Proxy.NetworkHost>();
            tmp.NTPFromDHCP.Add(tmp.NTPInformation.NTPManual[0]);

            using (XmlWriter writer = XmlWriter.Create(@"D:\2.xml"))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(ONVIFDeviceManagementConfiguration));
                serializer.Serialize(writer, tmp);
            }
        }