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 18 #include "host/commands/modem_simulator/modem_service.h" 19 20 namespace cuttlefish { 21 22 class SupService : public ModemService, public std::enable_shared_from_this<SupService> { 23 public: 24 SupService(int32_t service_id, ChannelMonitor* channel_monitor, 25 ThreadLooper* thread_looper); 26 ~SupService() = default; 27 28 SupService(const SupService &) = delete; 29 SupService &operator=(const SupService &) = delete; 30 31 void HandleUSSD(const Client& client, std::string& command); 32 void HandleCLIR(const Client& client, std::string& command); 33 void HandleCallWaiting(const Client& client, std::string& command); 34 void HandleCLIP(const Client& client); 35 void HandleCallForward(const Client& client, std::string& command); 36 void HandleSuppServiceNotifications(const Client& client, std::string& command); 37 38 private: 39 std::vector<CommandHandler> InitializeCommandHandlers(); 40 void InitializeServiceState(); 41 42 struct ClirStatusInfo { 43 enum ClirType { 44 DEFAULT = 0, // "use subscription default value" 45 CLIR_INVOCATION = 1, // restrict CLI presentation 46 CLIR_SUPPRESSION = 2, // allow CLI presentation 47 }; 48 49 enum ClirStatus { 50 CLIR_NOT_PROVISIONED = 0, 51 CLIR_PROVISIONED = 1, 52 UNKNOWN = 2, 53 CLIR_PRESENTATION_RESTRICTED = 3, 54 CLIR_PRESENTATION_ALLOWED = 4, 55 }; 56 57 ClirType type; 58 ClirStatus status; 59 }; 60 ClirStatusInfo clir_status_; 61 62 struct CallForwardInfo { 63 enum CallForwardInfoStatus { 64 DISABLE = 0, 65 ENABLE = 1, 66 INTERROGATE = 2, 67 REGISTRATION = 3, 68 ERASURE = 4, 69 }; 70 71 enum Reason { 72 CFU = 0, // communication forwarding unconditional 73 CFB = 1, //communication forwarding on busy user 74 CFNR = 2, // communication forwarding on no reply 75 CFNRC = 3, // communication forwarding on subscriber not reachable 76 ALL_CF = 4, // all call forwarding 77 ALL_CONDITIONAL_CF = 5, //all conditional call forwarding 78 CD = 6, // communication deflection 79 CFNL = 7, // communication forwarding on not logged-in 80 }; 81 82 CallForwardInfoStatus status; 83 Reason reason; 84 int number_type; // From 27.007 +CCFC/+CLCK "class" 85 int ton; // "type" from TS 27.007 7.11 86 std::string number; // "number" from TS 27.007 7.11. May be NULL 87 int timeSeconds; // for CF no reply only 88 CallForwardInfoCallForwardInfo89 CallForwardInfo(Reason reason) : 90 status(DISABLE), reason(reason), number_type(2), ton(129), number(""), 91 timeSeconds(0){}; 92 }; 93 std::vector<CallForwardInfo> call_forward_infos_; 94 95 struct CallWaitingInfo { 96 int presentation_status; // sets / shows the result code presentation status to the TE, 97 // 0: disable; 1: enable 98 int mode; // 0: disable; 1: enable; 2: query status 99 int classx; // a sum of integers each representing a class of information 100 // default 7-voice, data and fax, see FacilityLock::Class 101 CallWaitingInfoCallWaitingInfo102 CallWaitingInfo() : 103 presentation_status(1), mode(0), classx(7) {}; 104 }; 105 CallWaitingInfo call_waiting_info_; 106 }; 107 108 } // namespace cuttlefish 109