void OutputBehaviour::saveChannelsToScene(DsScenePtr aScene) { if (aScene) { // save default channel's value to first channel of scene ChannelBehaviourPtr ch = getChannelByIndex(0); if (ch) { double newval = ch->getChannelValue(); aScene->setSceneValue(0, newval); } aScene->setSceneValueFlags(0, valueflags_dontCare, false); } }
void EnoceanRelayControlDevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming) { // standard output behaviour if (output) { ChannelBehaviourPtr ch = output->getChannelByType(channeltype_default); if (ch->needsApplying()) { bool up = ch->getChannelValue() >= (ch->getMax()-ch->getMin())/2; buttonAction(false, up, true); MainLoop::currentMainLoop().executeOnce(boost::bind(&EnoceanRelayControlDevice::sendReleaseTelegram, this, aDoneCB, up), BUTTON_PRESS_TIME); ch->channelValueApplied(); } } }
void DigitalIODevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming) { LightBehaviourPtr lightBehaviour = boost::dynamic_pointer_cast<LightBehaviour>(output); if (lightBehaviour) { // light if (lightBehaviour->brightnessNeedsApplying()) { indicatorOutput->set(lightBehaviour->brightnessForHardware()); lightBehaviour->brightnessApplied(); // confirm having applied the value } } else if (output) { // simple switch output, activates at 50% of possible output range ChannelBehaviourPtr ch = output->getChannelByIndex(0); if (ch->needsApplying()) { indicatorOutput->set(ch->getChannelValue() >= (ch->getMax()-ch->getMin())/2); ch->channelValueApplied(); } } inherited::applyChannelValues(aDoneCB, aForDimming); }