Android-cuttlefish cvd tool
sms_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
21
22namespace cuttlefish {
23
24class SmsService : public ModemService , public std::enable_shared_from_this<SmsService> {
25 public:
26 SmsService(int32_t service_id, ChannelMonitor* channel_monitor,
27 ThreadLooper* thread_looper);
28 ~SmsService() = default;
29
30 SmsService(const SmsService &) = delete;
31 SmsService &operator=(const SmsService &) = delete;
32
33 void SetupDependency(SimService* sim);
34
35 void HandleSendSMS(const Client& client, std::string& command);
36 void HandleSendSMSPDU(const Client& client, std::string& command);
37 void HandleSMSAcknowledge(const Client& client, std::string& command);
38 void HandleWriteSMSToSim(const Client& client, std::string& command);
39 void HandleDeleteSmsOnSim(const Client& client, std::string& command);
40 void HandleBroadcastConfig(const Client& client, std::string& command);
41 void HandleGetSmscAddress(const Client& client);
42 void HandleSetSmscAddress(const Client& client, std::string& command);
43 void HandleWriteSMSPduToSim(const Client& client, std::string& command);
44 void HandleReceiveRemoteSMS(const Client& client, std::string& command);
45
48
49 private:
51 std::vector<CommandHandler> InitializeCommandHandlers();
52
53 void HandleReceiveSMS(PDUParser sms_pdu);
54 void HandleSMSStatuReport(PDUParser sms_pdu, int message_reference);
55 void SendSmsToRemote(std::string remote_port, PDUParser& sms_pdu);
56
58
59 struct SmsMessage {
60 enum SmsStatus { kUnread = 0, kRead = 1, kUnsent = 2, kSent = 3 };
61
62 std::string message;
64 };
65
67 int mode;
68 std::string mids;
69 std::string dcss;
70 };
71
73 std::string sca;
74 int tosca;
75 };
76
82
85
86 std::map<int, SmsMessage> messages_on_sim_card_;
87};
88
89} // namespace cuttlefish
Definition: channel_monitor.h:35
Definition: client.h:47
Definition: modem_service.h:63
Definition: pdu_parser.h:22
Definition: sim_service.h:28
Definition: sms_service.h:24
void HandleSendSMSPDU(const Client &client, std::string &command)
Definition: sms_service.cpp:269
bool is_waiting_sms_to_sim_
Definition: sms_service.h:78
std::vector< CommandHandler > InitializeCommandHandlers()
Definition: sms_service.cpp:31
void HandleGetSmscAddress(const Client &client)
Definition: sms_service.cpp:232
SmsService & operator=(const SmsService &)=delete
bool IsWaitingSmsPdu()
Definition: sms_service.h:46
SmsServiceCenterAddress sms_service_center_address_
Definition: sms_service.h:84
bool IsWaitingSmsToSim()
Definition: sms_service.h:47
void HandleReceiveSMS(PDUParser sms_pdu)
Definition: sms_service.cpp:331
void HandleSMSAcknowledge(const Client &client, std::string &command)
Definition: sms_service.cpp:118
void HandleWriteSMSToSim(const Client &client, std::string &command)
Definition: sms_service.cpp:141
void SetupDependency(SimService *sim)
Definition: sms_service.cpp:77
std::map< int, SmsMessage > messages_on_sim_card_
Definition: sms_service.h:86
void HandleReceiveRemoteSMS(const Client &client, std::string &command)
Definition: sms_service.cpp:372
BroadcastConfig broadcast_config_
Definition: sms_service.h:83
void HandleSendSMS(const Client &client, std::string &command)
Definition: sms_service.cpp:93
SmsService(int32_t service_id, ChannelMonitor *channel_monitor, ThreadLooper *thread_looper)
Definition: sms_service.cpp:24
int message_id_
Definition: sms_service.h:79
void HandleWriteSMSPduToSim(const Client &client, std::string &command)
Definition: sms_service.cpp:340
void SendSmsToRemote(std::string remote_port, PDUParser &sms_pdu)
Definition: sms_service.cpp:253
void HandleDeleteSmsOnSim(const Client &client, std::string &command)
Definition: sms_service.cpp:163
void HandleSMSStatuReport(PDUParser sms_pdu, int message_reference)
Definition: sms_service.cpp:358
bool is_waiting_sms_pdu_
Definition: sms_service.h:77
void HandleSetSmscAddress(const Client &client, std::string &command)
Definition: sms_service.cpp:243
SimService * sim_service_
Definition: sms_service.h:57
void InitializeServiceState()
Definition: sms_service.cpp:68
SmsMessage::SmsStatus sms_status_on_sim_
Definition: sms_service.h:81
SmsService(const SmsService &)=delete
void HandleBroadcastConfig(const Client &client, std::string &command)
Definition: sms_service.cpp:198
int message_reference_
Definition: sms_service.h:80
Definition: thread_looper.h:51
Definition: alloc_utils.cpp:23
Definition: sms_service.h:66
std::string dcss
Definition: sms_service.h:69
int mode
Definition: sms_service.h:67
std::string mids
Definition: sms_service.h:68
Definition: sms_service.h:59
SmsStatus
Definition: sms_service.h:60
@ kRead
Definition: sms_service.h:60
@ kSent
Definition: sms_service.h:60
@ kUnsent
Definition: sms_service.h:60
@ kUnread
Definition: sms_service.h:60
std::string message
Definition: sms_service.h:62
SmsStatus status
Definition: sms_service.h:63
std::string sca
Definition: sms_service.h:73
int tosca
Definition: sms_service.h:74