1// 2// Copyright (C) 2012 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 17#ifndef SHILL_CELLULAR_MM1_MODEM_PROXY_INTERFACE_H_ 18#define SHILL_CELLULAR_MM1_MODEM_PROXY_INTERFACE_H_ 19 20#include <string> 21#include <vector> 22 23#include "shill/callbacks.h" 24 25namespace shill { 26class Error; 27 28namespace mm1 { 29 30typedef base::Callback<void(int32_t, 31 int32_t, uint32_t)> ModemStateChangedSignalCallback; 32 33// These are the methods that a org.freedesktop.ModemManager1.Modem 34// proxy must support. The interface is provided so that it can be 35// mocked in tests. All calls are made asynchronously. Call completion 36// is signalled via the callbacks passed to the methods. 37class ModemProxyInterface { 38 public: 39 virtual ~ModemProxyInterface() {} 40 41 virtual void Enable(bool enable, 42 Error* error, 43 const ResultCallback& callback, 44 int timeout) = 0; 45 virtual void CreateBearer(const KeyValueStore& properties, 46 Error* error, 47 const RpcIdentifierCallback& callback, 48 int timeout) = 0; 49 virtual void DeleteBearer(const std::string& bearer, 50 Error* error, 51 const ResultCallback& callback, 52 int timeout) = 0; 53 virtual void Reset(Error* error, 54 const ResultCallback& callback, 55 int timeout) = 0; 56 virtual void FactoryReset(const std::string& code, 57 Error* error, 58 const ResultCallback& callback, 59 int timeout) = 0; 60 virtual void SetCurrentCapabilities(uint32_t capabilities, 61 Error* error, 62 const ResultCallback& callback, 63 int timeout) = 0; 64 virtual void SetCurrentModes(uint32_t allowed_modes, 65 uint32_t preferred_mode, 66 Error* error, 67 const ResultCallback& callback, 68 int timeout) = 0; 69 virtual void SetCurrentBands(const std::vector<uint32_t>& bands, 70 Error* error, 71 const ResultCallback& callback, 72 int timeout) = 0; 73 virtual void Command(const std::string& cmd, 74 uint32_t user_timeout, 75 Error* error, 76 const StringCallback& callback, 77 int timeout) = 0; 78 virtual void SetPowerState(uint32_t power_state, 79 Error* error, 80 const ResultCallback& callback, 81 int timeout) = 0; 82 83 84 virtual void set_state_changed_callback( 85 const ModemStateChangedSignalCallback& callback) = 0; 86}; 87 88} // namespace mm1 89} // namespace shill 90 91#endif // SHILL_CELLULAR_MM1_MODEM_PROXY_INTERFACE_H_ 92