本文整理汇总了C#中UPnPService类的典型用法代码示例。如果您正苦于以下问题:C# UPnPService类的具体用法?C# UPnPService怎么用?C# UPnPService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UPnPService类属于命名空间,在下文中一共展示了UPnPService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StateVariableChanged
public override void StateVariableChanged(UPnPService pus, string pcwszStateVarName, object vaValue)
{
try
{
IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
if (callback == null)
{
return;
}
XPathDocument doc = new XPathDocument(new StringReader((string)vaValue));
XPathNavigator nav = doc.CreateNavigator();
foreach (XPathNavigator node in nav.Select(XPath.Expressions.EventElements))
{
XPathNavigator val = node.SelectSingleNode(XPath.Expressions.ValueAttributes);
if (String.CompareOrdinal(val.Value, "NOT_IMPLEMENTED") != 0)
{
callback.StateVariableChanged(pus, node.LocalName, val.Value);
}
}
}
finally
{
Marshal.ReleaseComObject(pus);
}
}
开发者ID:NathanHowell,项目名称:Sonority,代码行数:28,代码来源:AVTransportCallback.cs
示例2: GenerateServiceFromSCPD
/// <summary>
/// Generates a UPnPService object from an SCPD XML
/// </summary>
/// <param name="SCPD_XML">XML String</param>
/// <returns>UPnPService</returns>
public static UPnPService GenerateServiceFromSCPD(string SCPD_XML)
{
UPnPService s = new UPnPService(1);
s.ParseSCPD(SCPD_XML);
return(s);
}
开发者ID:Scannow,项目名称:SWYH,代码行数:12,代码来源:ServiceGenerator.cs
示例3: AVTransport
public AVTransport(UPnPService service)
: base(service)
{
_service.AddCallback(new AVTransportCallback(this));
PropertyChanged += new PropertyChangedEventHandler(AVTransport_PropertyChanged);
PropertyChanged += new PropertyChangedEventHandler(TransportStateChanged);
_timer = new Timer(new TimerCallback(this.OnTimerFired), null, 1000, 1000);
}
开发者ID:NathanHowell,项目名称:Sonority,代码行数:8,代码来源:AVTransport.cs
示例4: EventSink
protected void EventSink(UPnPService sender, long seq)
{
UPnPService S = (UPnPService)RealServiceTable[sender];
foreach(UPnPStateVariable v in sender.GetStateVariables())
{
UPnPStateVariable sv = S.GetStateVariableObject(v.Name);
sv.Value = v.Value;
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:9,代码来源:UPnPProxyDevice.cs
示例5: RenderingControl
internal RenderingControl(UPnPService service)
: base(service)
{
_Loudness[Channel.Master] = false;
foreach (Channel c in Enum.GetValues(typeof(Channel)))
{
_Mute[c] = false;
_Volume[c] = 0;
}
this.PropertyChanged += new PropertyChangedEventHandler(RenderingControl_PropertyChanged);
}
开发者ID:NathanHowell,项目名称:Sonority,代码行数:11,代码来源:RenderingControl.cs
示例6: Browser
/// <summary>
/// Browses through UPnPService object with id objectId and adds it to a TreeView
/// </summary>
/// <param name="service"></param>
/// <param name="objectId"></param>
/// <param name="parent"></param>
/// <returns></returns>
public static XDocument Browser(UPnPService service, string objectId)
{
object output = new object();
object[] input = new object[6] {objectId, "BrowseDirectChildren", "", 0, 0, "0",};
object response;
Array o;
response = service.InvokeAction("Browse", input, ref output);
o = (Array) output;
XDocument content = XDocument.Parse(o.GetValue(0).ToString());
return content;
}
开发者ID:ElementalCrisis,项目名称:jmmserver,代码行数:20,代码来源:UPnPData.cs
示例7:
void IUPnPServiceCallback.ServiceInstanceDied(UPnPService pus)
{
try
{
IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
if (callback == null)
{
return;
}
callback.ServiceInstanceDied(pus);
}
finally
{
Marshal.ReleaseComObject(pus);
}
}
开发者ID:NathanHowell,项目名称:Sonority,代码行数:17,代码来源:ServiceCallback.cs
示例8: StateVariableChanged
public virtual void StateVariableChanged(UPnPService pus, string pcwszStateVarName, object vaValue)
{
try
{
IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
if (callback == null)
{
return;
}
callback.StateVariableChanged(pus, pcwszStateVarName, vaValue);
}
finally
{
Marshal.ReleaseComObject(pus);
}
}
开发者ID:NathanHowell,项目名称:Sonority,代码行数:17,代码来源:ServiceCallback.cs
示例9: Error_Sink_GetCurrentConnectionIDs
private void Error_Sink_GetCurrentConnectionIDs(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
if(OnResult_GetCurrentConnectionIDs != null)
{
OnResult_GetCurrentConnectionIDs((System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_GetCurrentConnectionIDs.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_GetCurrentConnectionIDs)wr.Target)((System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, Handle);
}
else
{
WeakList_GetCurrentConnectionIDs.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:19,代码来源:CpConnectionManager.cs
示例10: Sink_GetCurrentConnectionIDs
private void Sink_GetCurrentConnectionIDs(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
{
if(OnResult_GetCurrentConnectionIDs != null)
{
OnResult_GetCurrentConnectionIDs((System.String )Args[0].DataValue, null, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_GetCurrentConnectionIDs.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_GetCurrentConnectionIDs)wr.Target)((System.String )Args[0].DataValue, null, Handle);
}
else
{
WeakList_GetCurrentConnectionIDs.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:19,代码来源:CpConnectionManager.cs
示例11: Error_Sink_ConnectionComplete
private void Error_Sink_ConnectionComplete(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
if(OnResult_ConnectionComplete != null)
{
OnResult_ConnectionComplete((System.Int32 )Args[0].DataValue, e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_ConnectionComplete.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_ConnectionComplete)wr.Target)((System.Int32 )Args[0].DataValue, e, Handle);
}
else
{
WeakList_ConnectionComplete.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:19,代码来源:CpConnectionManager.cs
示例12: Error_Sink_PrepareForConnection
private void Error_Sink_PrepareForConnection(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
for(int i=0;i<Args.Length;++i)
{
switch(Args[i].Name)
{
case "Direction":
switch((string)Args[i].DataValue)
{
case "Input":
Args[i].DataValue = Enum_A_ARG_TYPE_Direction.INPUT;
break;
case "Output":
Args[i].DataValue = Enum_A_ARG_TYPE_Direction.OUTPUT;
break;
}
break;
}
}
if(OnResult_PrepareForConnection != null)
{
OnResult_PrepareForConnection((System.String )Args[0].DataValue, (System.String )Args[1].DataValue, (System.Int32 )Args[2].DataValue, (Enum_A_ARG_TYPE_Direction )Args[3].DataValue, (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_PrepareForConnection.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_PrepareForConnection)wr.Target)((System.String )Args[0].DataValue, (System.String )Args[1].DataValue, (System.Int32 )Args[2].DataValue, (Enum_A_ARG_TYPE_Direction )Args[3].DataValue, (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), e, Handle);
}
else
{
WeakList_PrepareForConnection.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:36,代码来源:CpConnectionManager.cs
示例13: Error_Sink_SetPlayMode
private void Error_Sink_SetPlayMode(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
for(int i=0;i<Args.Length;++i)
{
switch(Args[i].Name)
{
case "NewPlayMode":
switch((string)Args[i].DataValue)
{
case "NORMAL":
Args[i].DataValue = Enum_CurrentPlayMode.NORMAL;
break;
case "SHUFFLE":
Args[i].DataValue = Enum_CurrentPlayMode.SHUFFLE;
break;
case "REPEAT_ONE":
Args[i].DataValue = Enum_CurrentPlayMode.REPEAT_ONE;
break;
case "REPEAT_ALL":
Args[i].DataValue = Enum_CurrentPlayMode.REPEAT_ALL;
break;
case "RANDOM":
Args[i].DataValue = Enum_CurrentPlayMode.RANDOM;
break;
case "DIRECT_1":
Args[i].DataValue = Enum_CurrentPlayMode.DIRECT_1;
break;
case "INTRO":
Args[i].DataValue = Enum_CurrentPlayMode.INTRO;
break;
}
break;
}
}
if(OnResult_SetPlayMode != null)
{
OnResult_SetPlayMode((System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode )Args[1].DataValue, e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_SetPlayMode.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_SetPlayMode)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode )Args[1].DataValue, e, Handle);
}
else
{
WeakList_SetPlayMode.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:51,代码来源:CpAVTransport.cs
示例14: Sink_GetTransportInfo
private void Sink_GetTransportInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
{
for(int i=0;i<Args.Length;++i)
{
switch(Args[i].Name)
{
case "CurrentTransportState":
switch((string)Args[i].DataValue)
{
case "STOPPED":
Args[i].DataValue = Enum_TransportState.STOPPED;
break;
case "PAUSED_PLAYBACK":
Args[i].DataValue = Enum_TransportState.PAUSED_PLAYBACK;
break;
case "PAUSED_RECORDING":
Args[i].DataValue = Enum_TransportState.PAUSED_RECORDING;
break;
case "PLAYING":
Args[i].DataValue = Enum_TransportState.PLAYING;
break;
case "RECORDING":
Args[i].DataValue = Enum_TransportState.RECORDING;
break;
case "TRANSITIONING":
Args[i].DataValue = Enum_TransportState.TRANSITIONING;
break;
case "NO_MEDIA_PRESENT":
Args[i].DataValue = Enum_TransportState.NO_MEDIA_PRESENT;
break;
default:
SetUnspecifiedValue("Enum_TransportState", (string)Args[i].DataValue);
Args[i].DataValue = Enum_TransportState._UNSPECIFIED_;
break;
}
break;
case "CurrentTransportStatus":
switch((string)Args[i].DataValue)
{
case "OK":
Args[i].DataValue = Enum_TransportStatus.OK;
break;
case "ERROR_OCCURRED":
Args[i].DataValue = Enum_TransportStatus.ERROR_OCCURRED;
break;
case " vendor-defined ":
Args[i].DataValue = Enum_TransportStatus._VENDOR_DEFINED_;
break;
default:
SetUnspecifiedValue("Enum_TransportStatus", (string)Args[i].DataValue);
Args[i].DataValue = Enum_TransportStatus._UNSPECIFIED_;
break;
}
break;
case "CurrentSpeed":
switch((string)Args[i].DataValue)
{
case "1":
Args[i].DataValue = Enum_TransportPlaySpeed._1;
break;
case " vendor-defined ":
Args[i].DataValue = Enum_TransportPlaySpeed._VENDOR_DEFINED_;
break;
default:
SetUnspecifiedValue("Enum_TransportPlaySpeed", (string)Args[i].DataValue);
Args[i].DataValue = Enum_TransportPlaySpeed._UNSPECIFIED_;
break;
}
break;
}
}
if(OnResult_GetTransportInfo != null)
{
OnResult_GetTransportInfo((System.UInt32 )Args[0].DataValue, (Enum_TransportState )Args[1].DataValue, (Enum_TransportStatus )Args[2].DataValue, (Enum_TransportPlaySpeed )Args[3].DataValue, null, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_GetTransportInfo.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_GetTransportInfo)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_TransportState )Args[1].DataValue, (Enum_TransportStatus )Args[2].DataValue, (Enum_TransportPlaySpeed )Args[3].DataValue, null, Handle);
}
else
{
WeakList_GetTransportInfo.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:88,代码来源:CpAVTransport.cs
示例15: ConnectionManager
public ConnectionManager(UPnPService service)
: base(service)
{
}
开发者ID:NathanHowell,项目名称:Sonority,代码行数:4,代码来源:ConnectionManager.cs
示例16: _subscribe_sink
protected void _subscribe_sink(UPnPService sender, bool OK)
{
if(OnSubscribe!=null)
{
OnSubscribe(OK);
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:7,代码来源:CpConnectionManager.cs
示例17: _subscribe
public void _subscribe(int Timeout, UPnPService.UPnPEventHandler UPnPEventCallback)
{
_S.Subscribe(Timeout, UPnPEventCallback);
}
开发者ID:Scannow,项目名称:SWYH,代码行数:4,代码来源:CpConnectionManager.cs
示例18: CpConnectionManager
public CpConnectionManager(UPnPService s)
{
_S = s;
_S.OnSubscribe += new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink);
if(HasStateVariable_SourceProtocolInfo) _S.GetStateVariableObject("SourceProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(SourceProtocolInfo_ModifiedSink);
if(HasStateVariable_SinkProtocolInfo) _S.GetStateVariableObject("SinkProtocolInfo").OnModified += new UPnPStateVariable.ModifiedHandler(SinkProtocolInfo_ModifiedSink);
if(HasStateVariable_CurrentConnectionIDs) _S.GetStateVariableObject("CurrentConnectionIDs").OnModified += new UPnPStateVariable.ModifiedHandler(CurrentConnectionIDs_ModifiedSink);
}
开发者ID:Scannow,项目名称:SWYH,代码行数:8,代码来源:CpConnectionManager.cs
示例19: Error_Sink_SetRecordQualityMode
private void Error_Sink_SetRecordQualityMode(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
{
for(int i=0;i<Args.Length;++i)
{
switch(Args[i].Name)
{
case "NewRecordQualityMode":
switch((string)Args[i].DataValue)
{
case "0:EP":
Args[i].DataValue = Enum_CurrentRecordQualityMode._0_EP;
break;
case "1:LP":
Args[i].DataValue = Enum_CurrentRecordQualityMode._1_LP;
break;
case "2:SP":
Args[i].DataValue = Enum_CurrentRecordQualityMode._2_SP;
break;
case "0:BASIC":
Args[i].DataValue = Enum_CurrentRecordQualityMode._0_BASIC;
break;
case "1:MEDIUM":
Args[i].DataValue = Enum_CurrentRecordQualityMode._1_MEDIUM;
break;
case "2:HIGH":
Args[i].DataValue = Enum_CurrentRecordQualityMode._2_HIGH;
break;
case "NOT_IMPLEMENTED":
Args[i].DataValue = Enum_CurrentRecordQualityMode.NOT_IMPLEMENTED;
break;
case " vendor-defined ":
Args[i].DataValue = Enum_CurrentRecordQualityMode._VENDOR_DEFINED_;
break;
}
break;
}
}
if(OnResult_SetRecordQualityMode != null)
{
OnResult_SetRecordQualityMode((System.UInt32 )Args[0].DataValue, (Enum_CurrentRecordQualityMode )Args[1].DataValue, e, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_SetRecordQualityMode.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_SetRecordQualityMode)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_CurrentRecordQualityMode )Args[1].DataValue, e, Handle);
}
else
{
WeakList_SetRecordQualityMode.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:54,代码来源:CpAVTransport.cs
示例20: Sink_GetPositionInfo
private void Sink_GetPositionInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
{
if(OnResult_GetPositionInfo != null)
{
OnResult_GetPositionInfo((System.UInt32 )Args[0].DataValue, (System.UInt32 )Args[1].DataValue, (System.String )Args[2].DataValue, (System.String )Args[3].DataValue, (System.String )Args[4].DataValue, (System.String )Args[5].DataValue, (System.String )Args[6].DataValue, (System.Int32 )Args[7].DataValue, (System.Int32 )Args[8].DataValue, null, Handle);
}
WeakReference[] w = (WeakReference[])WeakList_GetPositionInfo.ToArray(typeof(WeakReference));
foreach(WeakReference wr in w)
{
if(wr.IsAlive==true)
{
((Delegate_OnResult_GetPositionInfo)wr.Target)((System.UInt32 )Args[0].DataValue, (System.UInt32 )Args[1].DataValue, (System.String )Args[2].DataValue, (System.String )Args[3].DataValue, (System.String )Args[4].DataValue, (System.String )Args[5].DataValue, (System.String )Args[6].DataValue, (System.Int32 )Args[7].DataValue, (System.Int32 )Args[8].DataValue, null, Handle);
}
else
{
WeakList_GetPositionInfo.Remove(wr);
}
}
}
开发者ID:Scannow,项目名称:SWYH,代码行数:19,代码来源:CpAVTransport.cs
注:本文中的UPnPService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论