| | |
| | | } |
| | | m_mapRecipes = m_mapRecipesTemp; |
| | | m_mapRecipesTemp.clear(); |
| | | m_nSyncStatus = SS_COMPLETE; |
| | | m_nSyncStatus = SS_LIST_COMPLETE; |
| | | unlock(); |
| | | |
| | | if (m_onSyncingStateChanged != nullptr) { |
| | |
| | | |
| | | |
| | | |
| | | // 找到对应CRecipeList, 找不到则新建 |
| | | /* |
| | | // 找到对应CRecipeList, 找不到则返回NG |
| | | lock(); |
| | | CRecipeList* pRecipeList = getRecipeListFromTemp(unitNo); |
| | | CRecipeList* pRecipeList = getRecipeList(unitNo); |
| | | if (pRecipeList == nullptr) { |
| | | pRecipeList = new CRecipeList(unitNo); |
| | | m_mapRecipesTemp[unitNo] = pRecipeList; |
| | | unlock(); |
| | | return MRLRC_NG; |
| | | } |
| | | unlock(); |
| | | ASSERT(pRecipeList); |
| | | */ |
| | | |
| | | /* |
| | | 1: Create |
| | |
| | | 3: Delete |
| | | 4: Request from EAS |
| | | */ |
| | | /* |
| | | if (reportType == RT_CREATE) { |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | else if (reportType == RT_REQUEST_FROM_EAS) { |
| | | int nRet = pRecipeList->addRecipePacket(toatlGroupCount, currentGroupCount, pszIdsData, 250 * 2); |
| | | int nRet = pRecipeList->addParamsPacket(totalParameterCount, toatlGroupCount, currentGroupCount, |
| | | unitNo, localRecipeId, |
| | | pszParameterData, 250 * 2); |
| | | if (MRLRC_CURRENT_RECIPE_COMPLETE == nRet) { |
| | | lock(); |
| | | if (m_nTotalMasterRecipeCount == m_mapRecipesTemp.size()) { |
| | | for (auto item : m_mapRecipes) { |
| | | delete item.second; |
| | | } |
| | | m_mapRecipes = m_mapRecipesTemp; |
| | | m_mapRecipesTemp.clear(); |
| | | m_nSyncStatus = SS_COMPLETE; |
| | | unlock(); |
| | | return MRLRC_OK; |
| | | } |
| | | m_nSyncStatus = SS_PARAMS_COMPLETE; |
| | | unlock(); |
| | | |
| | | if (m_onSyncingStateChanged != nullptr) { |
| | | m_onSyncingStateChanged(m_nSyncStatus); |
| | | } |
| | | |
| | | return MRLRC_OK; |
| | | } |
| | | else if (MRLRC_CONTINUE == nRet) { |
| | | return MRLRC_CONTINUE; |
| | | } |
| | | |
| | | return nRet; |
| | | } |
| | | */ |
| | | |
| | | |
| | | return MRLRC_OK; |
| | | } |
| | |
| | | return iter->second; |
| | | } |
| | | |
| | | bool CRecipesManager::saveRecipeList(int unitNo, std::string& strFilepath) |
| | | { |
| | | CRecipeList* pRecipeList = getRecipeList(unitNo); |
| | | if (pRecipeList == nullptr) return false; |
| | | return pRecipeList->serialize(strFilepath); |
| | | } |
| | | |
| | | bool CRecipesManager::readRecipeList(int unitNo, std::string& strFilepath) |
| | | { |
| | | CRecipeList* pRecipeList = getRecipeList(unitNo); |
| | | if (pRecipeList == nullptr) { |
| | | pRecipeList = new CRecipeList(); |
| | | m_mapRecipes[unitNo] = pRecipeList; |
| | | } |
| | | return pRecipeList->deserialize(strFilepath); |
| | | } |
| | | |
| | | void CRecipesManager::setOnSyncingStateChanged(ONSYNCINGSTATECHANGED block) |
| | | { |
| | | m_onSyncingStateChanged = block; |