Alex Deymo | f7ead81 | 2015-10-23 17:37:27 -0700 | [diff] [blame] | 1 | // |
| 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 Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame^] | 25 | #include "update_engine/service_observer_interface.h" |
Alex Deymo | f7ead81 | 2015-10-23 17:37:27 -0700 | [diff] [blame] | 26 | |
| 27 | namespace 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 Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame^] | 34 | class WeaveServiceInterface : public ServiceObserverInterface { |
Alex Deymo | f7ead81 | 2015-10-23 17:37:27 -0700 | [diff] [blame] | 35 | 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 Deymo | f7ead81 | 2015-10-23 17:37:27 -0700 | [diff] [blame] | 56 | protected: |
| 57 | WeaveServiceInterface() = default; |
| 58 | }; |
| 59 | |
| 60 | } // namespace chromeos_update_engine |
| 61 | |
| 62 | #endif // UPDATE_ENGINE_WEAVE_SERVICE_INTERFACE_H_ |