本文整理汇总了C#中OpenSource.UPnP.UPnPService.AddMethod方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPService.AddMethod方法的具体用法?C# UPnPService.AddMethod怎么用?C# UPnPService.AddMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSource.UPnP.UPnPService
的用法示例。
在下文中一共展示了UPnPService.AddMethod方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
var device = UPnPDevice.CreateRootDevice(int.MaxValue, 1.0, "\\");
device.FriendlyName = Environment.MachineName + ":" + "Network Light";
device.DeviceURN = "NetworkLight";
device.HasPresentation = false;
var switchPower = new UPnPService(1.0, typeof(SwitchPower).GUID.ToString(), typeof(SwitchPower).FullName, true, new SwitchPower());
switchPower.AddMethod("SetTarget");
switchPower.AddMethod("GetTarget");
switchPower.AddMethod("GetStatus");
device.AddService(switchPower);
device.StartDevice();
Console.ReadLine();
device.StopDevice();
}
示例2: UPnPServiceProxy
public UPnPServiceProxy(Type serviceType, Type contractType)
{
var service = Activator.CreateInstance(serviceType);
_upnp = new UPnPService(1, contractType.GUID.ToString(), contractType.FullName, true, service);
var methods = (from meth in contractType.GetMethods()
where meth.GetCustomAttributes(false).Where( atr => atr.GetType() == typeof(OperationContractAttribute)).Count()>0
select meth).ToArray();
foreach (var meth in methods)
{
_upnp.AddMethod(meth.Name);
}
}
示例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: 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();
}
示例5: BuildUPnPService
//.........这里部分代码省略.........
RetVal[8].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[8].AddAssociation("SetGreenVideoBlackLevel", "DesiredGreenVideoBlackLevel");
RetVal[8].AddAssociation("GetGreenVideoBlackLevel", "CurrentGreenVideoBlackLevel");
RetVal[9] = new UPnPModeratedStateVariable("Volume", typeof(System.UInt16), false);
RetVal[9].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[9].AddAssociation("GetVolume", "CurrentVolume");
RetVal[9].AddAssociation("SetVolume", "DesiredVolume");
RetVal[10] = new UPnPModeratedStateVariable("Mute", typeof(System.Boolean), false);
RetVal[10].AddAssociation("GetMute", "CurrentMute");
RetVal[10].AddAssociation("SetMute", "DesiredMute");
RetVal[11] = new UPnPModeratedStateVariable("Brightness", typeof(System.UInt16), false);
RetVal[11].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[11].AddAssociation("SetBrightness", "DesiredBrightness");
RetVal[11].AddAssociation("GetBrightness", "CurrentBrightness");
RetVal[12] = new UPnPModeratedStateVariable("PresetNameList", typeof(System.String), false);
RetVal[12].AddAssociation("ListPresets", "CurrentPresetNameList");
RetVal[13] = new UPnPModeratedStateVariable("A_ARG_TYPE_Channel", typeof(System.String), false);
RetVal[13].AllowedStringValues = new string[15]{"Master", "LF", "RF", "CF", "LFE", "LS", "RS", "LFC", "RFC", "SD", "SL", "SR", "T", "B", "Vendor defined"};
RetVal[13].AddAssociation("GetVolume", "Channel");
RetVal[13].AddAssociation("SetVolume", "Channel");
RetVal[13].AddAssociation("SetVolumeDB", "Channel");
RetVal[13].AddAssociation("SetLoudness", "Channel");
RetVal[13].AddAssociation("GetLoudness", "Channel");
RetVal[13].AddAssociation("GetVolumeDBRange", "Channel");
RetVal[13].AddAssociation("GetMute", "Channel");
RetVal[13].AddAssociation("GetVolumeDB", "Channel");
RetVal[13].AddAssociation("SetMute", "Channel");
RetVal[14] = new UPnPModeratedStateVariable("ColorTemperature", typeof(System.UInt16), false);
RetVal[14].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[14].AddAssociation("GetColorTemperature", "CurrentColorTemperature");
RetVal[14].AddAssociation("SetColorTemperature", "DesiredColorTemperature");
RetVal[15] = new UPnPModeratedStateVariable("VolumeDB", typeof(System.Int16), false);
RetVal[15].SetRange((System.Int16)(-32768),(System.Int16)(32767),null);
RetVal[15].AddAssociation("SetVolumeDB", "DesiredVolume");
RetVal[15].AddAssociation("GetVolumeDBRange", "MinValue");
RetVal[15].AddAssociation("GetVolumeDBRange", "MaxValue");
RetVal[15].AddAssociation("GetVolumeDB", "CurrentVolume");
RetVal[16] = new UPnPModeratedStateVariable("Contrast", typeof(System.UInt16), false);
RetVal[16].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[16].AddAssociation("SetContrast", "DesiredContrast");
RetVal[16].AddAssociation("GetContrast", "CurrentContrast");
RetVal[17] = new UPnPModeratedStateVariable("GreenVideoGain", typeof(System.UInt16), false);
RetVal[17].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[17].AddAssociation("GetGreenVideoGain", "CurrentGreenVideoGain");
RetVal[17].AddAssociation("SetGreenVideoGain", "DesiredGreenVideoGain");
RetVal[18] = new UPnPModeratedStateVariable("RedVideoBlackLevel", typeof(System.UInt16), false);
RetVal[18].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[18].AddAssociation("SetRedVideoBlackLevel", "DesiredRedVideoBlackLevel");
RetVal[18].AddAssociation("GetRedVideoBlackLevel", "CurrentRedVideoBlackLevel");
RetVal[19] = new UPnPModeratedStateVariable("BlueVideoGain", typeof(System.UInt16), false);
RetVal[19].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[19].AddAssociation("GetBlueVideoGain", "CurrentBlueVideoGain");
RetVal[19].AddAssociation("SetBlueVideoGain", "DesiredBlueVideoGain");
RetVal[20] = new UPnPModeratedStateVariable("Sharpness", typeof(System.UInt16), false);
RetVal[20].SetRange((System.UInt16)(0),(System.UInt16)(65535),(System.UInt16)1);
RetVal[20].AddAssociation("GetSharpness", "CurrentSharpness");
RetVal[20].AddAssociation("SetSharpness", "DesiredSharpness");
UPnPService S = new UPnPService(1, "urn:schemas-upnp-org:service:RenderingControl", "urn:schemas-upnp-org:service:RenderingControl:1", true, this);
for(int i=0;i<RetVal.Length;++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("GetHorizontalKeystone");
S.AddMethod("GetVolume");
S.AddMethod("SelectPreset");
S.AddMethod("SetVolume");
S.AddMethod("ListPresets");
S.AddMethod("SetVolumeDB");
S.AddMethod("SetRedVideoBlackLevel");
S.AddMethod("SetContrast");
S.AddMethod("SetLoudness");
S.AddMethod("SetBrightness");
S.AddMethod("GetLoudness");
S.AddMethod("GetColorTemperature");
S.AddMethod("GetSharpness");
S.AddMethod("GetContrast");
S.AddMethod("GetGreenVideoGain");
S.AddMethod("SetRedVideoGain");
S.AddMethod("SetGreenVideoBlackLevel");
S.AddMethod("GetVolumeDBRange");
S.AddMethod("GetRedVideoBlackLevel");
S.AddMethod("GetBlueVideoBlackLevel");
S.AddMethod("GetBlueVideoGain");
S.AddMethod("SetBlueVideoBlackLevel");
S.AddMethod("GetMute");
S.AddMethod("SetBlueVideoGain");
S.AddMethod("GetVerticalKeystone");
S.AddMethod("SetVerticalKeystone");
S.AddMethod("GetBrightness");
S.AddMethod("GetVolumeDB");
S.AddMethod("GetGreenVideoBlackLevel");
S.AddMethod("GetRedVideoGain");
S.AddMethod("SetMute");
S.AddMethod("SetGreenVideoGain");
S.AddMethod("SetSharpness");
S.AddMethod("SetHorizontalKeystone");
S.AddMethod("SetColorTemperature");
return(S);
}
示例6: BuildUPnPService
protected UPnPService BuildUPnPService()
{
UPnPStateVariable[] RetVal = new UPnPStateVariable[10];
RetVal[0] = new UPnPModeratedStateVariable("A_ARG_TYPE_ConnectionStatus", typeof(System.String), false);
RetVal[0].AllowedStringValues = new string[5] { "OK", "ContentFormatMismatch", "InsufficientBandwidth", "UnreliableChannel", "Unknown" };
RetVal[0].AddAssociation("GetCurrentConnectionInfo", "Status");
RetVal[1] = new UPnPModeratedStateVariable("A_ARG_TYPE_ConnectionID", typeof(System.Int32), false);
RetVal[1].AddAssociation("GetCurrentConnectionInfo", "ConnectionID");
RetVal[1].AddAssociation("GetCurrentConnectionInfo", "PeerConnectionID");
RetVal[2] = new UPnPModeratedStateVariable("A_ARG_TYPE_Direction", typeof(System.String), false);
RetVal[2].AllowedStringValues = new string[2] { "Input", "Output" };
RetVal[2].AddAssociation("GetCurrentConnectionInfo", "Direction");
RetVal[3] = new UPnPModeratedStateVariable("A_ARG_TYPE_RcsID", typeof(System.Int32), false);
RetVal[3].AddAssociation("GetCurrentConnectionInfo", "RcsID");
RetVal[4] = new UPnPModeratedStateVariable("SourceProtocolInfo", typeof(System.String), true);
RetVal[4].AddAssociation("GetProtocolInfo", "Source");
RetVal[5] = new UPnPModeratedStateVariable("SinkProtocolInfo", typeof(System.String), true);
RetVal[5].AddAssociation("GetProtocolInfo", "Sink");
RetVal[6] = new UPnPModeratedStateVariable("A_ARG_TYPE_ProtocolInfo", typeof(System.String), false);
RetVal[6].AddAssociation("GetCurrentConnectionInfo", "ProtocolInfo");
RetVal[7] = new UPnPModeratedStateVariable("A_ARG_TYPE_ConnectionManager", typeof(System.String), false);
RetVal[7].AddAssociation("GetCurrentConnectionInfo", "PeerConnectionManager");
RetVal[8] = new UPnPModeratedStateVariable("A_ARG_TYPE_AVTransportID", typeof(System.Int32), false);
RetVal[8].AddAssociation("GetCurrentConnectionInfo", "AVTransportID");
RetVal[9] = new UPnPModeratedStateVariable("CurrentConnectionIDs", typeof(System.String), true);
RetVal[9].AddAssociation("GetCurrentConnectionIDs", "ConnectionIDs");
UPnPService S = new UPnPService(1, "urn:schemas-upnp-org:service:ConnectionManager", URN, true, this);
for (int i = 0; i < RetVal.Length; ++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("GetCurrentConnectionIDs");
S.AddMethod("GetCurrentConnectionInfo");
S.AddMethod("GetProtocolInfo");
return (S);
}
示例7: BuildUPnPService
//.........这里部分代码省略.........
RetVal[7] = new UPnPModeratedStateVariable("PossibleRecordQualityModes", typeof(System.String), false);
RetVal[7].AddAssociation("GetDeviceCapabilities", "RecQualityModes");
RetVal[8] = new UPnPModeratedStateVariable("CurrentMediaDuration", typeof(System.String), false);
RetVal[8].AddAssociation("GetMediaInfo", "MediaDuration");
RetVal[9] = new UPnPModeratedStateVariable("AbsoluteCounterPosition", typeof(System.Int32), false);
RetVal[9].AddAssociation("GetPositionInfo", "AbsCount");
RetVal[10] = new UPnPModeratedStateVariable("RelativeCounterPosition", typeof(System.Int32), false);
RetVal[10].AddAssociation("GetPositionInfo", "RelCount");
RetVal[11] = new UPnPModeratedStateVariable("A_ARG_TYPE_InstanceID", typeof(System.UInt32), false);
RetVal[11].AddAssociation("Play", "InstanceID");
RetVal[11].AddAssociation("Stop", "InstanceID");
RetVal[11].AddAssociation("Next", "InstanceID");
RetVal[11].AddAssociation("Previous", "InstanceID");
RetVal[11].AddAssociation("SetNextAVTransportURI", "InstanceID");
RetVal[11].AddAssociation("GetMediaInfo", "InstanceID");
RetVal[11].AddAssociation("GetDeviceCapabilities", "InstanceID");
RetVal[11].AddAssociation("SetAVTransportURI", "InstanceID");
RetVal[11].AddAssociation("SetPlayMode", "InstanceID");
RetVal[11].AddAssociation("GetCurrentTransportActions", "InstanceID");
RetVal[11].AddAssociation("GetTransportSettings", "InstanceID");
RetVal[11].AddAssociation("GetTransportInfo", "InstanceID");
RetVal[11].AddAssociation("Pause", "InstanceID");
RetVal[11].AddAssociation("Seek", "InstanceID");
RetVal[11].AddAssociation("GetPositionInfo", "InstanceID");
RetVal[11].AddAssociation("Record", "InstanceID");
RetVal[11].AddAssociation("SetRecordQualityMode", "InstanceID");
RetVal[12] = new UPnPModeratedStateVariable("AVTransportURI", typeof(System.String), false);
RetVal[12].AddAssociation("GetMediaInfo", "CurrentURI");
RetVal[12].AddAssociation("SetAVTransportURI", "CurrentURI");
RetVal[13] = new UPnPModeratedStateVariable("CurrentTrackMetaData", typeof(System.String), false);
RetVal[13].AddAssociation("GetPositionInfo", "TrackMetaData");
RetVal[14] = new UPnPModeratedStateVariable("TransportPlaySpeed", typeof(System.String), false);
RetVal[14].AllowedStringValues = new string[2]{"1", " vendor-defined "};
RetVal[14].AddAssociation("Play", "Speed");
RetVal[14].AddAssociation("GetTransportInfo", "CurrentSpeed");
RetVal[15] = new UPnPModeratedStateVariable("NextAVTransportURI", typeof(System.String), false);
RetVal[15].AddAssociation("SetNextAVTransportURI", "NextURI");
RetVal[15].AddAssociation("GetMediaInfo", "NextURI");
RetVal[16] = new UPnPModeratedStateVariable("AVTransportURIMetaData", typeof(System.String), false);
RetVal[16].AddAssociation("GetMediaInfo", "CurrentURIMetaData");
RetVal[16].AddAssociation("SetAVTransportURI", "CurrentURIMetaData");
RetVal[17] = new UPnPModeratedStateVariable("PossibleRecordStorageMedia", typeof(System.String), false);
RetVal[17].AddAssociation("GetDeviceCapabilities", "RecMedia");
RetVal[18] = new UPnPModeratedStateVariable("AbsoluteTimePosition", typeof(System.String), false);
RetVal[18].AddAssociation("GetPositionInfo", "AbsTime");
RetVal[19] = new UPnPModeratedStateVariable("NextAVTransportURIMetaData", typeof(System.String), false);
RetVal[19].AddAssociation("SetNextAVTransportURI", "NextURIMetaData");
RetVal[19].AddAssociation("GetMediaInfo", "NextURIMetaData");
RetVal[20] = new UPnPModeratedStateVariable("PlaybackStorageMedium", typeof(System.String), false);
RetVal[20].AllowedStringValues = new string[33]{"UNKNOWN", "DV", "MINI-DV", "VHS", "W-VHS", "S-VHS", "D-VHS", "VHSC", "VIDEO8", "HI8", "CD-ROM", "CD-DA", "CD-R", "CD-RW", "VIDEO-CD", "SACD", "MD-AUDIO", "MD-PICTURE", "DVD-ROM", "DVD-VIDEO", "DVD-R", "DVD+RW", "DVD-RW", "DVD-RAM", "DVD-AUDIO", "DAT", "LD", "HDD", "MICRO-MV", "NETWORK", "NONE", "NOT_IMPLEMENTED", " vendor-defined "};
RetVal[20].AddAssociation("GetMediaInfo", "PlayMedium");
RetVal[21] = new UPnPModeratedStateVariable("CurrentTransportActions", typeof(System.String), false);
RetVal[21].AddAssociation("GetCurrentTransportActions", "Actions");
RetVal[22] = new UPnPModeratedStateVariable("RecordMediumWriteStatus", typeof(System.String), false);
RetVal[22].AllowedStringValues = new string[5]{"WRITABLE", "PROTECTED", "NOT_WRITABLE", "UNKNOWN", "NOT_IMPLEMENTED"};
RetVal[22].AddAssociation("GetMediaInfo", "WriteStatus");
RetVal[23] = new UPnPModeratedStateVariable("PossiblePlaybackStorageMedia", typeof(System.String), false);
RetVal[23].AddAssociation("GetDeviceCapabilities", "PlayMedia");
RetVal[24] = new UPnPModeratedStateVariable("TransportState", typeof(System.String), false);
RetVal[24].AllowedStringValues = new string[7]{"STOPPED", "PAUSED_PLAYBACK", "PAUSED_RECORDING", "PLAYING", "RECORDING", "TRANSITIONING", "NO_MEDIA_PRESENT"};
RetVal[24].AddAssociation("GetTransportInfo", "CurrentTransportState");
RetVal[25] = new UPnPModeratedStateVariable("NumberOfTracks", typeof(System.UInt32), false);
RetVal[25].SetRange((System.UInt32)(0),(System.UInt32)(4294967295),null);
RetVal[25].AddAssociation("GetMediaInfo", "NrTracks");
RetVal[26] = new UPnPModeratedStateVariable("A_ARG_TYPE_SeekMode", typeof(System.String), false);
RetVal[26].AllowedStringValues = new string[8]{"ABS_TIME", "REL_TIME", "ABS_COUNT", "REL_COUNT", "TRACK_NR", "CHANNEL_FREQ", "TAPE-INDEX", "FRAME"};
RetVal[26].AddAssociation("Seek", "Unit");
RetVal[27] = new UPnPModeratedStateVariable("CurrentTrack", typeof(System.UInt32), false);
RetVal[27].SetRange((System.UInt32)(0),(System.UInt32)(4294967295),(System.UInt32)1);
RetVal[27].AddAssociation("GetPositionInfo", "Track");
RetVal[28] = new UPnPModeratedStateVariable("TransportStatus", typeof(System.String), false);
RetVal[28].AllowedStringValues = new string[3]{"OK", "ERROR_OCCURRED", " vendor-defined "};
RetVal[28].AddAssociation("GetTransportInfo", "CurrentTransportStatus");
RetVal[29] = new UPnPModeratedStateVariable("A_ARG_TYPE_SeekTarget", typeof(System.String), false);
RetVal[29].AddAssociation("Seek", "Target");
UPnPService S = new UPnPService(1, "urn:schemas-upnp-org:service:AVTransport", "urn:schemas-upnp-org:service:AVTransport:1", true, this);
for(int i=0;i<RetVal.Length;++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("Play");
S.AddMethod("Stop");
S.AddMethod("Next");
S.AddMethod("Previous");
S.AddMethod("SetNextAVTransportURI");
S.AddMethod("GetMediaInfo");
S.AddMethod("GetDeviceCapabilities");
S.AddMethod("SetAVTransportURI");
S.AddMethod("SetPlayMode");
S.AddMethod("GetCurrentTransportActions");
S.AddMethod("GetTransportSettings");
S.AddMethod("GetTransportInfo");
S.AddMethod("Pause");
S.AddMethod("Seek");
S.AddMethod("GetPositionInfo");
S.AddMethod("Record");
S.AddMethod("SetRecordQualityMode");
return(S);
}
示例8: BuildUPnPService
protected UPnPService BuildUPnPService()
{
UPnPStateVariable[] RetVal = new UPnPStateVariable[2];
RetVal[0] = new UPnPModeratedStateVariable("brightness", typeof(System.Int32), true);
RetVal[0].AddAssociation("getBrightness", "returnBrightness");
RetVal[0].AddAssociation("setBrightness", "inputBrightness");
RetVal[1] = new UPnPModeratedStateVariable("temperature", typeof(System.Int32), true);
RetVal[1].AddAssociation("getTemperature", "returnTemperature");
RetVal[1].AddAssociation("setTemperature", "inputTemperature");
UPnPService S = new UPnPService(1, "urn:upnp-org:serviceId:001", URN, true, this);
for(int i=0;i<RetVal.Length;++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("getBrightness");
S.AddMethod("getTemperature");
S.AddMethod("setBrightness");
S.AddMethod("setTemperature");
return(S);
}
示例9: MainForm
public MainForm(string[] args)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
foreach (string parm in args)
{
if (parm.ToUpper().StartsWith("/CACHE:"))
{
DText p = new DText();
p.ATTRMARK = ":";
p[0] = parm;
try
{
CacheTime = int.Parse(p[2]);
}
catch (Exception)
{
}
}
else if (parm.ToUpper() == "/DEBUG")
{
OpenSource.Utilities.EventLogger.Enabled = true;
OpenSource.Utilities.EventLogger.ShowAll = true;
OpenSource.Utilities.InstanceTracker.Display();
}
else if (parm.ToUpper().StartsWith("/PORT:"))
{
DText p = new DText();
p.ATTRMARK = ":";
p[0] = parm;
try
{
PortNum = int.Parse(p[2]);
}
catch (Exception)
{
}
}
}
upnpLightDevice = UPnPDevice.CreateRootDevice(CacheTime, 1, "web\\");
upnpLightDevice.Icon = iconImageList.Images[0];
upnpLightDevice.HasPresentation = true;
upnpLightDevice.PresentationURL = "/";
upnpLightDevice.FriendlyName = this.Text + " (" + System.Windows.Forms.SystemInformation.ComputerName + ")";
upnpLightDevice.Manufacturer = "OpenSource";
upnpLightDevice.ManufacturerURL = "http://opentools.homeip.net";
upnpLightDevice.ModelName = "Network Light Bulb";
upnpLightDevice.ModelDescription = "Software Emulated Light Bulb";
upnpLightDevice.ModelURL = new Uri("http://opentools.homeip.net");
upnpLightDevice.ModelNumber = "XPC-L1";
upnpLightDevice.StandardDeviceType = "DimmableLight";
upnpLightDevice.UniqueDeviceName = System.Guid.NewGuid().ToString();
// Switch Power
upnpLightService = new UPnPService(1, "SwitchPower.0001", "SwitchPower", true, this);
upnpLightService.AddMethod("SetTarget");
upnpLightService.AddMethod("GetTarget");
upnpLightService.AddMethod("GetStatus");
UPnPStateVariable upnpStatusVar = new UPnPStateVariable("Status", typeof(bool), true);
upnpStatusVar.AddAssociation("GetStatus", "ResultStatus");
upnpStatusVar.Value = false;
upnpLightService.AddStateVariable(upnpStatusVar);
UPnPStateVariable upnpTargetVar = new UPnPStateVariable("Target", typeof(bool), false);
upnpTargetVar.AddAssociation("SetTarget", "newTargetValue");
upnpTargetVar.AddAssociation("GetTarget", "newTargetValue");
upnpTargetVar.Value = false;
upnpLightService.AddStateVariable(upnpTargetVar);
// Dimmable device
upnpDimmerService = new UPnPService(1, "Dimming.0001", "Dimming", true, this);
upnpDimmerService.AddMethod("SetLoadLevelTarget");
upnpDimmerService.AddMethod("GetLoadLevelTarget");
upnpDimmerService.AddMethod("GetLoadLevelStatus");
upnpDimmerService.AddMethod("GetMinLevel");
UPnPStateVariable upnpLevelTargetVar = new UPnPStateVariable("LoadLevelTarget", typeof(byte), false);
upnpLevelTargetVar.AddAssociation("SetLoadLevelTarget", "NewLoadLevelTarget");
upnpLevelTargetVar.AddAssociation("GetLoadLevelTarget", "NewLoadLevelTarget");
upnpLevelTargetVar.Value = (byte)100;
upnpLevelTargetVar.SetRange((byte)0, (byte)100, null);
upnpDimmerService.AddStateVariable(upnpLevelTargetVar);
UPnPStateVariable upnpLevelStatusVar = new UPnPStateVariable("LoadLevelStatus", typeof(byte), true);
upnpLevelStatusVar.AddAssociation("GetLoadLevelStatus", "RetLoadLevelStatus");
upnpLevelStatusVar.Value = (byte)100;
upnpLevelStatusVar.SetRange((byte)0, (byte)100, null);
upnpDimmerService.AddStateVariable(upnpLevelStatusVar);
UPnPStateVariable upnpMinLevelVar = new UPnPStateVariable("MinLevel", typeof(byte), false);
upnpMinLevelVar.AddAssociation("GetMinLevel", "MinLevel");
upnpMinLevelVar.Value = (byte)0;
upnpDimmerService.AddStateVariable(upnpMinLevelVar);
// Add Services
upnpLightDevice.AddService(upnpLightService);
upnpLightDevice.AddService(upnpDimmerService);
}
示例10: BuildUPnPService
protected UPnPService BuildUPnPService()
{
UPnPStateVariable[] RetVal = new UPnPStateVariable[14];
RetVal[0] = new UPnPModeratedStateVariable("A_ARG_TYPE_BrowseFlag", typeof(System.String), false);
RetVal[0].AllowedStringValues = new string[2] { "BrowseMetadata", "BrowseDirectChildren" };
RetVal[0].AddAssociation("Browse", "BrowseFlag");
RetVal[1] = new UPnPModeratedStateVariable("ContainerUpdateIDs", typeof(System.String), true);
RetVal[2] = new UPnPModeratedStateVariable("SystemUpdateID", typeof(System.UInt32), true);
RetVal[2].AddAssociation("GetSystemUpdateID", "Id");
RetVal[3] = new UPnPModeratedStateVariable("A_ARG_TYPE_Count", typeof(System.UInt32), false);
RetVal[3].AddAssociation("Browse", "RequestedCount");
RetVal[3].AddAssociation("Browse", "NumberReturned");
RetVal[3].AddAssociation("Browse", "TotalMatches");
RetVal[3].AddAssociation("Search", "RequestedCount");
RetVal[3].AddAssociation("Search", "NumberReturned");
RetVal[3].AddAssociation("Search", "TotalMatches");
RetVal[4] = new UPnPModeratedStateVariable("A_ARG_TYPE_SortCriteria", typeof(System.String), false);
RetVal[4].AddAssociation("Browse", "SortCriteria");
RetVal[4].AddAssociation("Search", "SortCriteria");
RetVal[5] = new UPnPModeratedStateVariable("SortCapabilities", typeof(System.String), false);
RetVal[5].AddAssociation("GetSortCapabilities", "SortCaps");
RetVal[6] = new UPnPModeratedStateVariable("A_ARG_TYPE_Index", typeof(System.UInt32), false);
RetVal[6].AddAssociation("Browse", "StartingIndex");
RetVal[6].AddAssociation("Search", "StartingIndex");
RetVal[7] = new UPnPModeratedStateVariable("A_ARG_TYPE_ObjectID", typeof(System.String), false);
RetVal[7].AddAssociation("Browse", "ObjectID");
RetVal[7].AddAssociation("Search", "ContainerID");
RetVal[8] = new UPnPModeratedStateVariable("A_ARG_TYPE_UpdateID", typeof(System.UInt32), false);
RetVal[8].AddAssociation("Browse", "UpdateID");
RetVal[8].AddAssociation("Search", "UpdateID");
RetVal[9] = new UPnPModeratedStateVariable("A_ARG_TYPE_Result", typeof(System.String), false);
RetVal[9].AddAssociation("Browse", "Result");
RetVal[9].AddAssociation("Search", "Result");
RetVal[10] = new UPnPModeratedStateVariable("SearchCapabilities", typeof(System.String), false);
RetVal[10].AddAssociation("GetSearchCapabilities", "SearchCaps");
RetVal[11] = new UPnPModeratedStateVariable("A_ARG_TYPE_SearchCriteria", typeof(System.String), false);
RetVal[11].AddAssociation("Search", "SearchCriteria");
RetVal[12] = new UPnPModeratedStateVariable("A_ARG_TYPE_Filter", typeof(System.String), false);
RetVal[12].AddAssociation("Browse", "Filter");
RetVal[12].AddAssociation("Search", "Filter");
RetVal[13] = new UPnPModeratedStateVariable("A_ARG_TYPE_Featurelist", typeof(System.String), false);
RetVal[13].AddAssociation("X_GetFeatureList", "Featurelist");
UPnPService S = new UPnPService(1, "urn:upnp-org:serviceId:ContentDirectory", "urn:schemas-upnp-org:service:ContentDirectory:1", true, this);
for (int i = 0; i < RetVal.Length; ++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("Browse");
S.AddMethod("GetSearchCapabilities");
S.AddMethod("GetSortCapabilities");
S.AddMethod("GetSystemUpdateID");
S.AddMethod("X_GetFeatureList");
S.AddMethod("Search");
return (S);
}
示例11: BuildUPnPService
protected UPnPService BuildUPnPService()
{
UPnPStateVariable[] RetVal = new UPnPStateVariable[8];
RetVal[0] = new UPnPModeratedStateVariable("AuthorizationDeniedUpdateID", typeof(System.UInt32), true);
RetVal[1] = new UPnPModeratedStateVariable("A_ARG_TYPE_DeviceID", typeof(System.String), false);
RetVal[1].AddAssociation("IsAuthorized", "DeviceID");
RetVal[1].AddAssociation("IsValidated", "DeviceID");
RetVal[2] = new UPnPModeratedStateVariable("A_ARG_TYPE_RegistrationRespMsg", typeof(System.Byte[]), false);
RetVal[2].AddAssociation("RegisterDevice", "RegistrationRespMsg");
RetVal[3] = new UPnPModeratedStateVariable("ValidationRevokedUpdateID", typeof(System.UInt32), true);
RetVal[4] = new UPnPModeratedStateVariable("ValidationSucceededUpdateID", typeof(System.UInt32), true);
RetVal[5] = new UPnPModeratedStateVariable("A_ARG_TYPE_Result", typeof(System.Int32), false);
RetVal[5].AddAssociation("IsAuthorized", "Result");
RetVal[5].AddAssociation("IsValidated", "Result");
RetVal[6] = new UPnPModeratedStateVariable("AuthorizationGrantedUpdateID", typeof(System.UInt32), true);
RetVal[7] = new UPnPModeratedStateVariable("A_ARG_TYPE_RegistrationReqMsg", typeof(System.Byte[]), false);
RetVal[7].AddAssociation("RegisterDevice", "RegistrationReqMsg");
UPnPService S = new UPnPService(1, "urn:microsoft.com:serviceId:X_MS_MediaReceiverRegistrar", "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1", true, this);
for (int i = 0; i < RetVal.Length; ++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("IsAuthorized");
S.AddMethod("IsValidated");
S.AddMethod("RegisterDevice");
return (S);
}
示例12: BuildUPnPService
protected UPnPService BuildUPnPService()
{
UPnPStateVariable[] RetVal = new UPnPStateVariable[12];
RetVal[0] = new UPnPModeratedStateVariable("Reverse", typeof(System.Boolean), false);
RetVal[0].AddAssociation("Register", "Reverse");
RetVal[1] = new UPnPModeratedStateVariable("ErrorString", typeof(System.String), false);
RetVal[1].AddAssociation("InvokeAsyncResponse", "ErrorString");
RetVal[2] = new UPnPModeratedStateVariable("StateVariableName", typeof(System.String), false);
RetVal[2].AddAssociation("FireEvent", "StateVariable");
RetVal[3] = new UPnPModeratedStateVariable("ServiceID", typeof(System.String), false);
RetVal[3].AddAssociation("Invoke", "ServiceID");
RetVal[3].AddAssociation("FireEvent", "ServiceID");
RetVal[3].AddAssociation("InvokeAsync", "ServiceID");
RetVal[3].AddAssociation("GetDocument", "ServiceID");
RetVal[3].AddAssociation("GetStateTable", "ServiceID");
RetVal[4] = new UPnPModeratedStateVariable("Document", typeof(System.Byte[]), false);
RetVal[4].AddAssociation("GetDocument", "Document");
RetVal[5] = new UPnPModeratedStateVariable("Args", typeof(System.Byte[]), false);
RetVal[5].AddAssociation("Invoke", "InArgs");
RetVal[5].AddAssociation("Invoke", "OutArgs");
RetVal[5].AddAssociation("InvokeAsync", "InArgs");
RetVal[5].AddAssociation("InvokeAsyncResponse", "OutArgs");
RetVal[5].AddAssociation("GetStateTable", "Variables");
RetVal[6] = new UPnPModeratedStateVariable("Handle", typeof(System.Int32), false);
RetVal[6].AddAssociation("InvokeAsync", "Handle");
RetVal[6].AddAssociation("InvokeAsyncResponse", "Handle");
RetVal[7] = new UPnPModeratedStateVariable("ProxyUri", typeof(System.Uri), false);
RetVal[7].AddAssociation("Register", "Proxy");
RetVal[7].AddAssociation("UnRegister", "Proxy");
RetVal[8] = new UPnPModeratedStateVariable("ActionName", typeof(System.String), false);
RetVal[8].AddAssociation("Invoke", "Action");
RetVal[8].AddAssociation("InvokeAsync", "Action");
RetVal[9] = new UPnPModeratedStateVariable("StateVariableValue", typeof(System.String), false);
RetVal[9].AddAssociation("FireEvent", "Value");
RetVal[10] = new UPnPModeratedStateVariable("DeviceUDN", typeof(System.String), false);
RetVal[10].AddAssociation("Invoke", "DeviceUDN");
RetVal[10].AddAssociation("FireEvent", "DeviceUDN");
RetVal[10].AddAssociation("AddDevice", "Sender");
RetVal[10].AddAssociation("AddDevice", "DeviceUDN");
RetVal[10].AddAssociation("InvokeAsync", "Caller");
RetVal[10].AddAssociation("InvokeAsync", "DeviceUDN");
RetVal[10].AddAssociation("GetDocument", "DeviceUDN");
RetVal[10].AddAssociation("GetStateTable", "DeviceUDN");
RetVal[10].AddAssociation("RemoveDevice", "DeviceUDN");
RetVal[11] = new UPnPModeratedStateVariable("ErrorCode", typeof(System.Int32), false);
RetVal[11].AddAssociation("InvokeAsyncResponse", "ErrorCode");
UPnPService S = new UPnPService(1, "UPNPRELAY_0-2", "urn:schemas-upnp-org:service:UPnPRelay:1", true, this);
for(int i=0;i<RetVal.Length;++i)
{
S.AddStateVariable(RetVal[i]);
}
S.AddMethod("Invoke");
S.AddMethod("FireEvent");
S.AddMethod("AddDevice");
S.AddMethod("InvokeAsync");
S.AddMethod("GetDocument");
S.AddMethod("InvokeAsyncResponse");
S.AddMethod("Register");
S.AddMethod("GetStateTable");
S.AddMethod("RemoveDevice");
S.AddMethod("UnRegister");
return(S);
}