blob: a7e603e47b587c0efbad62cd4b5fc0031598fb56 [file] [log] [blame]
Alex Deymof7ead812015-10-23 17:37:27 -07001//
2// Copyright (C) 2015 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_WEAVE_SERVICE_INTERFACE_H_
18#define UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_
19
20#include <string>
21
22#include <brillo/errors/error.h>
23
24#include "update_engine/client_library/include/update_engine/update_status.h"
Alex Deymofa78f142016-01-26 21:36:16 -080025#include "update_engine/service_observer_interface.h"
Alex Deymof7ead812015-10-23 17:37:27 -070026
27namespace chromeos_update_engine {
28
29// A WeaveServiceInterface instance allows to register the daemon with weaved,
30// handle commands and update the weave status. This class only handles the
31// registration with weaved and the connection, the actual work to handle the
32// commands is implemented by the DelegateInterface, which will be called from
33// this class.
Alex Deymofa78f142016-01-26 21:36:16 -080034class WeaveServiceInterface : public ServiceObserverInterface {
Alex Deymof7ead812015-10-23 17:37:27 -070035 public:
36 // The delegate class that actually handles the command execution from
37 class DelegateInterface {
38 public:
39 virtual ~DelegateInterface() = default;
40
41 virtual bool OnCheckForUpdates(brillo::ErrorPtr* error) = 0;
42
43 virtual bool OnTrackChannel(const std::string& channel,
44 brillo::ErrorPtr* error) = 0;
45
46 // Return the current status.
47 virtual bool GetWeaveState(int64_t* last_checked_time,
48 double* progress,
49 update_engine::UpdateStatus* update_status,
50 std::string* current_channel,
51 std::string* tracking_channel) = 0;
52 };
53
54 virtual ~WeaveServiceInterface() = default;
55
Alex Deymof7ead812015-10-23 17:37:27 -070056 protected:
57 WeaveServiceInterface() = default;
58};
59
60} // namespace chromeos_update_engine
61
62#endif // UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_