public LightServer(string udn, string friendlyName, string manufacturer, string modelName, Light light) { options = new DeviceOptions() { Services = new Service[] { new Service<Light>(Light.ServiceType, "urn:ls-net:serviceId:Light", this.light = light), }, }; this.server = new Server(new Root(DeviceType, udn, friendlyName, manufacturer, modelName, options)); }
protected internal Device(DeviceType type, string udn, string friendlyName, string manufacturer, string modelName, DeviceOptions options, IEnumerable <Device> devices) : this(devices, GetServices(options), GetIcons(options)) { if (type == null) { throw new ArgumentNullException("type"); } else if (udn == null) { throw new ArgumentNullException("udn"); } else if (!udn.StartsWith("uuid:")) { throw new ArgumentException(@"The udn must begin with ""uuid:"".", "udn"); } else if (friendlyName == null) { throw new ArgumentNullException("friendlyName"); } else if (manufacturer == null) { throw new ArgumentException("manufacturer"); } else if (modelName == null) { throw new ArgumentNullException("modelName"); } Type = type; Udn = udn; FriendlyName = friendlyName; Manufacturer = manufacturer; ModelName = modelName; if (options != null) { ManufacturerUrl = options.ManufacturerUrl; ModelDescription = options.ModelDescription; ModelNumber = options.ModelNumber; ModelUrl = options.ModelUrl; SerialNumber = options.SerialNumber; Upc = options.Upc; } }
static IEnumerable <Icon> GetIcons(DeviceOptions options) { return(options == null ? null : options.Icons); }
static IEnumerable <Service> GetServices(DeviceOptions options) { return(options == null ? null : options.Services); }