本文整理汇总了C#中OpenSource.UPnP.UPnPStateVariable类的典型用法代码示例。如果您正苦于以下问题:C# UPnPStateVariable类的具体用法?C# UPnPStateVariable怎么用?C# UPnPStateVariable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UPnPStateVariable类属于OpenSource.UPnP命名空间,在下文中一共展示了UPnPStateVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeTriggered
private void ChangeTriggered(UPnPStateVariable sender, object value)
{
//Console.WriteLine("LastChange from {0}", UUID);
var newState = sender.Value;
//Console.WriteLine(newState);
ParseChangeXML((string)newState);
}
示例2: OnZoneGroupStateChanged
private void OnZoneGroupStateChanged(UPnPStateVariable sender, object newvalue)
{
Console.WriteLine(sender.Value);
// Avoid multiple state changes and consolidate them
if (stateChangedTimer != null)
stateChangedTimer.Dispose();
stateChangedTimer = new Timer((state) => HandleZoneXML(sender.Value.ToString()), null, TimeSpan.FromMilliseconds(700),
TimeSpan.FromMilliseconds(-1));
}
示例3: BuildUPnPService
protected UPnPService BuildUPnPService()
{
UPnPStateVariable[] RetVal = new UPnPStateVariable[20];
RetVal[0] = new UPnPModeratedStateVariable("ContainerUpdateIDs", typeof(System.String), true);
RetVal[1] = new UPnPModeratedStateVariable("A_ARG_TYPE_Index", typeof(System.UInt32), false);
RetVal[1].AddAssociation("Browse", "StartingIndex");
RetVal[1].AddAssociation("Search", "StartingIndex");
RetVal[2] = new UPnPModeratedStateVariable("A_ARG_TYPE_UpdateID", typeof(System.UInt32), false);
RetVal[2].AddAssociation("Browse", "UpdateID");
RetVal[2].AddAssociation("Search", "UpdateID");
RetVal[3] = new UPnPModeratedStateVariable("SystemUpdateID", typeof(System.UInt32), true);
RetVal[3].AddAssociation("GetSystemUpdateID", "Id");
RetVal[4] = new UPnPModeratedStateVariable("SearchCapabilities", typeof(System.String), false);
RetVal[4].AddAssociation("GetSearchCapabilities", "SearchCaps");
RetVal[5] = new UPnPModeratedStateVariable("A_ARG_TYPE_Result", typeof(System.String), false);
RetVal[5].AddAssociation("Browse", "Result");
RetVal[5].AddAssociation("CreateObject", "Elements");
RetVal[5].AddAssociation("CreateObject", "Result");
RetVal[5].AddAssociation("Search", "Result");
RetVal[6] = new UPnPModeratedStateVariable("A_ARG_TYPE_Count", typeof(System.UInt32), false);
RetVal[6].AddAssociation("Browse", "RequestedCount");
RetVal[6].AddAssociation("Browse", "NumberReturned");
RetVal[6].AddAssociation("Browse", "TotalMatches");
RetVal[6].AddAssociation("Search", "RequestedCount");
RetVal[6].AddAssociation("Search", "NumberReturned");
RetVal[6].AddAssociation("Search", "TotalMatches");
RetVal[7] = new UPnPModeratedStateVariable("A_ARG_TYPE_ObjectID", typeof(System.String), false);
RetVal[7].AddAssociation("Browse", "ObjectID");
RetVal[7].AddAssociation("CreateObject", "ContainerID");
RetVal[7].AddAssociation("CreateObject", "ObjectID");
RetVal[7].AddAssociation("CreateReference", "ContainerID");
RetVal[7].AddAssociation("CreateReference", "ObjectID");
RetVal[7].AddAssociation("CreateReference", "NewID");
RetVal[7].AddAssociation("DestroyObject", "ObjectID");
RetVal[7].AddAssociation("Search", "ContainerID");
RetVal[7].AddAssociation("UpdateObject", "ObjectID");
RetVal[8] = new UPnPModeratedStateVariable("A_ARG_TYPE_SearchCriteria", typeof(System.String), false);
RetVal[8].AddAssociation("Search", "SearchCriteria");
RetVal[9] = new UPnPModeratedStateVariable("A_ARG_TYPE_TransferTotal", typeof(System.String), false);
RetVal[9].AddAssociation("GetTransferProgress", "TransferTotal");
RetVal[10] = new UPnPModeratedStateVariable("A_ARG_TYPE_Filter", typeof(System.String), false);
RetVal[10].AddAssociation("Browse", "Filter");
RetVal[10].AddAssociation("Search", "Filter");
RetVal[11] = new UPnPModeratedStateVariable("A_ARG_TYPE_SortCriteria", typeof(System.String), false);
RetVal[11].AddAssociation("Browse", "SortCriteria");
RetVal[11].AddAssociation("Search", "SortCriteria");
RetVal[12] = new UPnPModeratedStateVariable("A_ARG_TYPE_BrowseFlag", typeof(System.String), false);
RetVal[12].AllowedStringValues = new string[2]{"BrowseMetadata", "BrowseDirectChildren"};
RetVal[12].AddAssociation("Browse", "BrowseFlag");
RetVal[13] = new UPnPModeratedStateVariable("A_ARG_TYPE_TransferID", typeof(System.UInt32), false);
RetVal[13].AddAssociation("ExportResource", "TransferID");
RetVal[13].AddAssociation("GetTransferProgress", "TransferID");
RetVal[13].AddAssociation("ImportResource", "TransferID");
RetVal[13].AddAssociation("StopTransferResource", "TransferID");
RetVal[14] = new UPnPModeratedStateVariable("A_ARG_TYPE_TransferLength", typeof(System.String), false);
RetVal[14].AddAssociation("GetTransferProgress", "TransferLength");
RetVal[15] = new UPnPModeratedStateVariable("A_ARG_TYPE_TagValueList", typeof(System.String), false);
RetVal[15].AddAssociation("UpdateObject", "CurrentTagValue");
RetVal[15].AddAssociation("UpdateObject", "NewTagValue");
RetVal[16] = new UPnPModeratedStateVariable("A_ARG_TYPE_TransferStatus", typeof(System.String), false);
RetVal[16].AllowedStringValues = new string[4]{"COMPLETED", "ERROR", "IN_PROGRESS", "STOPPED"};
RetVal[16].AddAssociation("GetTransferProgress", "TransferStatus");
RetVal[17] = new UPnPModeratedStateVariable("A_ARG_TYPE_URI", typeof(System.Uri), false);
RetVal[17].AddAssociation("DeleteResource", "ResourceURI");
RetVal[17].AddAssociation("ExportResource", "SourceURI");
RetVal[17].AddAssociation("ExportResource", "DestinationURI");
RetVal[17].AddAssociation("ImportResource", "SourceURI");
RetVal[17].AddAssociation("ImportResource", "DestinationURI");
RetVal[18] = new UPnPModeratedStateVariable("TransferIDs", typeof(System.String), true);
RetVal[19] = new UPnPModeratedStateVariable("SortCapabilities", typeof(System.String), false);
RetVal[19].AddAssociation("GetSortCapabilities", "SortCaps");
UPnPService S = new UPnPService(1, "urn:schemas-upnp-org:service:ContentDirectory", URN, true, this);
for(int i=0;i<RetVal.Length;++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("Browse");
S.AddMethod("CreateObject");
S.AddMethod("CreateReference");
S.AddMethod("DeleteResource");
S.AddMethod("DestroyObject");
S.AddMethod("ExportResource");
S.AddMethod("GetSearchCapabilities");
S.AddMethod("GetSortCapabilities");
S.AddMethod("GetSystemUpdateID");
S.AddMethod("GetTransferProgress");
S.AddMethod("ImportResource");
S.AddMethod("Search");
S.AddMethod("StopTransferResource");
S.AddMethod("UpdateObject");
return(S);
}
示例4: OnModifiedSink_SystemUpdateID
private void OnModifiedSink_SystemUpdateID(UPnPStateVariable sender, object NewValue)
{
if (OnStateVariableModified_SystemUpdateID != null) OnStateVariableModified_SystemUpdateID(this);
}
示例5: OnModifiedSink_ContainerUpdateIDs
private void OnModifiedSink_ContainerUpdateIDs(UPnPStateVariable sender, object NewValue)
{
if (OnStateVariableModified_ContainerUpdateIDs != null) OnStateVariableModified_ContainerUpdateIDs(this);
}
示例6: OnModifiedSink_A_ARG_TYPE_TransferTotal
private void OnModifiedSink_A_ARG_TYPE_TransferTotal(UPnPStateVariable sender, object NewValue)
{
if (OnStateVariableModified_A_ARG_TYPE_TransferTotal != null) OnStateVariableModified_A_ARG_TYPE_TransferTotal(this);
}
示例7: ParseStateVarXml
//.........这里部分代码省略.........
stepval = XMLDoc.Value;
break;
}
break;
}
}
break;
}
break;
case XmlNodeType.EndElement:
if (XMLDoc.LocalName == "stateVariable")
{
done = true;
}
break;
case XmlNodeType.Text:
switch (LocalName)
{
case "name":
name = XMLDoc.Value.Trim();
break;
case "dataType":
DataType = XMLDoc.Value.Trim();
break;
case "defaultValue":
DefaultValue = XMLDoc.Value;
HasDef = true;
break;
}
break;
}
}
UPnPStateVariable var;
if (CT == null)
{
var = new UPnPStateVariable(name);
}
else
{
var = new UPnPStateVariable(name, CT);
}
var.ParentService = this;
if (evented == "yes")
{
var.SendEvent = true;
}
if (multicasted == "yes")
{
var.MulticastEvent = true;
}
var.VarType = DataType;
if (allowedValueList.Count > 0)
{
var.AllowedStringValues = (string[])allowedValueList.ToArray(typeof(string));
}
if (HasDef)
{
var.DefaultValue = UPnPService.CreateObjectInstance(var.GetNetType(), DefaultValue);
}
if ((minval != null) && (maxval != null))
{
Object stepobj = null;
if (stepval != null)
{
示例8: SendEvents
internal void SendEvents(UPnPStateVariable V)
{
//IDictionaryEnumerator en = SubscriberTable.GetEnumerator();
SubscriberInfo sinfo;
HTTPMessage Packet;
Uri[] EventURLS;
ICollection en = SubscriberTable.Keys;
String[] KEYS = new String[en.Count];
HTTPRequest R;
en.CopyTo(KEYS, 0);
for (int keyid = 0; keyid < KEYS.Length; ++keyid)
{
object _tobj = SubscriberTable[KEYS[keyid]];
if (_tobj != null)
{
sinfo = (SubscriberInfo)_tobj;
if ((sinfo.Expires > DateTime.Now.Ticks) || (sinfo.Expires == -1))
{
EventURLS = ParseEventURL(sinfo.CallbackURL);
for (int x = 0; x < EventURLS.Length; ++x)
{
try
{
IPAddress dest = IPAddress.Parse(EventURLS[x].Host);
Packet = new HTTPMessage();
Packet.Directive = "NOTIFY";
Packet.AddTag("Content-Type", "text/xml");
Packet.AddTag("NT", "upnp:event");
Packet.AddTag("NTS", "upnp:propchange");
Packet.BodyBuffer = BuildEventXML(new UPnPStateVariable[1] { V });
Packet.DirectiveObj = HTTPMessage.UnEscapeString(EventURLS[x].PathAndQuery);
if (dest.AddressFamily == AddressFamily.InterNetwork) Packet.AddTag("Host", EventURLS[x].Host + ":" + EventURLS[x].Port.ToString());
if (dest.AddressFamily == AddressFamily.InterNetworkV6) Packet.AddTag("Host", "[" + RemoveIPv6Scope(EventURLS[x].Host) + "]:" + EventURLS[x].Port.ToString());
Packet.AddTag("SID", sinfo.SID);
Packet.AddTag("SEQ", sinfo.SEQ.ToString());
Packet.AddTag("CONNECTION", "close");
++sinfo.SEQ;
SubscriberTable[KEYS[keyid]] = sinfo;
//OpenSource.Utilities.EventLogger.Log(this,System.Diagnostics.EventLogEntryType.SuccessAudit,Packet.StringBuffer);
R = new HTTPRequest();
SendEventTable[R] = R;
R.OnResponse += new HTTPRequest.RequestHandler(HandleSendEvent);
R.PipelineRequest(new IPEndPoint(IPAddress.Parse(EventURLS[x].Host), EventURLS[x].Port), Packet, null);
}
catch (Exception)
{
}
}
}
else
{
SubscriberTable.Remove(sinfo.SID);
}
}
}
}
示例9: OnModifiedSink_RedVideoBlackLevel
private void OnModifiedSink_RedVideoBlackLevel(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_RedVideoBlackLevel != null) OnStateVariableModified_RedVideoBlackLevel(this);
}
示例10: OnModifiedSink_Contrast
private void OnModifiedSink_Contrast(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_Contrast != null) OnStateVariableModified_Contrast(this);
}
示例11: OnModifiedSink_VolumeDB
private void OnModifiedSink_VolumeDB(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_VolumeDB != null) OnStateVariableModified_VolumeDB(this);
}
示例12: OnModifiedSink_ColorTemperature
private void OnModifiedSink_ColorTemperature(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_ColorTemperature != null) OnStateVariableModified_ColorTemperature(this);
}
示例13: OnModifiedSink_PresetNameList
private void OnModifiedSink_PresetNameList(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_PresetNameList != null) OnStateVariableModified_PresetNameList(this);
}
示例14: OnModifiedSink_Mute
private void OnModifiedSink_Mute(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_Mute != null) OnStateVariableModified_Mute(this);
}
示例15: OnModifiedSink_HorizontalKeystone
private void OnModifiedSink_HorizontalKeystone(UPnPStateVariable sender, object NewValue)
{
if(OnStateVariableModified_HorizontalKeystone != null) OnStateVariableModified_HorizontalKeystone(this);
}