Skip to content
Snippets Groups Projects
Commit 0657bfa1 authored by ziemke's avatar ziemke
Browse files

Task #2926: Removed print statements. Code cleanup.

parent 96854618
No related branches found
No related tags found
No related merge requests found
......@@ -611,24 +611,19 @@ bool WinCCManager::set_datapoint_validity(const std::string &name, bool validity
}
// get VariableType from DpIdentifier
// assign values
VariableType dpId_VariableType;
DpElementType dpId_ElementType;
DpIdentification temp_dpId; // make a temp dpId to use the 'getElementType' method
DpIdentificationResult dir = temp_dpId.getElementType(dpId, dpId_ElementType);
VariableType dpId_VariableType;
std::cout << "Garbage dpIdVarType is " << dpId_VariableType << '\n';
VariableType value_VariableType;
std::cout << "Garbage valueVarType is " << value_VariableType << '\n';
// check that the dpIdResult is OK
if(DpIdentificationResult::DpIdentOK == dir) {
std::cout << "IdResult is OK\n";
dpId_VariableType = DpElement::getVariableType(dpId_ElementType);
std::cout << "(unassigned) DpVariableType is " << DpElement::getVariableType(dpId_ElementType)<< '\n';
value_VariableType = value->isA();
}
else {
std::cout << "DpIdentification.getElementType() failed\n";
return false;
}
......@@ -636,41 +631,18 @@ bool WinCCManager::set_datapoint_validity(const std::string &name, bool validity
// if not, convert value to the appropriate datapoint type
if (value->isA() != dpId_VariableType){
std::cout << "Given value VariableType does not match dpId VariableType. Converting...\n";
std::cout << "value VariableType is " << value_VariableType << '\n';
std::cout << "dpId VariableType is " << dpId_VariableType << '\n';
// TODO: Fix this...
VariablePtr converted_var = NULL;
//Variable::ConvertResult cr = convert(value, value->getValue(), converted_var);
std::cout << "value isA before: " << value->isA() << '\n';
Variable::ConvertResult cr = value->convert(dpId_VariableType, converted_var);
std::cout << "value isA after: " << value->isA() << '\n';
// if conversion succeeds, send the converted var
if(Variable::ConvertResult::OK == cr) {
std::cout << "Given value has been successfully converted\n";
DrvManager *drvman = DrvManager::getSelfPtr();
drvman ->sendVCMsg(dpId, converted_var!=NULL ? *converted_var : *last_known_value, now, infoBits);
delete converted_var; //delete it, since it was a newly created variable in var->convert
}
// 'Out of range' error in converting
else if(Variable::ConvertResult::OUT_OF_RANGE == cr) {
std::cout << "Given value was not successfully converted (OOR)\n";
delete converted_var; //delete it, since it was a newly created variable in var->convert
return false;
}
// 'Conversion not defined' error in converting
else if(Variable::ConvertResult::CONV_NOT_DEFINED == cr) {
// NOTE: This is what is failing in all cases.
std::cout << "Given value was not successfully converted\n";
std::cout << "Conv not def for val-type " << value->isA() << " and dp-type " << dpId_VariableType << "\n";
delete converted_var; //delete it, since it was a newly created variable in var->convert
return false;
}
// Unknown error in converting (should never occur).
// Either 'out_of_bounds' error or 'conv_not_defined' error in converting
else {
std::cout << "Given value was not successfully converted (UNKNOWN)\n";
delete converted_var; //delete it, since it was a newly created variable in var->convert
return false;
}
......@@ -678,7 +650,6 @@ bool WinCCManager::set_datapoint_validity(const std::string &name, bool validity
// no need for conversion
else {
std::cout << "Given value VariableType matches dpId VariableType\n";
DrvManager *drvman = DrvManager::getSelfPtr();
drvman ->sendVCMsg(dpId, value!=NULL ? *value : *last_known_value, now, infoBits);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment