示例#1
0
 protected void UpdateDeviceData(IHSApplication HS, string data)
 {
     if (data == null)
     {
         HS.SetDeviceString(RefId, string.Empty, true);
         HS.set_DeviceInvalidValue(RefId, true);
     }
     else
     {
         HS.set_DeviceInvalidValue(RefId, false);
         HS.SetDeviceString(RefId, data, true);
     }
 }
示例#2
0
        private void _createColor(string label)
        {
            if (Color != 0)
            {
                return;
            }

            IHSApplication hs = _plugin.hs;

            int         hsRef  = hs.NewDeviceRef(label + " Color");
            DeviceClass device = (DeviceClass)hs.GetDeviceByRef(hsRef);

            device.set_Address(hs, GetSubDeviceAddress(SubDeviceType.Color));
            device.set_Interface(hs, _plugin.Name);
            device.set_InterfaceInstance(hs, _plugin.InstanceFriendlyName());
            device.set_Device_Type_String(hs, "LIFX Device Color");
            device.set_DeviceType_Set(hs, new DeviceTypeInfo_m.DeviceTypeInfo {
                Device_API = DeviceTypeInfo_m.DeviceTypeInfo.eDeviceAPI.Plug_In
            });

            // Create the buttons and slider
            VSVGPairs.VSPair colorPicker = new VSVGPairs.VSPair(ePairStatusControl.Both);
            colorPicker.PairType   = VSVGPairs.VSVGPairType.SingleValue;
            colorPicker.Render     = Enums.CAPIControlType.Color_Picker;
            colorPicker.ControlUse = ePairControlUse._ColorControl;

            hs.DeviceVSP_AddPair(hsRef, colorPicker);

            device.MISC_Set(hs, Enums.dvMISC.SHOW_VALUES);

            hs.SetDeviceString(hsRef, "ffffff", false);

            Color = hsRef;
        }
示例#3
0
        public override void SetInitialData(IHSApplication HS, DeviceClass device)
        {
            int refId = device.get_Ref(HS);

            HS.set_DeviceInvalidValue(refId, false);
            HS.SetDeviceString(refId, "Root", false);
        }
示例#4
0
        /// <summary>
        /// Updates the device data from string data
        /// </summary>
        /// <param name="HS">Homeseer application.</param>
        /// <param name="device">The device to update.</param>
        /// <param name="data">string data.</param>
        protected void UpdateDeviceData(IHSApplication HS, DeviceClass device, [AllowNull] string data)
        {
            Trace.WriteLine(Invariant($"Updating {Name} Address [{device.get_Address(null)}] to [{data ?? "<NULL>"}]"));

            int refId = device.get_Ref(HS);

            HS.set_DeviceInvalidValue(refId, false);
            HS.SetDeviceString(refId, data, true);
        }
        private void UpdateConnectedDevices(double value, string text)
        {
            UpdateDevicesIfNecessary();
            var devicesToUpdate = _melcloudDevices.Where(x => x.IsOfPedType(Constants.Connection, _hs)).ToList();

            foreach (var deviceClass in devicesToUpdate)
            {
                var deviceRef = deviceClass.get_Ref(_hs);
                _hs.SetDeviceValueByRef(deviceRef, value, true);
                _hs.SetDeviceString(deviceRef, text, false);
            }
        }
示例#6
0
 protected void UpdateDeviceData(IHSApplication HS, [AllowNull] string data, [AllowNull] double?doubleData)
 {
     if (doubleData.HasValue)
     {
         UpdateDeviceData(HS, doubleData.Value);
     }
     else
     {
         HS.SetDeviceString(RefId, data, true);
         HS.set_DeviceInvalidValue(RefId, true);
     }
 }
示例#7
0
        private void _createRoot(string label)
        {
            if (Root != 0)
            {
                return;
            }

            IHSApplication hs = _plugin.hs;

            int         hsRef  = hs.NewDeviceRef(label);
            DeviceClass device = (DeviceClass)hs.GetDeviceByRef(hsRef);

            device.set_Address(hs, GetSubDeviceAddress(SubDeviceType.Root));
            device.set_Interface(hs, _plugin.Name);
            device.set_InterfaceInstance(hs, _plugin.InstanceFriendlyName());
            device.set_Device_Type_String(hs, "LIFX Root Device");
            device.set_DeviceType_Set(hs, new DeviceTypeInfo_m.DeviceTypeInfo {
                Device_Type = DeviceTypeInfo_m.DeviceTypeInfo.eDeviceType_GenericRoot
            });

            hs.SetDeviceString(hsRef, "No Status", false);

            Root = hsRef;
        }
示例#8
0
 public void setControllerStatus(string status)
 {
     internalStatus = status;
     HS.SetDeviceString(rootDev.get_Ref(null), status, false);
 }
 public override void SetInitialData(IHSApplication HS, int refID)
 {
     HS.set_DeviceInvalidValue(refID, false);
     HS.SetDeviceString(refID, "Root", false);
 }
示例#10
0
 public override void SetOnDeviceCreateData(IHSApplication HS, ICameraSettings cameraSettings, int refID)
 {
     HS.set_DeviceInvalidValue(refID, false);
     HS.SetDeviceString(refID, "Root", false);
 }
示例#11
0
 protected void UpdateDeviceData(IHSApplication HS, double data)
 {
     HS.set_DeviceInvalidValue(RefId, false);
     HS.SetDeviceString(RefId, string.Empty, false);
     HS.SetDeviceValueByRef(RefId, data, true);
 }