Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <LifxPanController> panController = LifxCommunicator.Instance.Discover();

            if (panController.Count == 0)
            {
                MessageBox.Show("Could not find any bulbs");
                mPowerGB.Enabled       = false;
                mLabelsGB.Enabled      = false;
                mLightStatusGB.Enabled = false;
                return;
            }

            mBulb = panController[0].Bulbs[0];

            mBulbIPTB.Text        = mBulb.IpEndpoint.Address.ToString();
            mTargetMACTB.Text     = mBulb.MacAddress;
            mPANControllerTB.Text = mBulb.PanHandler;

            LifxPowerState powerState = mBulb.GetPowerState();

            if (powerState == LifxPowerState.On)
            {
                mPowerStateOnCB.Checked = true;
            }
            else
            {
                mPowerStateOnCB.Checked = false;
            }

            mPowerGB.Enabled       = true;
            mLabelsGB.Enabled      = true;
            mLightStatusGB.Enabled = true;
        }
Beispiel #2
0
 public LifxLightStatus(LifxColor color, LifxPowerState powerState, UInt16 dimState, String label, UInt64 tags)
 {
     mColor      = color;
     mPowerState = powerState;
     mDimState   = dimState;
     mDimState   = dimState;
     mTags       = tags;
 }
Beispiel #3
0
 public LifxLightStatus(LifxColor color, LifxPowerState powerState, UInt16 dimState, String label, UInt64 tags)
 {
     mColor = color;
     mPowerState = powerState;
     mDimState = dimState;
     mDimState = dimState;
     mTags = tags;
 }
Beispiel #4
0
        /// <summary>
        /// Set current power state
        /// </summary>
        /// <param name="stateToSet"></param>
        /// <returns>Returns the set power state</returns>
        public LifxPowerState SetPowerState(LifxPowerState stateToSet)
        {
            LifxSetPowerStateCommand command = new LifxSetPowerStateCommand(stateToSet);

            LifxCommunicator.Instance.SendCommand(command, this);

            LifxPowerStateMessage returnMessage = (LifxPowerStateMessage)command.ReturnMessage;

            return(returnMessage.PowerState);
        }
Beispiel #5
0
        /// <summary>
        /// Set current power state
        /// </summary>
        /// <param name="stateToSet"></param>
        /// <returns>Returns the set power state</returns>
        public LifxPowerState SetPowerState(LifxPowerState stateToSet)
        {
            LifxSetPowerStateCommand command = new LifxSetPowerStateCommand(stateToSet);

            LifxCommunicator.Instance.SendCommand(command, this);

            LifxPowerStateMessage returnMessage = (LifxPowerStateMessage)command.ReturnMessage;

            return returnMessage.PowerState;
        }
Beispiel #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            LifxPowerState currState = LifxPowerState.On;

            for (int i = 0; i < 10; i++)
            {
                if (currState == LifxPowerState.On)
                {
                    currState = LifxPowerState.Off;
                }
                else
                {
                    currState = LifxPowerState.On;
                }

                SetPowerState(currState);
                Thread.Sleep(400);
            }
        }
Beispiel #7
0
        public async Task <LifxPowerStateMessage> SetPowerStateCommand(LifxPowerState stateToSet)
        {
            LifxSetPowerStateCommand command = new LifxSetPowerStateCommand(stateToSet);

            return(await LifxCommunicator.Instance.SendCommand(command, this) as LifxPowerStateMessage);
        }
Beispiel #8
0
 private void SetPowerState(LifxPowerState state)
 {
     mBulb.SetPowerState(state);
 }
Beispiel #9
0
 private void SetPowerState(LifxPowerState state)
 {
     mBulb.SetPowerState(state);
 }
Beispiel #10
0
 public LifxSetPowerStateCommand(LifxPowerState stateToSet)
     : base(PACKET_TYPE, new LifxPowerStateMessage())
 {
     mStateToSet = stateToSet;
 }
 public LifxSetPowerStateCommand(LifxPowerState stateToSet)
     : base(PACKET_TYPE, new LifxPowerStateMessage())
 {
     mStateToSet = stateToSet;
 }
Beispiel #12
0
 public LifxSetPowerStateCommand(LifxPowerState stateToSet)
     : base(PACKET_TYPE, MessagePacketType.PowerState, true)
 {
     mStateToSet = stateToSet;
 }