Home | History | Annotate | Download | only in update_manager
      1 //
      2 // Copyright (C) 2014 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 UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
     18 #define UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
     19 
     20 #include <base/time/time.h>
     21 
     22 #include "update_engine/update_manager/provider.h"
     23 #include "update_engine/update_manager/variable.h"
     24 
     25 namespace chromeos_update_manager {
     26 
     27 enum class ConnectionType {
     28   kEthernet,
     29   kWifi,
     30   kWimax,
     31   kBluetooth,
     32   kCellular,
     33   kUnknown
     34 };
     35 
     36 enum class ConnectionTethering {
     37   kNotDetected,
     38   kSuspected,
     39   kConfirmed,
     40   kUnknown,
     41 };
     42 
     43 // Provider for networking related information.
     44 class ShillProvider : public Provider {
     45  public:
     46   ~ShillProvider() override {}
     47 
     48   // A variable returning whether we currently have network connectivity.
     49   virtual Variable<bool>* var_is_connected() = 0;
     50 
     51   // A variable returning the current network connection type. Unknown if not
     52   // connected.
     53   virtual Variable<ConnectionType>* var_conn_type() = 0;
     54 
     55   // A variable returning the tethering mode of a network connection. Unknown if
     56   // not connected.
     57   virtual Variable<ConnectionTethering>* var_conn_tethering() = 0;
     58 
     59   // A variable returning the time when network connection last changed.
     60   // Initialized to current time.
     61   virtual Variable<base::Time>* var_conn_last_changed() = 0;
     62 
     63  protected:
     64   ShillProvider() {}
     65 
     66  private:
     67   DISALLOW_COPY_AND_ASSIGN(ShillProvider);
     68 };
     69 
     70 }  // namespace chromeos_update_manager
     71 
     72 #endif  // UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
     73