本文整理汇总了C#中OpenSource.UPnP.UPnPStateVariable.SetRange方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPStateVariable.SetRange方法的具体用法?C# UPnPStateVariable.SetRange怎么用?C# UPnPStateVariable.SetRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSource.UPnP.UPnPStateVariable
的用法示例。
在下文中一共展示了UPnPStateVariable.SetRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}