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 DataService : public ModemService, public std::enable_shared_from_this<DataService> { 23 public: 24 DataService(int32_t service_id, ChannelMonitor* channel_monitor, 25 ThreadLooper* thread_looper); 26 ~DataService() = default; 27 28 DataService(const DataService &) = delete; 29 DataService &operator=(const DataService &) = delete; 30 31 void HandleActivateDataCall(const Client& client, const std::string& command); 32 void HandleQueryDataCallList(const Client& client); 33 void HandlePDPContext(const Client& client, const std::string& command); 34 void HandleQueryPDPContextList(const Client& client); 35 void HandleEnterDataState(const Client& client, const std::string& command); 36 void HandleReadDynamicParam(const Client& client, const std::string& command); 37 38 void onUpdatePhysicalChannelconfigs(int modem_tech, int freq, 39 int cellBandwidthDownlink); 40 41 private: 42 std::vector<CommandHandler> InitializeCommandHandlers(); 43 void InitializeServiceState(); 44 void sendOnePhysChanCfgUpdate(int status, int bandwidth, int rat, int freq, 45 int id); 46 void updatePhysicalChannelconfigs(int modem_tech, int freq, 47 int cellBandwidthDownlink, int count); 48 49 struct PDPContext { 50 enum CidState {ACTIVE, NO_ACTIVE}; 51 52 int cid; 53 CidState state; 54 std::string conn_types; 55 std::string apn; 56 std::string addresses; 57 std::string dnses; 58 std::string gateways; 59 }; 60 std::vector<PDPContext> pdp_context_; 61 }; 62 63 } // namespace cuttlefish 64