Diag-Client-Lib
dm_conversation_state_impl.cpp
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
9 
10 namespace diag {
11 namespace client {
12 namespace conversation_state_impl {
14  : conversation_state_{std::make_unique<StateContext<ConversationState>>()} {
15  // create and add state
16  // kIdle
18  // kDiagWaitForRes
20  std::make_unique<kDiagWaitForRes>(ConversationState::kDiagWaitForRes));
21  // kDiagStartP2StarTimer
22  GetConversationStateContext().AddState(
24  std::make_unique<kDiagStartP2StarTimer>(ConversationState::kDiagStartP2StarTimer));
25  // kDiagRecvdPendingRes
26  GetConversationStateContext().AddState(
28  std::make_unique<kDiagRecvdPendingRes>(ConversationState::kDiagRecvdPendingRes));
29  // kDiagRecvdFinalRes
31  std::make_unique<kDiagRecvdFinalRes>(ConversationState::kDiagRecvdFinalRes));
32  // kDiagSuccess
34  std::make_unique<kDiagSuccess>(ConversationState::kDiagSuccess));
35  // transit to idle state
37 }
38 
40  return *conversation_state_;
41 }
42 
44 
45 void kIdle::Start() {}
46 
47 void kIdle::Stop() {}
48 
50 
52 
54 
56 
58 
60 
62 
64 
66 
68 
70 
72 
74 
76 
78 
80 
82 
84 
86 
88 
90 } // namespace conversation_state_impl
91 } // namespace client
92 } // namespace diag
auto GetConversationStateContext() noexcept -> StateContext< ConversationState > &
std::unique_ptr< StateContext< ConversationState > > conversation_state_