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; }
public LifxLightStatus(LifxColor color, LifxPowerState powerState, UInt16 dimState, String label, UInt64 tags) { mColor = color; mPowerState = powerState; mDimState = dimState; mDimState = dimState; mTags = tags; }
/// <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); }
/// <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; }
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); } }
public async Task <LifxPowerStateMessage> SetPowerStateCommand(LifxPowerState stateToSet) { LifxSetPowerStateCommand command = new LifxSetPowerStateCommand(stateToSet); return(await LifxCommunicator.Instance.SendCommand(command, this) as LifxPowerStateMessage); }
private void SetPowerState(LifxPowerState state) { mBulb.SetPowerState(state); }
public LifxSetPowerStateCommand(LifxPowerState stateToSet) : base(PACKET_TYPE, new LifxPowerStateMessage()) { mStateToSet = stateToSet; }
public LifxSetPowerStateCommand(LifxPowerState stateToSet) : base(PACKET_TYPE, MessagePacketType.PowerState, true) { mStateToSet = stateToSet; }