本文整理汇总了C++中CContainer::UpdateLiquidTankInserted方法的典型用法代码示例。如果您正苦于以下问题:C++ CContainer::UpdateLiquidTankInserted方法的具体用法?C++ CContainer::UpdateLiquidTankInserted怎么用?C++ CContainer::UpdateLiquidTankInserted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContainer
的用法示例。
在下文中一共展示了CContainer::UpdateLiquidTankInserted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLiquidTanksWeightAckResponse
void CContainer::GetLiquidTanksWeightAckResponse(int TransactionId, PVOID Data, unsigned DataLength, TGenericCockie Cockie)
{
TOCBLiquidTanksWeightResponse *StatusMsg = static_cast<TOCBLiquidTanksWeightResponse *>(Data);
// Get a pointer to the instance
CContainer *InstancePtr = reinterpret_cast<CContainer *>(Cockie);
//Verify size of message
if(DataLength != sizeof(TOCBLiquidTanksWeightResponse))
{
CQLog::Write(LOG_TAG_EOL, "Container \"GetLiquidTanksWeightAckResponse\" length error");
return;
}
if(static_cast<int>(StatusMsg->MessageID) != OCB_LIQUID_TANK_WEIGHT)
{
FrontEndInterface->NotificationMessage("Container \"GetLiquidTanksWeightAckResponse\" message id error");
CQLog::Write(LOG_TAG_EOL, "Container \"GetLiquidTanksWeightAckResponse\" message id error (0x%X)", (int)StatusMsg->MessageID);
return;
}
float Weights[TOTAL_NUMBER_OF_CONTAINERS_INCLUDING_WASTE] =
INIT_MSG_VALUES_W_ARRAY(StatusMsg, Weight);
// Updating the Weights of the liquid tanks
for(int i = FIRST_TANK_INCLUDING_WASTE_TYPE; i < LAST_TANK_INCLUDING_WASTE_TYPE; i++)
InstancePtr->m_TanksArray[i]->SetTankWeight(Weights[i]);
// Write the new weights the Log only if one of the 'Printed' weights is different atleast in 40 gr
bool NeedToWriteWeightsToLog = false;
for(int i = FIRST_TANK_INCLUDING_WASTE_TYPE; i < TOTAL_NUMBER_OF_CONTAINERS; i++)
{
if(InstancePtr->m_TanksArray[i]->IsPrintWeightNecessary())
NeedToWriteWeightsToLog = true;
}
int WeightArray[TOTAL_NUMBER_OF_CONTAINERS_INCLUDING_WASTE];
QString tmp = "Liquids weight: ";
for(int i = FIRST_TANK_INCLUDING_WASTE_TYPE; i < LAST_TANK_INCLUDING_WASTE_TYPE; i++)
{
WeightArray[i] = InstancePtr->GetTankWeightInGram((TTankIndex)i);
tmp += TankToStr((TTankIndex)i) + " = " + QFloatToStr(WeightArray[i]) + "; ";
}
InstancePtr->UpdateLiquidTankInserted(TYPE_TANK_WASTE, (InstancePtr->m_TanksArray[TYPE_TANK_WASTE]->GetTankWeightInGram(true) > WASTE_IS_EMPTY));
if(NeedToWriteWeightsToLog)
CQLog::Write(LOG_TAG_EOL, tmp);
for(int i = FIRST_TANK_TYPE; i < LAST_TANK_TYPE; i++)
{
// Update the front end with the status of the containers
FrontEndInterface->UpdateStatus(FE_CURRENT_TANK_STATUS_BASE + i,
(int)(WeightArray[i] > (InstancePtr->m_ParamsMgr->WeightLevelLimitArray[TankToStaticChamber((TTankIndex)i)]
+ WEIGHT_ERROR_WARNNING_DELTA)));
WeightArray[i] -= InstancePtr->m_ParamsMgr->WeightLevelLimitArray[TankToStaticChamber((TTankIndex)i)];
// Update the front end with the current weight
FrontEndInterface->UpdateStatus(FE_CURRENT_TANK_WEIGHT_BASE + i,
((WeightArray[i] > 0) && (! InstancePtr->IsTankInOverconsumption((TTankIndex)i))) ? WeightArray[i] : 0);
// Update the front end with the relative weight
FrontEndInterface->UpdateStatus(FE_CURRENT_TANK_RELATIVE_WEIGHT_BASE + i,
WeightArray[i] * 100 /
InstancePtr->m_ParamsMgr->CartridgeFullWeight);
}
// Update the front end with the status of the containers
FrontEndInterface->UpdateStatus(FE_CURRENT_TANK_STATUS_WASTE_TANK,
(int)(WeightArray[TYPE_TANK_WASTE] < (InstancePtr->m_ParamsMgr->WeightLevelLimitArray[TYPE_CHAMBER_WASTE]
- WASTE_WEIGHT_ERROR_WARNNING_DELTA)));
FrontEndInterface->UpdateStatus(FE_TANK_EXISTENCE_STATUS_WASTE_TANK, (int)(InstancePtr->IsActiveLiquidTankInserted((int)TYPE_CHAMBER_WASTE)));
// Update the front end with the current weight
FrontEndInterface->UpdateStatus(FE_CURRENT_TANK_WEIGHT_WASTE_TANK, WeightArray[TYPE_TANK_WASTE] > 0 ? WeightArray[TYPE_TANK_WASTE] : 0);
// Display a service alert in case the waste cartride is full
if(WeightArray[TYPE_TANK_WASTE] > (InstancePtr->m_ParamsMgr->WeightLevelLimitArray[TYPE_CHAMBER_WASTE] - WASTE_WEIGHT_ERROR_WARNNING_DELTA))
{
if(!InstancePtr->m_WasteAlert)
{
FrontEndInterface->UpdateStatus(FE_SERVICE_ALERT, WASTE_CARTRIDGE_ALERT_ID, true);
InstancePtr->m_WasteAlert = true;
InstancePtr->m_WasteIsFull = true;
}
}
else
{
if(InstancePtr->m_WasteAlert)
{
FrontEndInterface->UpdateStatus(FE_CLEAR_SERVICE_ALERT, 0, true);
InstancePtr->m_WasteAlert = false;
InstancePtr->m_WasteIsFull = false;
}
}
}//GetLiquidTanksWeightAckResponse