some refactoring
This commit is contained in:
parent
cd71a9cc12
commit
b71ccf8dd8
@ -101,9 +101,31 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case(ReportingType::UPDATE_HK): {
|
case(ReportingType::UPDATE_HK): {
|
||||||
|
handleHkUpdate(receiver, status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(ReportingType::UPDATE_NOTIFICATION): {
|
||||||
|
handleNotificationUpdate(receiver, status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case(ReportingType::UPDATE_SNAPSHOT): {
|
||||||
|
handleNotificationSnapshot(receiver, status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// This should never happen.
|
||||||
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resetHkUpdateResetHelper();
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver,
|
||||||
|
ReturnValue_t& status) {
|
||||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
// Update packets shall only be generated from datasets.
|
// Update packets shall only be generated from datasets.
|
||||||
continue;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
||||||
receiver.dataId.sid);
|
receiver.dataId.sid);
|
||||||
@ -117,15 +139,17 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
}
|
}
|
||||||
handleChangeResetLogic(receiver.dataType, receiver.dataId,
|
handleChangeResetLogic(receiver.dataType, receiver.dataId,
|
||||||
dataSet);
|
dataSet);
|
||||||
break;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
case(ReportingType::UPDATE_NOTIFICATION): {
|
|
||||||
|
ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(
|
||||||
|
HkReceiver& receiver, ReturnValue_t& status) {
|
||||||
MarkChangedIF* toReset = nullptr;
|
MarkChangedIF* toReset = nullptr;
|
||||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
|
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
|
||||||
receiver.dataId.localPoolId);
|
receiver.dataId.localPoolId);
|
||||||
if(poolObj == nullptr) {
|
if(poolObj == nullptr) {
|
||||||
continue;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if(poolObj->hasChanged()) {
|
if(poolObj->hasChanged()) {
|
||||||
// prepare and send update notification.
|
// prepare and send update notification.
|
||||||
@ -145,7 +169,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
||||||
receiver.dataId.sid);
|
receiver.dataId.sid);
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
continue;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if(dataSet->hasChanged()) {
|
if(dataSet->hasChanged()) {
|
||||||
// prepare and send update notification
|
// prepare and send update notification
|
||||||
@ -164,16 +188,18 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
handleChangeResetLogic(receiver.dataType,
|
handleChangeResetLogic(receiver.dataType,
|
||||||
receiver.dataId, toReset);
|
receiver.dataId, toReset);
|
||||||
}
|
}
|
||||||
break;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
case(ReportingType::UPDATE_SNAPSHOT): {
|
|
||||||
|
ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
||||||
|
HkReceiver& receiver, ReturnValue_t& status) {
|
||||||
MarkChangedIF* toReset = nullptr;
|
MarkChangedIF* toReset = nullptr;
|
||||||
// check whether data has changed and send messages in case it has.
|
// check whether data has changed and send messages in case it has.
|
||||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||||
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
|
LocalPoolObjectBase* poolObj = owner->getPoolObjectHandle(
|
||||||
receiver.dataId.localPoolId);
|
receiver.dataId.localPoolId);
|
||||||
if(poolObj == nullptr) {
|
if(poolObj == nullptr) {
|
||||||
continue;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if(poolObj->hasChanged()) {
|
if(poolObj->hasChanged()) {
|
||||||
// prepare and send update snapshot.
|
// prepare and send update snapshot.
|
||||||
@ -194,7 +220,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(
|
||||||
receiver.dataId.sid);
|
receiver.dataId.sid);
|
||||||
if(dataSet == nullptr) {
|
if(dataSet == nullptr) {
|
||||||
continue;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if(dataSet->hasChanged()) {
|
if(dataSet->hasChanged()) {
|
||||||
// prepare and send update snapshot.
|
// prepare and send update snapshot.
|
||||||
@ -215,15 +241,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
|||||||
handleChangeResetLogic(receiver.dataType,
|
handleChangeResetLogic(receiver.dataType,
|
||||||
receiver.dataId, toReset);
|
receiver.dataId, toReset);
|
||||||
}
|
}
|
||||||
break;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
|
||||||
default:
|
|
||||||
// This should never happen.
|
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resetHkUpdateResetHelper();
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalDataPoolManager::handleChangeResetLogic(
|
void LocalDataPoolManager::handleChangeResetLogic(
|
||||||
|
@ -350,6 +350,13 @@ private:
|
|||||||
void handleChangeResetLogic(DataType type,
|
void handleChangeResetLogic(DataType type,
|
||||||
DataId dataId, MarkChangedIF* toReset);
|
DataId dataId, MarkChangedIF* toReset);
|
||||||
void resetHkUpdateResetHelper();
|
void resetHkUpdateResetHelper();
|
||||||
|
|
||||||
|
ReturnValue_t handleHkUpdate(HkReceiver& hkReceiver,
|
||||||
|
ReturnValue_t& status);
|
||||||
|
ReturnValue_t handleNotificationUpdate(HkReceiver& hkReceiver,
|
||||||
|
ReturnValue_t& status);
|
||||||
|
ReturnValue_t handleNotificationSnapshot(HkReceiver& hkReceiver,
|
||||||
|
ReturnValue_t& status);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user