当前位置: 首页>>代码示例>>C#>>正文


C# UPnPDevice.StartDevice方法代码示例

本文整理汇总了C#中OpenSource.UPnP.UPnPDevice.StartDevice方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPDevice.StartDevice方法的具体用法?C# UPnPDevice.StartDevice怎么用?C# UPnPDevice.StartDevice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSource.UPnP.UPnPDevice的用法示例。


在下文中一共展示了UPnPDevice.StartDevice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Gatekeeper

        public Gatekeeper(int PortNumber)
        {
            A_ICB = new UPnPService.UPnPServiceInvokeHandler(A_InvokeSink);
            A_IECB = new UPnPService.UPnPServiceInvokeErrorHandler(A_InvokeErrorSink);

            Port = PortNumber;
            Root = UPnPDevice.CreateRootDevice(1000,1,"");
            Root.FriendlyName = "UPnPShare";

            Root.StandardDeviceType = "UPnPGateKeeper";
            DV = new DvGateKeeper();
            Root.AddService(DV);

            DV.External_Register = new DvGateKeeper.Delegate_Register(RegisterSink);
            DV.External_UnRegister = new DvGateKeeper.Delegate_UnRegister(UnRegisterSink);
            DV.External_GetDocument = new DvGateKeeper.Delegate_GetDocument(GetDocumentSink);
            DV.External_AddDevice = new DvGateKeeper.Delegate_AddDevice(AddDeviceSink);
            DV.External_RemoveDevice = new DvGateKeeper.Delegate_RemoveDevice(RemovedDeviceSink);
            DV.External_FireEvent = new DvGateKeeper.Delegate_FireEvent(FireEventSink);
            DV.External_GetStateTable = new DvGateKeeper.Delegate_GetStateTable(GetStateTableSink);

            DV.External_Invoke = new DvGateKeeper.Delegate_Invoke(InvokeSink);
            DV.External_InvokeAsync = new DvGateKeeper.Delegate_InvokeAsync(InvokeAsyncSink);
            DV.External_InvokeAsyncResponse = new DvGateKeeper.Delegate_InvokeAsyncResponse(InvokeAsyncResponseSink);

            (new UPnPDebugObject(Root)).SetField("NoSSDP",true);

            Root.StartDevice(PortNumber);
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:29,代码来源:Gatekeeper.cs

示例2: startMenuItem_Click

        private void startMenuItem_Click(object sender, System.EventArgs e)
        {
            startMenuItem.Enabled = false;
            foreach (MenuItem i in pfcMenuItem.MenuItems) {i.Enabled = false;}
            foreach (MenuItem i in menuItem3.MenuItems) {i.Enabled = false;}
            InfoStringBox.Enabled = false;

            device = UPnPDevice.CreateRootDevice(900,1,"");
            device.UniqueDeviceName = Guid.NewGuid().ToString();
            device.StandardDeviceType = "MediaRenderer";
            device.FriendlyName = "Media Renderer (" + System.Net.Dns.GetHostName() + ")";
            device.HasPresentation = false;

            device.Manufacturer = "OpenSource";
            device.ManufacturerURL = "http://opentools.homeip.net/";
            device.PresentationURL = "/";
            device.HasPresentation = true;
            device.ModelName = "AV Renderer";
            device.ModelDescription = "Media Renderer Device";
            device.ModelURL = new Uri("http://opentools.homeip.net/");

            UPnPService ts = new UPnPService(1, "EmptyService", "EmptyService", true, this);
            ts.AddMethod("NullMethod");
            //device.AddService(ts);

            DText p = new DText();
            p.ATTRMARK = "\r\n";
            p[0] = this.InfoStringBox.Text;
            int len = p.DCOUNT();
            ProtocolInfoString[] istring = new ProtocolInfoString[len];
            for(int i=1;i<=len;++i)
            {
                istring[i-1] = new ProtocolInfoString(p[i]);
            }
            r = new AVRenderer(MaxConnections, istring, new AVRenderer.ConnectionHandler(NewConnectionSink));

            r.OnClosedConnection += new AVRenderer.ConnectionHandler(ClosedConnectionSink);

            if (supportRecordMenuItem.Checked == false)
            {
                r.AVT.RemoveAction_Record();
            }

            if (supportRecordQualityMenuItem.Checked == false)
            {
                r.AVT.RemoveAction_SetRecordQualityMode();
            }

            if (supportNextContentUriMenuItem.Checked == false)
            {
                r.AVT.RemoveAction_SetNextAVTransportURI();
            }

            if (MaxConnections == 0)
            {
                r.Manager.RemoveAction_PrepareForConnection();
                r.Manager.RemoveAction_ConnectionComplete();
            }

            r.AVT.GetUPnPService().GetStateVariableObject("CurrentPlayMode").AllowedStringValues = new String[3]{"NORMAL","REPEAT_ALL","INTRO"};

            r.Control.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Channel").AllowedStringValues = new String[3]{"Master","LF","RF"};
            r.Control.GetUPnPService().GetStateVariableObject("RedVideoBlackLevel").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("GreenVideoBlackLevel").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("BlueVideoBlackLevel").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("RedVideoGain").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("GreenVideoGain").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("BlueVideoGain").SetRange((ushort)0,(ushort)100,(ushort)1);

            r.Control.GetUPnPService().GetStateVariableObject("Brightness").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("Contrast").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("Sharpness").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("Volume").SetRange((UInt16)0,(UInt16)100,(ushort)1);

            device.AddService(r.Control);
            device.AddService(r.AVT);
            device.AddService(r.Manager);

            //device.AddDevice(r);

            device.StartDevice();

            //r.Start();
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:84,代码来源:MainForm.cs

示例3: CreateLocalDevice

 public void CreateLocalDevice(string deviceGuid, string deviceType, string presentationUrl, string rootDirectory, string modelName, string modelDescription, string modelUrl, string modelNumber, string manufacturer, string manufacturerUrl)
 {
     if (localDevice != null)
     {
         localDevice.StopDevice();
         localDevice = null;
     }
     //
     IPHostEntry host;
     string localIP = "";
     host = Dns.GetHostEntry(Dns.GetHostName());
     foreach (var ip in host.AddressList)
     {
         if (ip.AddressFamily == AddressFamily.InterNetwork)
         {
             localIP = ip.ToString();
             break;
         }
     }
     localDevice = UPnPDevice.CreateRootDevice(900, 1, rootDirectory);
     //hgdevice.Icon = null;
     if (presentationUrl != "")
     {
         localDevice.HasPresentation = true;
         localDevice.PresentationURL = presentationUrl;
     }
     localDevice.FriendlyName = modelName + ": " + Environment.MachineName;
     localDevice.Manufacturer = manufacturer;
     localDevice.ManufacturerURL = manufacturerUrl;
     localDevice.ModelName = modelName;
     localDevice.ModelDescription = modelDescription;
     if (Uri.IsWellFormedUriString(manufacturerUrl, UriKind.Absolute))
     {
         localDevice.ModelURL = new Uri(manufacturerUrl);
     }
     localDevice.ModelNumber = modelNumber;
     localDevice.StandardDeviceType = deviceType;
     localDevice.UniqueDeviceName = deviceGuid;
     localDevice.StartDevice();
 }
开发者ID:rwxr-xr-x,项目名称:HomeGenie,代码行数:40,代码来源:UPnP.cs


注:本文中的OpenSource.UPnP.UPnPDevice.StartDevice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。