blob: baaa9db0ad8b37fa92d4a3f7442cd43301e05fc2 [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"
25
26namespace chromeos_update_engine {
27
28// A WeaveServiceInterface instance allows to register the daemon with weaved,
29// handle commands and update the weave status. This class only handles the
30// registration with weaved and the connection, the actual work to handle the
31// commands is implemented by the DelegateInterface, which will be called from
32// this class.
33class WeaveServiceInterface {
34 public:
35 // The delegate class that actually handles the command execution from
36 class DelegateInterface {
37 public:
38 virtual ~DelegateInterface() = default;
39
40 virtual bool OnCheckForUpdates(brillo::ErrorPtr* error) = 0;
41
42 virtual bool OnTrackChannel(const std::string& channel,
43 brillo::ErrorPtr* error) = 0;
44
45 // Return the current status.
46 virtual bool GetWeaveState(int64_t* last_checked_time,
47 double* progress,
48 update_engine::UpdateStatus* update_status,
49 std::string* current_channel,
50 std::string* tracking_channel) = 0;
51 };
52
53 virtual ~WeaveServiceInterface() = default;
54
55 // Force a weave state update.
56 virtual void UpdateWeaveState() = 0;
57
58 protected:
59 WeaveServiceInterface() = default;
60};
61
62} // namespace chromeos_update_engine
63
64#endif // UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_