blob: b40f2552bbd12fce7237ad6834756b804ebeb012 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
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//
Gilad Arnold55f39b72014-01-28 12:51:45 -080016
Gilad Arnold48415f12014-06-27 07:10:58 -070017#ifndef UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
18#define UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_
Gilad Arnold55f39b72014-01-28 12:51:45 -080019
Alex Vakulenko75039d72014-03-25 12:36:28 -070020#include <base/time/time.h>
Gilad Arnold55f39b72014-01-28 12:51:45 -080021
Alex Deymo63784a52014-05-28 10:46:14 -070022#include "update_engine/update_manager/provider.h"
23#include "update_engine/update_manager/variable.h"
Gilad Arnold55f39b72014-01-28 12:51:45 -080024
Alex Deymo63784a52014-05-28 10:46:14 -070025namespace chromeos_update_manager {
Gilad Arnold55f39b72014-01-28 12:51:45 -080026
Gilad Arnoldaf309d52014-03-13 11:21:55 -070027enum class ConnectionType {
28 kEthernet,
29 kWifi,
30 kWimax,
31 kBluetooth,
32 kCellular,
33 kUnknown
Gilad Arnold55f39b72014-01-28 12:51:45 -080034};
35
Gilad Arnoldef120fa2014-04-09 12:52:10 -070036enum class ConnectionTethering {
37 kNotDetected,
38 kSuspected,
39 kConfirmed,
40 kUnknown,
41};
42
Gilad Arnold55f39b72014-01-28 12:51:45 -080043// Provider for networking related information.
44class ShillProvider : public Provider {
45 public:
Alex Deymo610277e2014-11-11 21:18:11 -080046 ~ShillProvider() override {}
David Zeuthen21716e22014-04-23 15:42:05 -070047
Gilad Arnoldef120fa2014-04-09 12:52:10 -070048 // A variable returning whether we currently have network connectivity.
Gilad Arnolddf3dd242014-04-09 07:15:51 -070049 virtual Variable<bool>* var_is_connected() = 0;
Gilad Arnold55f39b72014-01-28 12:51:45 -080050
Gilad Arnoldef120fa2014-04-09 12:52:10 -070051 // A variable returning the current network connection type. Unknown if not
52 // connected.
Gilad Arnolddf3dd242014-04-09 07:15:51 -070053 virtual Variable<ConnectionType>* var_conn_type() = 0;
Gilad Arnold55f39b72014-01-28 12:51:45 -080054
Gilad Arnoldef120fa2014-04-09 12:52:10 -070055 // A variable returning the tethering mode of a network connection. Unknown if
56 // not connected.
57 virtual Variable<ConnectionTethering>* var_conn_tethering() = 0;
58
Alex Vakulenko072359c2014-07-18 11:41:07 -070059 // A variable returning the time when network connection last changed.
Gilad Arnoldef120fa2014-04-09 12:52:10 -070060 // Initialized to current time.
Gilad Arnolddf3dd242014-04-09 07:15:51 -070061 virtual Variable<base::Time>* var_conn_last_changed() = 0;
Gilad Arnold55f39b72014-01-28 12:51:45 -080062
63 protected:
64 ShillProvider() {}
David Zeuthen21716e22014-04-23 15:42:05 -070065
66 private:
67 DISALLOW_COPY_AND_ASSIGN(ShillProvider);
Gilad Arnold55f39b72014-01-28 12:51:45 -080068};
69
Alex Deymo63784a52014-05-28 10:46:14 -070070} // namespace chromeos_update_manager
Gilad Arnold55f39b72014-01-28 12:51:45 -080071
Gilad Arnold48415f12014-06-27 07:10:58 -070072#endif // UPDATE_ENGINE_UPDATE_MANAGER_SHILL_PROVIDER_H_