public static AdapterInterface CreateColor(double currentHue, double currentSaturation, Action<double> onHueChanged, Action<double> onSaturationChanged)
{
var iface = new AdapterInterface("org.alljoyn.SmartSpaces.Operation.Color");
iface.Properties.Add(new AdapterAttribute("Version", (ushort)1) { COVBehavior = SignalBehavior.Never });
iface.Properties[0].Annotations.Add("org.alljoyn.Bus.DocString.En", "The interface version");
iface.Properties.Add(new AdapterAttribute("Hue", currentHue, (value) =>
{
if (!(value is double))
return AllJoynStatusCode.BUS_BAD_VALUE_TYPE;
double hue = (double)value;
if (hue < 0 || hue > 360)
return AllJoynStatusCode.BUS_BAD_VALUE;
onHueChanged(hue);
return AllJoynStatusCode.Ok;
}) { COVBehavior = SignalBehavior.Always });
iface.Properties[1].Annotations.Add("org.alljoyn.Bus.DocString.En", "Hue of the device.");
iface.Properties[1].Annotations.Add("org.alljoyn.Bus.DocString.Min", "0.0");
iface.Properties[1].Annotations.Add("org.alljoyn.Bus.DocString.Max", "360.0.");
iface.Properties.Add(new AdapterAttribute("Saturation", currentSaturation, (value) =>
{
if (!(value is double))
return AllJoynStatusCode.BUS_BAD_VALUE_TYPE;
double saturation = (double)value;
if (saturation < 0 || saturation > 1)
return AllJoynStatusCode.BUS_BAD_VALUE;
onSaturationChanged(saturation);
return AllJoynStatusCode.Ok;
})
{ COVBehavior = SignalBehavior.Always });
iface.Properties[2].Annotations.Add("org.alljoyn.Bus.DocString.En", "Saturation of the device.");
iface.Properties[2].Annotations.Add("org.alljoyn.Bus.DocString.Min", "0.0");
iface.Properties[2].Annotations.Add("org.alljoyn.Bus.DocString.Max", "1.0.");
return iface;
}
}