本文整理汇总了C#中UPnPService类的典型用法代码示例。如果您正苦于以下问题:C# UPnPService类的具体用法?C# UPnPService怎么用?C# UPnPService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UPnPService类属于命名空间,在下文中一共展示了UPnPService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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;
}
示例7:
void IUPnPServiceCallback.ServiceInstanceDied(UPnPService pus)
{
try
{
IUPnPServiceCallback callback = (IUPnPServiceCallback)connection.Target;
if (callback == null)
{
return;
}
callback.ServiceInstanceDied(pus);
}
finally
{
Marshal.ReleaseComObject(pus);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例15: ConnectionManager
public ConnectionManager(UPnPService service)
: base(service)
{
}