Android-cuttlefish cvd tool
stk_service.h
Go to the documentation of this file.
1//
2// Copyright (C) 2020 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#pragma once
17
20
21namespace cuttlefish {
22
23class StkService : public ModemService, public std::enable_shared_from_this<StkService> {
24 public:
25 StkService(int32_t service_id, ChannelMonitor* channel_monitor,
26 ThreadLooper* thread_looper);
27 ~StkService() = default;
28
29 StkService(const StkService &) = delete;
30 StkService &operator=(const StkService &) = delete;
31
32 void SetupDependency(SimService* sim);
33
34 void HandleReportStkServiceIsRunning(const Client& client);
35 void HandleSendEnvelope(const Client& client, std::string& command);
36 void HandleSendTerminalResponseToSim(const Client& client, std::string& command);
37
38 private:
39 std::vector<CommandHandler> InitializeCommandHandlers();
40
42
43 // For now, only support DISPLAY_TEXT, SELECT_ITEM and SETUP_MENU
46 GET_INKEY = 0x22,
47 GET_INPUT = 0x23,
49 PLAY_TONE = 0x20,
50 REFRESH = 0x01,
52 SEND_SS = 0x11,
53 SEND_USSD = 0x12,
54 SEND_SMS = 0x13,
55 RUN_AT = 0x34,
56 SEND_DTMF = 0x14,
66 SEND_DATA = 0x43,
68 };
69
70 std::vector<std::string> current_select_item_menu_ids_;
71
72 XMLElement* GetCurrentSelectItem();
73 void OnUnsolicitedCommandForTR(std::string& command);
74};
75
76} // namespace cuttlefish
Definition: channel_monitor.h:35
Definition: client.h:47
Definition: modem_service.h:63
Definition: sim_service.h:28
Definition: stk_service.h:23
void HandleSendTerminalResponseToSim(const Client &client, std::string &command)
Definition: stk_service.cpp:170
StkService(const StkService &)=delete
CommandType
Definition: stk_service.h:44
@ PLAY_TONE
Definition: stk_service.h:49
@ SEND_DATA
Definition: stk_service.h:66
@ LAUNCH_BROWSER
Definition: stk_service.h:48
@ RUN_AT
Definition: stk_service.h:55
@ LANGUAGE_NOTIFICATION
Definition: stk_service.h:62
@ SET_UP_MENU
Definition: stk_service.h:59
@ SET_UP_CALL
Definition: stk_service.h:60
@ GET_CHANNEL_STATUS
Definition: stk_service.h:67
@ SEND_SMS
Definition: stk_service.h:54
@ SELECT_ITEM
Definition: stk_service.h:51
@ SET_UP_IDLE_MODE_TEXT
Definition: stk_service.h:58
@ GET_INKEY
Definition: stk_service.h:46
@ OPEN_CHANNEL
Definition: stk_service.h:63
@ CLOSE_CHANNEL
Definition: stk_service.h:64
@ RECEIVE_DATA
Definition: stk_service.h:65
@ DISPLAY_TEXT
Definition: stk_service.h:45
@ PROVIDE_LOCAL_INFORMATION
Definition: stk_service.h:61
@ SEND_SS
Definition: stk_service.h:52
@ SEND_USSD
Definition: stk_service.h:53
@ SET_UP_EVENT_LIST
Definition: stk_service.h:57
@ GET_INPUT
Definition: stk_service.h:47
@ SEND_DTMF
Definition: stk_service.h:56
@ REFRESH
Definition: stk_service.h:50
StkService & operator=(const StkService &)=delete
void SetupDependency(SimService *sim)
Definition: stk_service.cpp:44
void HandleReportStkServiceIsRunning(const Client &client)
Definition: stk_service.cpp:65
void HandleSendEnvelope(const Client &client, std::string &command)
Definition: stk_service.cpp:106
void OnUnsolicitedCommandForTR(std::string &command)
Definition: stk_service.cpp:226
SimService * sim_service_
Definition: stk_service.h:41
std::vector< std::string > current_select_item_menu_ids_
Definition: stk_service.h:70
StkService(int32_t service_id, ChannelMonitor *channel_monitor, ThreadLooper *thread_looper)
Definition: stk_service.cpp:21
XMLElement * GetCurrentSelectItem()
Definition: stk_service.cpp:177
std::vector< CommandHandler > InitializeCommandHandlers()
Definition: stk_service.cpp:26
Definition: thread_looper.h:51
Definition: alloc_utils.cpp:23