diff --git a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp index f6bee6e..f0e53a4 100644 --- a/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp +++ b/trunk/ConsoleDataMigration/ConsoleRestore/Controller.cpp @@ -109,6 +109,7 @@ typedef enum RestoreState DELETE_ACCOUNT, // ショップアカウントを削除する DELETE_ACCOUNT_DONE, // ショップアカウント削除完了 SYNC_TICKET, // eTicketを同期する + UPLOAD_IVS, // IVSを送信する READ_FILELIST, // ファイル一覧の読み込み RESTORE_TWL_NAND, // TWL NANDの書き込み中 RESTORE_TWL_SOUND, // TWLサウンドの書き込み中 @@ -505,6 +506,77 @@ void ShopOperationSingleTemplate( } } +void UpdateOperation(::std::vector& message, RestoreState nextState) +{ + // ACアダプタが必要か? + if (NeedsAcAdater()) + { + message.push_back(::std::string("Connect AC Adapter!!")); + } + + // アップデートを行う + if (!s_ExecuteFgNup) + { + if (ImportCountryLanguageData().IsSuccess()) + { + StartFGNetworkUpdate(); + s_ExecuteFgNup = true; + } + else + { + s_RestoreState = FAIL; + } + } + + // 動いていることを表示 + { + PutAliveMessage(message, "Updating"); + } + + if (IsNetworkUpdateFinished()) + { + FinishFGNetworkUpdate(); + // エラーがあったら表示する + if (GetUpdateResult().IsFailure()) + { + // APが見つからない + if (GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint()) + { + COMMON_LOGGER("No Access Point Found!"); + } + } + + if (GetUpdateResult().IsSuccess()) + { + COMMON_LOGGER("Network Update Finished.\n"); + if(nextState == UPDATE_DONE) + { + // アップデート完了ファイルを作成 + CreateUpdateFinishedFile(); + } + + s_RestoreState = nextState; + } + else + { + if (s_FgNupRetryCount++ < RETRY_MAX) + { + // エラーのためやり直す + COMMON_LOGGER_RESULT_IF_FAILED(GetUpdateResult()); + COMMON_LOGGER("Network Update Failed. Retrying... %d\n", s_FgNupRetryCount); + + // FGNUP用のスレッドを作るとこからやり直し + s_ExecuteFgNup = false; + } + else + { + s_RestoreState = FAIL; + } + } + + } +} + bool CheckAndReadAPSetting(::std::vector& operationMessage) { using namespace common; @@ -718,71 +790,7 @@ void ControlState(::std::vector& operationMessage, bool& nextStep) // アップデート中 case UPDATE_IN_PROGRESS: { - // ACアダプタが必要か? - if (NeedsAcAdater()) - { - operationMessage.push_back(::std::string("Connect AC Adapter!!")); - } - - // アップデートを行う - if (!s_ExecuteFgNup) - { - if (ImportCountryLanguageData().IsSuccess()) - { - StartFGNetworkUpdate(); - s_ExecuteFgNup = true; - } - else - { - s_RestoreState = FAIL; - } - } - - // 動いていることを表示 - { - PutAliveMessage(operationMessage, "Updating"); - } - - if (IsNetworkUpdateFinished()) - { - FinishFGNetworkUpdate(); - // エラーがあったら表示する - if (GetUpdateResult().IsFailure()) - { - // APが見つからない - if (GetUpdateResult() == nn::ac::ResultNotFoundAccessPoint()) - { - COMMON_LOGGER("No Access Point Found!"); - } - } - - if (GetUpdateResult().IsSuccess()) - { - COMMON_LOGGER("Network Update Finished.\n"); - // アップデート完了ファイルを作成 - CreateUpdateFinishedFile(); - - s_RestoreState = UPDATE_DONE; - - } - else - { - if (s_FgNupRetryCount++ < RETRY_MAX) - { - // エラーのためやり直す - COMMON_LOGGER_RESULT_IF_FAILED(GetUpdateResult()); - COMMON_LOGGER("Network Update Failed. Retrying... %d\n", s_FgNupRetryCount); - - // FGNUP用のスレッドを作るとこからやり直し - s_ExecuteFgNup = false; - } - else - { - s_RestoreState = FAIL; - } - } - - } + UpdateOperation(operationMessage, UPDATE_DONE); } break; @@ -1042,7 +1050,14 @@ void ControlState(::std::vector& operationMessage, bool& nextStep) case SYNC_TICKET: { ShopOperationSingleTemplate(operationMessage, SHOP_OPERATION_CONNECT_ONLY, "Shop Connect", - "Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", DOWNLOAD_TWL); + "Shop Connect Finished.\n", "Shop Connect Failed. Retrying...", UPLOAD_IVS); + } + break; + + // NUPすることでIVSが送信される + case UPLOAD_IVS: + { + UpdateOperation(operationMessage, DOWNLOAD_TWL); } break;