Commit 668d50d2 authored by luz's avatar luz

Cleanup: eliminated duplicate DoneCB and CompletedCB, replaced with equivalent...

Cleanup: eliminated duplicate DoneCB and CompletedCB, replaced with equivalent and Mainloop provided SimpleCB and StatusCB
parent bda47403
......@@ -261,7 +261,7 @@ void LightBehaviour::onAtMinBrightness(DsScenePtr aScene)
}
void LightBehaviour::performSceneActions(DsScenePtr aScene, DoneCB aDoneCB)
void LightBehaviour::performSceneActions(DsScenePtr aScene, SimpleCB aDoneCB)
{
// we can only handle light scenes
LightScenePtr lightScene = boost::dynamic_pointer_cast<LightScene>(aScene);
......@@ -333,7 +333,7 @@ Brightness LightBehaviour::PWMToBrightness(double aPWM, double aMaxPWM)
#pragma mark - blinking
void LightBehaviour::blink(MLMicroSeconds aDuration, LightScenePtr aParamScene, DoneCB aDoneCB, MLMicroSeconds aBlinkPeriod, int aOnRatioPercent)
void LightBehaviour::blink(MLMicroSeconds aDuration, LightScenePtr aParamScene, SimpleCB aDoneCB, MLMicroSeconds aBlinkPeriod, int aOnRatioPercent)
{
// save current state in temp scene
blinkDoneHandler = aDoneCB;
......@@ -383,7 +383,7 @@ void LightBehaviour::blinkHandler(MLMicroSeconds aEndTime, bool aState, MLMicroS
}
// done, call end handler if any
if (blinkDoneHandler) {
DoneCB h = blinkDoneHandler;
SimpleCB h = blinkDoneHandler;
blinkDoneHandler = NULL;
h();
}
......
......@@ -114,7 +114,7 @@ namespace p44 {
/// @name internal volatile state
/// @{
long blinkTicket; ///< when blinking
DoneCB blinkDoneHandler; ///< called when blinking done
SimpleCB blinkDoneHandler; ///< called when blinking done
LightScenePtr blinkRestoreScene; ///< scene to restore
long fadeDownTicket; ///< for slow fading operations
bool hardwareHasSetMinDim; ///< if set, hardware has set minDim (prevents loading from DB)
......@@ -190,7 +190,7 @@ namespace p44 {
/// perform special scene actions (like flashing) which are independent of dontCare flag.
/// @param aScene the scene that was called (if not dontCare, applyScene() has already been called)
/// @param aDoneCB will be called when scene actions have completed (but not necessarily when stopped by stopActions())
virtual void performSceneActions(DsScenePtr aScene, DoneCB aDoneCB);
virtual void performSceneActions(DsScenePtr aScene, SimpleCB aDoneCB);
/// will be called to stop all ongoing actions before next callScene etc. is issued.
/// @note this must stop all ongoing actions such that applying another scene or action right afterwards
......@@ -221,7 +221,7 @@ namespace p44 {
/// @param aDoneCB will be called when scene actions have completed
/// @param aBlinkPeriod how fast the blinking should be
/// @param aOnRatioPercent how many percents of aBlinkPeriod the indicator should be on
void blink(MLMicroSeconds aDuration, LightScenePtr aParamScene, DoneCB aDoneCB, MLMicroSeconds aBlinkPeriod = 600*MilliSecond, int aOnRatioPercent = 50);
void blink(MLMicroSeconds aDuration, LightScenePtr aParamScene, SimpleCB aDoneCB, MLMicroSeconds aBlinkPeriod = 600*MilliSecond, int aOnRatioPercent = 50);
/// stop blinking immediately
virtual void stopBlink();
......
......@@ -167,7 +167,7 @@ void DaliBusDevice::queryGroup8to15Response(DaliGroupsCB aDaliGroupsCB, DaliAddr
void DaliBusDevice::initialize(CompletedCB aCompletedCB, uint16_t aUsedGroupsMask)
void DaliBusDevice::initialize(StatusCB aCompletedCB, uint16_t aUsedGroupsMask)
{
// make sure device is in none of the used groups
if (aUsedGroupsMask==0) {
......@@ -180,7 +180,7 @@ void DaliBusDevice::initialize(CompletedCB aCompletedCB, uint16_t aUsedGroupsMas
}
void DaliBusDevice::groupMembershipResponse(CompletedCB aCompletedCB, uint16_t aUsedGroupsMask, DaliAddress aShortAddress, uint16_t aGroups, ErrorPtr aError)
void DaliBusDevice::groupMembershipResponse(StatusCB aCompletedCB, uint16_t aUsedGroupsMask, DaliAddress aShortAddress, uint16_t aGroups, ErrorPtr aError)
{
// remove groups that are in use on the bus
if (Error::isOK(aError)) {
......@@ -197,7 +197,7 @@ void DaliBusDevice::groupMembershipResponse(CompletedCB aCompletedCB, uint16_t a
void DaliBusDevice::updateParams(CompletedCB aCompletedCB)
void DaliBusDevice::updateParams(StatusCB aCompletedCB)
{
if (isDummy) aCompletedCB(ErrorPtr());
// query actual arc power level
......@@ -209,7 +209,7 @@ void DaliBusDevice::updateParams(CompletedCB aCompletedCB)
}
void DaliBusDevice::queryActualLevelResponse(CompletedCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
void DaliBusDevice::queryActualLevelResponse(StatusCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
{
currentBrightness = 0; // default to 0
if (Error::isOK(aError) && !aNoOrTimeout) {
......@@ -227,7 +227,7 @@ void DaliBusDevice::queryActualLevelResponse(CompletedCB aCompletedCB, bool aNoO
}
void DaliBusDevice::queryMinLevelResponse(CompletedCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
void DaliBusDevice::queryMinLevelResponse(StatusCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
{
minBrightness = 0; // default to 0
if (Error::isOK(aError) && !aNoOrTimeout) {
......@@ -241,7 +241,7 @@ void DaliBusDevice::queryMinLevelResponse(CompletedCB aCompletedCB, bool aNoOrTi
}
void DaliBusDevice::updateStatus(CompletedCB aCompletedCB)
void DaliBusDevice::updateStatus(StatusCB aCompletedCB)
{
if (isDummy) aCompletedCB(ErrorPtr());
// query the device for status
......@@ -253,7 +253,7 @@ void DaliBusDevice::updateStatus(CompletedCB aCompletedCB)
}
void DaliBusDevice::queryStatusResponse(CompletedCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
void DaliBusDevice::queryStatusResponse(StatusCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
{
if (Error::isOK(aError) && !aNoOrTimeout) {
isPresent = true; // answering a query means presence
......@@ -396,14 +396,14 @@ void DaliBusDeviceGroup::addDaliBusDevice(DaliBusDevicePtr aDaliBusDevice)
}
void DaliBusDeviceGroup::initialize(CompletedCB aCompletedCB, uint16_t aUsedGroupsMask)
void DaliBusDeviceGroup::initialize(StatusCB aCompletedCB, uint16_t aUsedGroupsMask)
{
DaliComm::ShortAddressList::iterator pos = groupMembers.begin();
initNextGroupMember(aCompletedCB, pos);
}
void DaliBusDeviceGroup::initNextGroupMember(CompletedCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember)
void DaliBusDeviceGroup::initNextGroupMember(StatusCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember)
{
if (aNextMember!=groupMembers.end()) {
// another member, query group membership, then adjust if needed
......@@ -419,7 +419,7 @@ void DaliBusDeviceGroup::initNextGroupMember(CompletedCB aCompletedCB, DaliComm:
}
}
void DaliBusDeviceGroup::groupMembershipResponse(CompletedCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember, uint16_t aGroups, ErrorPtr aError)
void DaliBusDeviceGroup::groupMembershipResponse(StatusCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember, uint16_t aGroups, ErrorPtr aError)
{
uint8_t groupNo = deviceInfo.shortAddress & DaliGroupMask;
// make sure device is member of the group
......@@ -539,14 +539,14 @@ string DaliDimmerDevice::getExtraInfo()
}
void DaliDimmerDevice::initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset)
void DaliDimmerDevice::initializeDevice(StatusCB aCompletedCB, bool aFactoryReset)
{
// - sync cached channel values from actual device
brightnessDimmer->updateParams(boost::bind(&DaliDimmerDevice::brightnessDimmerSynced, this, aCompletedCB, aFactoryReset, _1));
}
void DaliDimmerDevice::brightnessDimmerSynced(CompletedCB aCompletedCB, bool aFactoryReset, ErrorPtr aError)
void DaliDimmerDevice::brightnessDimmerSynced(StatusCB aCompletedCB, bool aFactoryReset, ErrorPtr aError)
{
if (Error::isOK(aError)) {
// save brightness now
......@@ -601,7 +601,7 @@ void DaliDimmerDevice::disconnectableHandler(bool aForgetParams, DisconnectCB aD
}
void DaliDimmerDevice::applyChannelValues(DoneCB aDoneCB, bool aForDimming)
void DaliDimmerDevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming)
{
LightBehaviourPtr lightBehaviour = boost::dynamic_pointer_cast<LightBehaviour>(output);
if (lightBehaviour && lightBehaviour->brightnessNeedsApplying()) {
......@@ -739,14 +739,14 @@ bool DaliRGBWDevice::addDimmer(DaliBusDevicePtr aDimmerBusDevice, string aDimmer
void DaliRGBWDevice::initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset)
void DaliRGBWDevice::initializeDevice(StatusCB aCompletedCB, bool aFactoryReset)
{
// - sync cached channel values from actual devices
updateNextDimmer(aCompletedCB, aFactoryReset, dimmer_red, ErrorPtr());
}
void DaliRGBWDevice::updateNextDimmer(CompletedCB aCompletedCB, bool aFactoryReset, DimmerIndex aDimmerIndex, ErrorPtr aError)
void DaliRGBWDevice::updateNextDimmer(StatusCB aCompletedCB, bool aFactoryReset, DimmerIndex aDimmerIndex, ErrorPtr aError)
{
if (!Error::isOK(aError)) {
LOG(LOG_ERR, "DaliRGBWDevice: error getting state/params from dimmer#%d: %s\n", aDimmerIndex-1, aError->description().c_str());
......@@ -831,7 +831,7 @@ void DaliRGBWDevice::disconnectableHandler(bool aForgetParams, DisconnectCB aDis
}
void DaliRGBWDevice::applyChannelValues(DoneCB aDoneCB, bool aForDimming)
void DaliRGBWDevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming)
{
RGBColorLightBehaviourPtr cl = boost::dynamic_pointer_cast<RGBColorLightBehaviour>(output);
if (cl) {
......
......@@ -96,13 +96,13 @@ namespace p44 {
/// initialize device for first use
/// @param aCompletedCB will be called when initialisation is complete
/// @param aUsedGroupsMask groups that are in use. Single devices should not be in any of these groups
virtual void initialize(CompletedCB aCompletedCB, uint16_t aUsedGroupsMask);
virtual void initialize(StatusCB aCompletedCB, uint16_t aUsedGroupsMask);
/// update parameters from device to local vars
void updateParams(CompletedCB aCompletedCB);
void updateParams(StatusCB aCompletedCB);
/// update status information from device
void updateStatus(CompletedCB aCompletedCB);
void updateStatus(StatusCB aCompletedCB);
/// convert dS brightness value to DALI arc power
......@@ -146,14 +146,14 @@ namespace p44 {
void queryGroup0to7Response(DaliGroupsCB aDaliGroupsCB, DaliAddress aShortAddress, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void queryGroup8to15Response(DaliGroupsCB aDaliGroupsCB, DaliAddress aShortAddress, uint16_t aGroupBitMask, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void groupMembershipResponse(CompletedCB aCompletedCB, uint16_t aUsedGroupsMask, DaliAddress aShortAddress, uint16_t aGroups, ErrorPtr aError);
void groupMembershipResponse(StatusCB aCompletedCB, uint16_t aUsedGroupsMask, DaliAddress aShortAddress, uint16_t aGroups, ErrorPtr aError);
void queryActualLevelResponse(CompletedCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void queryMinLevelResponse(CompletedCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void queryActualLevelResponse(StatusCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void queryMinLevelResponse(StatusCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void dimRepeater(DaliAddress aDaliAddress, uint8_t aCommand, MLMicroSeconds aCycleStartTime);
void queryStatusResponse(CompletedCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void queryStatusResponse(StatusCB aCompletedCB, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
};
......@@ -174,7 +174,7 @@ namespace p44 {
/// initialize device for first use
/// @param aCompletedCB will be called when initialisation is complete
/// @param aUsedGroupsMask groups that are in use. grouped devices should not be in any of these groups except their own group
virtual void initialize(CompletedCB aCompletedCB, uint16_t aUsedGroupsMask);
virtual void initialize(StatusCB aCompletedCB, uint16_t aUsedGroupsMask);
/// creates a dimmer group, addressed via a group address rather than single bus address
/// @note initially, the group is empty. addDaliBusDevice must be used to add devices
......@@ -204,8 +204,8 @@ namespace p44 {
private:
void initNextGroupMember(CompletedCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember);
void groupMembershipResponse(CompletedCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember, uint16_t aGroups, ErrorPtr aError);
void initNextGroupMember(StatusCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember);
void groupMembershipResponse(StatusCB aCompletedCB, DaliComm::ShortAddressList::iterator aNextMember, uint16_t aGroups, ErrorPtr aError);
};
......@@ -272,7 +272,7 @@ namespace p44 {
/// @param aFactoryReset if set, the device will be inititalized as thoroughly as possible (factory reset, default settings etc.)
/// @note this is called before interaction with dS system starts (usually just after collecting devices)
/// @note implementation should call inherited when complete, so superclasses could chain further activity
virtual void initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset);
virtual void initializeDevice(StatusCB aCompletedCB, bool aFactoryReset);
/// check presence of this addressable
/// @param aPresenceResultHandler will be called to report presence status
......@@ -293,7 +293,7 @@ namespace p44 {
/// @param aCompletedCB if not NULL, must be called when values are applied
/// @param aForDimming hint for implementations to optimize dimming, indicating that change is only an increment/decrement
/// in a single channel (and not switching between color modes etc.)
virtual void applyChannelValues(DoneCB aDoneCB, bool aForDimming);
virtual void applyChannelValues(SimpleCB aDoneCB, bool aForDimming);
/// start or stop dimming (optimized DALI version)
/// @param aChannel the channelType to start or stop dimming for
......@@ -344,7 +344,7 @@ namespace p44 {
private:
void brightnessDimmerSynced(CompletedCB aCompletedCB, bool aFactoryReset, ErrorPtr aError);
void brightnessDimmerSynced(StatusCB aCompletedCB, bool aFactoryReset, ErrorPtr aError);
void checkPresenceResponse(PresenceCB aPresenceResultHandler);
void disconnectableHandler(bool aForgetParams, DisconnectCB aDisconnectResultHandler, bool aPresent);
......@@ -397,7 +397,7 @@ namespace p44 {
/// @param aFactoryReset if set, the device will be inititalized as thoroughly as possible (factory reset, default settings etc.)
/// @note this is called before interaction with dS system starts (usually just after collecting devices)
/// @note implementation should call inherited when complete, so superclasses could chain further activity
virtual void initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset);
virtual void initializeDevice(StatusCB aCompletedCB, bool aFactoryReset);
/// add a dimmer
/// @param aDimmerBusDevice the DALI dimmer to add
......@@ -425,7 +425,7 @@ namespace p44 {
/// @param aCompletedCB if not NULL, must be called when values are applied
/// @param aForDimming hint for implementations to optimize dimming, indicating that change is only an increment/decrement
/// in a single channel (and not switching between color modes etc.)
virtual void applyChannelValues(DoneCB aDoneCB, bool aForDimming);
virtual void applyChannelValues(SimpleCB aDoneCB, bool aForDimming);
/// @}
......@@ -468,7 +468,7 @@ namespace p44 {
private:
void updateNextDimmer(CompletedCB aCompletedCB, bool aFactoryReset, DimmerIndex aDimmerIndex, ErrorPtr aError);
void updateNextDimmer(StatusCB aCompletedCB, bool aFactoryReset, DimmerIndex aDimmerIndex, ErrorPtr aError);
DaliBusDevicePtr firstBusDevice();
void checkPresenceResponse(PresenceCB aPresenceResultHandler, DaliBusDevicePtr aDimmer);
......
......@@ -89,7 +89,7 @@ string DaliPersistence::dbSchemaUpgradeSQL(int aFromVersion, int &aToVersion)
}
void DaliDeviceContainer::initialize(CompletedCB aCompletedCB, bool aFactoryReset)
void DaliDeviceContainer::initialize(StatusCB aCompletedCB, bool aFactoryReset)
{
string databaseName = getPersistentDataDir();
string_format_append(databaseName, "%s_%d.sqlite3", deviceClassIdentifier(), getInstanceNumber());
......@@ -110,7 +110,7 @@ int DaliDeviceContainer::getRescanModes() const
}
void DaliDeviceContainer::collectDevices(CompletedCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings)
void DaliDeviceContainer::collectDevices(StatusCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings)
{
if (!aIncremental) {
removeDevices(aClearSettings);
......@@ -120,7 +120,7 @@ void DaliDeviceContainer::collectDevices(CompletedCB aCompletedCB, bool aIncreme
}
void DaliDeviceContainer::deviceListReceived(CompletedCB aCompletedCB, DaliComm::ShortAddressListPtr aDeviceListPtr, ErrorPtr aError)
void DaliDeviceContainer::deviceListReceived(StatusCB aCompletedCB, DaliComm::ShortAddressListPtr aDeviceListPtr, ErrorPtr aError)
{
// check if any devices
if (aError || aDeviceListPtr->size()==0)
......@@ -142,7 +142,7 @@ void DaliDeviceContainer::deviceListReceived(CompletedCB aCompletedCB, DaliComm:
}
void DaliDeviceContainer::queryNextDev(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, CompletedCB aCompletedCB, ErrorPtr aError)
void DaliDeviceContainer::queryNextDev(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, StatusCB aCompletedCB, ErrorPtr aError)
{
if (Error::isOK(aError)) {
if (aNextDev != aBusDevices->end()) {
......@@ -235,7 +235,7 @@ void DaliDeviceContainer::queryNextDev(DaliBusDeviceListPtr aBusDevices, DaliBus
}
void DaliDeviceContainer::initializeNextDimmer(DaliBusDeviceListPtr aDimmerDevices, uint16_t aGroupsInUse, DaliBusDeviceList::iterator aNextDimmer, CompletedCB aCompletedCB, ErrorPtr aError)
void DaliDeviceContainer::initializeNextDimmer(DaliBusDeviceListPtr aDimmerDevices, uint16_t aGroupsInUse, DaliBusDeviceList::iterator aNextDimmer, StatusCB aCompletedCB, ErrorPtr aError)
{
if (!Error::isOK(aError)) {
LOG(LOG_ERR, "Error initializing dimmer: %s\n", aError->description().c_str());
......@@ -253,7 +253,7 @@ void DaliDeviceContainer::initializeNextDimmer(DaliBusDeviceListPtr aDimmerDevic
void DaliDeviceContainer::createDsDevices(DaliBusDeviceListPtr aDimmerDevices, CompletedCB aCompletedCB)
void DaliDeviceContainer::createDsDevices(DaliBusDeviceListPtr aDimmerDevices, StatusCB aCompletedCB)
{
// - look up multi-channel composite devices
// If none of the devices are found on the bus, the entire composite device is considered missing
......@@ -329,7 +329,7 @@ void DaliDeviceContainer::createDsDevices(DaliBusDeviceListPtr aDimmerDevices, C
}
void DaliDeviceContainer::deviceInfoReceived(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, CompletedCB aCompletedCB, DaliComm::DaliDeviceInfoPtr aDaliDeviceInfoPtr, ErrorPtr aError)
void DaliDeviceContainer::deviceInfoReceived(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, StatusCB aCompletedCB, DaliComm::DaliDeviceInfoPtr aDaliDeviceInfoPtr, ErrorPtr aError)
{
bool missingData = aError && aError->isError(DaliCommError::domain(), DaliCommErrorMissingData);
bool badData =
......@@ -454,7 +454,7 @@ ErrorPtr DaliDeviceContainer::handleMethod(VdcApiRequestPtr aRequest, const stri
(*pos)->hasVanished(false); // vanish, but keep settings
}
// - re-collect devices to find groups and composites now, but only after a second, starting from main loop, not from here
CompletedCB cb = boost::bind(&DaliDeviceContainer::groupCollected, this, aRequest);
StatusCB cb = boost::bind(&DaliDeviceContainer::groupCollected, this, aRequest);
MainLoop::currentMainLoop().executeOnce(boost::bind(&DaliDeviceContainer::collectDevices, this, cb, false, false, false), 1*Second);
}
}
......@@ -503,7 +503,7 @@ ErrorPtr DaliDeviceContainer::ungroupDevice(DaliDevicePtr aDevice, VdcApiRequest
// - delete the previously grouped dS device
aDevice->hasVanished(true); // delete parameters
// - re-collect devices to find groups and composites now, but only after a second, starting from main loop, not from here
CompletedCB cb = boost::bind(&DaliDeviceContainer::groupCollected, this, aRequest);
StatusCB cb = boost::bind(&DaliDeviceContainer::groupCollected, this, aRequest);
MainLoop::currentMainLoop().executeOnce(boost::bind(&DaliDeviceContainer::collectDevices, this, cb, false, false, false), 1*Second);
return respErr;
}
......@@ -521,14 +521,14 @@ void DaliDeviceContainer::groupCollected(VdcApiRequestPtr aRequest)
#pragma mark - Self test
void DaliDeviceContainer::selfTest(CompletedCB aCompletedCB)
void DaliDeviceContainer::selfTest(StatusCB aCompletedCB)
{
// do bus short address scan
daliComm->daliBusScan(boost::bind(&DaliDeviceContainer::testScanDone, this, aCompletedCB, _1, _2));
}
void DaliDeviceContainer::testScanDone(CompletedCB aCompletedCB, DaliComm::ShortAddressListPtr aShortAddressListPtr, ErrorPtr aError)
void DaliDeviceContainer::testScanDone(StatusCB aCompletedCB, DaliComm::ShortAddressListPtr aShortAddressListPtr, ErrorPtr aError)
{
if (Error::isOK(aError) && aShortAddressListPtr && aShortAddressListPtr->size()>0) {
// found at least one device, do a R/W test using the DTR
......@@ -546,7 +546,7 @@ void DaliDeviceContainer::testScanDone(CompletedCB aCompletedCB, DaliComm::Short
}
void DaliDeviceContainer::testRW(CompletedCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte)
void DaliDeviceContainer::testRW(StatusCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte)
{
// set DTR
daliComm->daliSend(DALICMD_SET_DTR, aTestByte);
......@@ -555,7 +555,7 @@ void DaliDeviceContainer::testRW(CompletedCB aCompletedCB, DaliAddress aShortAdd
}
void DaliDeviceContainer::testRWResponse(CompletedCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
void DaliDeviceContainer::testRWResponse(StatusCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError)
{
if (Error::isOK(aError) && !aNoOrTimeout && aResponse==aTestByte) {
LOG(LOG_NOTICE," - sent 0x%02X, received 0x%02X\n",aTestByte, aResponse, aNoOrTimeout);
......
......@@ -59,7 +59,7 @@ namespace p44 {
public:
DaliDeviceContainer(int aInstanceNumber, DeviceContainer *aDeviceContainerP, int aTag);
void initialize(CompletedCB aCompletedCB, bool aFactoryReset);
void initialize(StatusCB aCompletedCB, bool aFactoryReset);
// the DALI communication object
DaliCommPtr daliComm;
......@@ -68,14 +68,14 @@ namespace p44 {
/// perform self test
/// @param aCompletedCB will be called when self test is done, returning ok or error
virtual void selfTest(CompletedCB aCompletedCB);
virtual void selfTest(StatusCB aCompletedCB);
/// get supported rescan modes for this device class
/// @return a combination of rescanmode_xxx bits
virtual int getRescanModes() const;
/// collect and add devices to the container
virtual void collectDevices(CompletedCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings);
virtual void collectDevices(StatusCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings);
/// vdc level methods (p44 specific, JSON only, for configuring multichannel RGB(W) devices)
virtual ErrorPtr handleMethod(VdcApiRequestPtr aRequest, const string &aMethod, ApiValuePtr aParams);
......@@ -100,16 +100,16 @@ namespace p44 {
private:
void deviceListReceived(CompletedCB aCompletedCB, DaliComm::ShortAddressListPtr aDeviceListPtr, ErrorPtr aError);
void queryNextDev(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, CompletedCB aCompletedCB, ErrorPtr aError);
void initializeNextDimmer(DaliBusDeviceListPtr aDimmerDevices, uint16_t aGroupsInUse, DaliBusDeviceList::iterator aNextDimmer, CompletedCB aCompletedCB, ErrorPtr aError);
void createDsDevices(DaliBusDeviceListPtr aDimmerDevices, CompletedCB aCompletedCB);
void deviceInfoReceived(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, CompletedCB aCompletedCB, DaliComm::DaliDeviceInfoPtr aDaliDeviceInfoPtr, ErrorPtr aError);
void deviceListReceived(StatusCB aCompletedCB, DaliComm::ShortAddressListPtr aDeviceListPtr, ErrorPtr aError);
void queryNextDev(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, StatusCB aCompletedCB, ErrorPtr aError);
void initializeNextDimmer(DaliBusDeviceListPtr aDimmerDevices, uint16_t aGroupsInUse, DaliBusDeviceList::iterator aNextDimmer, StatusCB aCompletedCB, ErrorPtr aError);
void createDsDevices(DaliBusDeviceListPtr aDimmerDevices, StatusCB aCompletedCB);
void deviceInfoReceived(DaliBusDeviceListPtr aBusDevices, DaliBusDeviceList::iterator aNextDev, StatusCB aCompletedCB, DaliComm::DaliDeviceInfoPtr aDaliDeviceInfoPtr, ErrorPtr aError);
void groupCollected(VdcApiRequestPtr aRequest);
void testScanDone(CompletedCB aCompletedCB, DaliComm::ShortAddressListPtr aShortAddressListPtr, ErrorPtr aError);
void testRW(CompletedCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte);
void testRWResponse(CompletedCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
void testScanDone(StatusCB aCompletedCB, DaliComm::ShortAddressListPtr aShortAddressListPtr, ErrorPtr aError);
void testRW(StatusCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte);
void testRWResponse(StatusCB aCompletedCB, DaliAddress aShortAddr, uint8_t aTestByte, bool aNoOrTimeout, uint8_t aResponse, ErrorPtr aError);
};
......
......@@ -49,7 +49,7 @@ DemoDevice::DemoDevice(DemoDeviceContainer *aClassContainerP) :
void DemoDevice::applyChannelValues(DoneCB aDoneCB, bool aForDimming)
void DemoDevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming)
{
// light device
LightBehaviourPtr lightBehaviour = boost::dynamic_pointer_cast<LightBehaviour>(output);
......
......@@ -60,7 +60,7 @@ namespace p44 {
/// @param aCompletedCB if not NULL, must be called when values are applied
/// @param aForDimming hint for implementations to optimize dimming, indicating that change is only an increment/decrement
/// in a single channel (and not switching between color modes etc.)
virtual void applyChannelValues(DoneCB aDoneCB, bool aForDimming);
virtual void applyChannelValues(SimpleCB aDoneCB, bool aForDimming);
/// @}
......
......@@ -40,7 +40,7 @@ const char *DemoDeviceContainer::deviceClassIdentifier() const
/// collect devices from this device class
void DemoDeviceContainer::collectDevices(CompletedCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings)
void DemoDeviceContainer::collectDevices(StatusCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings)
{
// incrementally collecting Demo devices makes no sense, they are statically created at startup
if (!aIncremental) {
......
......@@ -41,7 +41,7 @@ namespace p44 {
virtual const char *deviceClassIdentifier() const;
virtual void collectDevices(CompletedCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings);
virtual void collectDevices(StatusCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings);
/// @return human readable, language independent suffix to explain vdc functionality.
/// Will be appended to product name to create modelName() for vdcs
......
......@@ -236,7 +236,7 @@ void EnoceanDevice::sendOutgoingUpdate()
}
void EnoceanDevice::applyChannelValues(DoneCB aDoneCB, bool aForDimming)
void EnoceanDevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming)
{
// trigger updating all device outputs
for (int i=0; i<numChannels(); i++) {
......
......@@ -179,7 +179,7 @@ namespace p44 {
/// @param aDoneCB if not NULL, must be called when values are applied
/// @param aForDimming hint for implementations to optimize dimming, indicating that change is only an increment/decrement
/// in a single channel (and not switching between color modes etc.)
virtual void applyChannelValues(DoneCB aDoneCB, bool aForDimming);
virtual void applyChannelValues(SimpleCB aDoneCB, bool aForDimming);
/// factory: create appropriate logical devices for a given EEP
/// @param aClassContainerP the EnoceanDeviceContainer to create the devices in
......
......@@ -106,7 +106,7 @@ string EnoceanPersistence::dbSchemaUpgradeSQL(int aFromVersion, int &aToVersion)
}
void EnoceanDeviceContainer::initialize(CompletedCB aCompletedCB, bool aFactoryReset)
void EnoceanDeviceContainer::initialize(StatusCB aCompletedCB, bool aFactoryReset)
{
string databaseName = getPersistentDataDir();
string_format_append(databaseName, "%s_%d.sqlite3", deviceClassIdentifier(), getInstanceNumber());
......@@ -127,7 +127,7 @@ void EnoceanDeviceContainer::removeDevices(bool aForget)
void EnoceanDeviceContainer::collectDevices(CompletedCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings)
void EnoceanDeviceContainer::collectDevices(StatusCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings)
{
// install standard packet handler
enoceanComm.setRadioPacketHandler(boost::bind(&EnoceanDeviceContainer::handleRadioPacket, this, _1, _2));
......@@ -315,7 +315,7 @@ void EnoceanDeviceContainer::setLearnMode(bool aEnableLearning, bool aDisablePro
#pragma mark - Self test
void EnoceanDeviceContainer::selfTest(CompletedCB aCompletedCB)
void EnoceanDeviceContainer::selfTest(StatusCB aCompletedCB)
{
// install test packet handler
enoceanComm.setRadioPacketHandler(boost::bind(&EnoceanDeviceContainer::handleTestRadioPacket, this, aCompletedCB, _1, _2));
......@@ -324,7 +324,7 @@ void EnoceanDeviceContainer::selfTest(CompletedCB aCompletedCB)
}
void EnoceanDeviceContainer::handleTestRadioPacket(CompletedCB aCompletedCB, Esp3PacketPtr aEsp3PacketPtr, ErrorPtr aError)
void EnoceanDeviceContainer::handleTestRadioPacket(StatusCB aCompletedCB, Esp3PacketPtr aEsp3PacketPtr, ErrorPtr aError)
{
// ignore packets with error
if (Error::isOK(aError)) {
......
......@@ -96,7 +96,7 @@ namespace p44 {
EnoceanDeviceContainer(int aInstanceNumber, DeviceContainer *aDeviceContainerP, int aTag);
void initialize(CompletedCB aCompletedCB, bool aFactoryReset);
void initialize(StatusCB aCompletedCB, bool aFactoryReset);
// the Enocean communication object
EnoceanComm enoceanComm;
......@@ -105,10 +105,10 @@ namespace p44 {
/// perform self test
/// @param aCompletedCB will be called when self test is done, returning ok or error
virtual void selfTest(CompletedCB aCompletedCB);
virtual void selfTest(StatusCB aCompletedCB);
/// collect and add devices to the container
virtual void collectDevices(CompletedCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings);
virtual void collectDevices(StatusCB aCompletedCB, bool aIncremental, bool aExhaustive, bool aClearSettings);
/// @param aForget if set, all parameters stored for the device (if any) will be deleted. Note however that
/// the devices are not disconnected (=unlearned) by this.
......@@ -161,7 +161,7 @@ namespace p44 {
private:
void handleRadioPacket(Esp3PacketPtr aEsp3PacketPtr, ErrorPtr aError);
void handleTestRadioPacket(CompletedCB aCompletedCB, Esp3PacketPtr aEsp3PacketPtr, ErrorPtr aError);
void handleTestRadioPacket(StatusCB aCompletedCB, Esp3PacketPtr aEsp3PacketPtr, ErrorPtr aError);
};
......
......@@ -126,7 +126,7 @@ void HueDevice::setName(const string &aName)
void HueDevice::initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset)
void HueDevice::initializeDevice(StatusCB aCompletedCB, bool aFactoryReset)
{
// query light attributes and state
string url = string_format("/lights/%s", lightID.c_str());
......@@ -135,7 +135,7 @@ void HueDevice::initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset)
// TODO: once hue bridge 1.3 is common, this information could be read from the collection result
void HueDevice::deviceStateReceived(CompletedCB aCompletedCB, bool aFactoryReset, JsonObjectPtr aDeviceInfo, ErrorPtr aError)
void HueDevice::deviceStateReceived(StatusCB aCompletedCB, bool aFactoryReset, JsonObjectPtr aDeviceInfo, ErrorPtr aError)
{
if (Error::isOK(aError) && aDeviceInfo) {
JsonObjectPtr o;
......@@ -246,7 +246,7 @@ void HueDevice::disconnectableHandler(bool aForgetParams, DisconnectCB aDisconne
void HueDevice::applyChannelValues(DoneCB aDoneCB, bool aForDimming)
void HueDevice::applyChannelValues(SimpleCB aDoneCB, bool aForDimming)
{
// Update of light state needed
LightBehaviourPtr l = boost::dynamic_pointer_cast<LightBehaviour>(output);
......@@ -357,7 +357,7 @@ void HueDevice::applyChannelValues(DoneCB aDoneCB, bool aForDimming)
void HueDevice::channelValuesSent(LightBehaviourPtr aLightBehaviour, DoneCB aDoneCB, JsonObjectPtr aResult, ErrorPtr aError)
void HueDevice::channelValuesSent(LightBehaviourPtr aLightBehaviour, SimpleCB aDoneCB, JsonObjectPtr aResult, ErrorPtr aError)
{
// synchronize actual channel values as hue delivers them back
if (aResult) {
......@@ -408,7 +408,7 @@ void HueDevice::channelValuesSent(LightBehaviourPtr aLightBehaviour, DoneCB aDon
void HueDevice::syncChannelValues(DoneCB aDoneCB)
void HueDevice::syncChannelValues(SimpleCB aDoneCB)
{
// query light attributes and state
string url = string_format("/lights/%s", lightID.c_str());
......@@ -417,7 +417,7 @@ void HueDevice::syncChannelValues(DoneCB aDoneCB)
void HueDevice::channelValuesReceived(DoneCB aDoneCB, JsonObjectPtr aDeviceInfo, ErrorPtr aError)
void HueDevice::channelValuesReceived(SimpleCB aDoneCB, JsonObjectPtr aDeviceInfo, ErrorPtr aError)
{
if (Error::isOK(aError)) {
// assign the channel values
......
......@@ -50,7 +50,7 @@ namespace p44 {
string hueModel;
// applyChannel repetition management
CompletedCB pendingApplyCB;
StatusCB pendingApplyCB;
bool applyInProgress;
bool repeatApplyAtEnd;
......@@ -81,7 +81,7 @@ namespace p44 {
/// @param aFactoryReset if set, the device will be inititalized as thoroughly as possible (factory reset, default settings etc.)
/// @note this is called before interaction with dS system starts (usually just after collecting devices)
/// @note implementation should call inherited when complete, so superclasses could chain further activity
virtual void initializeDevice(CompletedCB aCompletedCB, bool aFactoryReset);
virtual void initializeDevice(StatusCB aCompletedCB, bool aFactoryReset);
/// check presence of this addressable
/// @param aPresenceResultHandler will be called to report presence status
......@@ -102,14 +102,14 @@ namespace p44 {
/// @note this is the only routine that should trigger actual changes in output values. It must consult all of the device's
/// ChannelBehaviours and check isChannelUpdatePending(), and send new values to the device hardware. After successfully
/// updating the device hardware, channelValueApplied() must be called on the channels that had isChannelUpdatePending().
virtual void applyChannelValues(DoneCB aDoneCB, bool aForDimming);
virtual void applyChannelValues(SimpleCB aDoneCB, bool aForDimming);
/// synchronize channel values by reading them back from the device's hardware (if possible)
/// @param aDoneCB will be called when values are updated with actual hardware values
/// @note this method is only called at startup and before saving scenes to make sure changes done to the outputs directly (e.g. using
/// a direct remote control for a lamp) are included. Just reading a channel state does not call this method.
/// @note implementation must use channel's syncChannelValue() method
virtual void syncChannelValues(DoneCB aDoneCB);
virtual void syncChannelValues(SimpleCB aDoneCB);
/// @}
......@@ -144,11 +144,11 @@ namespace p44 {
private:
void deviceStateReceived(CompletedCB aCompletedCB, bool aFactoryReset, JsonObjectPtr aDeviceInfo, ErrorPtr aError);
void deviceStateReceived(StatusCB aCompletedCB, bool aFactoryReset, JsonObjectPtr aDeviceInfo, ErrorPtr aError);
void presenceStateReceived(PresenceCB aPresenceResultHandler, JsonObjectPtr aDeviceInfo, ErrorPtr aError);
void disconnectableHandler(bool aForgetParams, DisconnectCB aDisconnectResultHandler, bool aPresent);
void channelValuesSent(LightBehaviourPtr aColorLightBehaviour, DoneCB aDoneCB, JsonObjectPtr aResult, ErrorPtr aError);
void channelValuesReceived(DoneCB aDoneCB, JsonObjectPtr aDeviceInfo, ErrorPtr aError);
void channelValuesSent(LightBehaviourPtr aColorLightBehaviour, SimpleCB aDoneCB, JsonObjectPtr aResult, ErrorPtr aError);
void channelValuesReceived(SimpleCB aDoneCB, JsonObjectPtr aDeviceInfo, ErrorPtr aError);
};
......
......@@ -82,7 +82,7 @@ string HuePersistence::dbSchemaUpgradeSQL(int aFromVersion, int &aToVersion)
}
void HueDeviceContainer::initialize(CompletedCB aCompletedCB, bool aFactoryReset)
void HueDeviceContainer::initialize(StatusCB aCompletedCB, bool aFactoryReset)
{
string databaseName = getPersistentDataDir();
string_format_append(databaseName, "%s_%d.sqlite3", deviceClassIdentifier(), getInstanceNumber());
......@@ -102,7 +102,7 @@ int HueDeviceContainer::getRescanModes() const
}