Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DBUS_SERVICE_H__ |
| 6 | #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DBUS_SERVICE_H__ |
| 7 | |
| 8 | #include <inttypes.h> |
| 9 | #include <dbus/dbus-glib.h> |
| 10 | #include <dbus/dbus-glib-bindings.h> |
| 11 | #include <dbus/dbus-glib-lowlevel.h> |
| 12 | #include <glib-object.h> |
| 13 | |
| 14 | #include "update_engine/update_attempter.h" |
| 15 | |
| 16 | // Type macros: |
| 17 | #define UPDATE_ENGINE_TYPE_SERVICE (update_engine_service_get_type()) |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 18 | #define UPDATE_ENGINE_SERVICE(obj) \ |
| 19 | (G_TYPE_CHECK_INSTANCE_CAST((obj), UPDATE_ENGINE_TYPE_SERVICE, \ |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 20 | UpdateEngineService)) |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 21 | #define UPDATE_ENGINE_IS_SERVICE(obj) \ |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 22 | (G_TYPE_CHECK_INSTANCE_TYPE((obj), UPDATE_ENGINE_TYPE_SERVICE)) |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 23 | #define UPDATE_ENGINE_SERVICE_CLASS(klass) \ |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 24 | (G_TYPE_CHECK_CLASS_CAST((klass), UPDATE_ENGINE_TYPE_SERVICE, \ |
| 25 | UpdateEngineService)) |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 26 | #define UPDATE_ENGINE_IS_SERVICE_CLASS(klass) \ |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 27 | (G_TYPE_CHECK_CLASS_TYPE((klass), UPDATE_ENGINE_TYPE_SERVICE)) |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 28 | #define UPDATE_ENGINE_SERVICE_GET_CLASS(obj) \ |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 29 | (G_TYPE_INSTANCE_GET_CLASS((obj), UPDATE_ENGINE_TYPE_SERVICE, \ |
| 30 | UpdateEngineService)) |
| 31 | |
| 32 | G_BEGIN_DECLS |
| 33 | |
| 34 | struct UpdateEngineService { |
| 35 | GObject parent_instance; |
| 36 | |
| 37 | chromeos_update_engine::UpdateAttempter* update_attempter_; |
| 38 | }; |
| 39 | |
| 40 | struct UpdateEngineServiceClass { |
| 41 | GObjectClass parent_class; |
| 42 | }; |
| 43 | |
| 44 | UpdateEngineService* update_engine_service_new(void); |
| 45 | GType update_engine_service_get_type(void); |
| 46 | |
| 47 | // Methods |
| 48 | |
Darin Petkov | 296889c | 2010-07-23 16:20:54 -0700 | [diff] [blame] | 49 | gboolean update_engine_service_attempt_update(UpdateEngineService* self, |
| 50 | gchar* app_version, |
| 51 | gchar* omaha_url, |
| 52 | GError **error); |
| 53 | |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 54 | gboolean update_engine_service_get_status(UpdateEngineService* self, |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 55 | int64_t* last_checked_time, |
| 56 | double* progress, |
| 57 | gchar** current_operation, |
| 58 | gchar** new_version, |
| 59 | int64_t* new_size, |
| 60 | GError **error); |
| 61 | |
Darin Petkov | 296889c | 2010-07-23 16:20:54 -0700 | [diff] [blame] | 62 | gboolean update_engine_service_reboot_if_needed(UpdateEngineService* self, |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 63 | GError **error); |
| 64 | |
Darin Petkov | 8daa324 | 2010-10-25 13:28:47 -0700 | [diff] [blame^] | 65 | gboolean update_engine_service_set_track(UpdateEngineService* self, |
| 66 | gchar* track, |
| 67 | GError **error); |
| 68 | |
Andrew de los Reyes | 63b96d7 | 2010-05-10 13:08:54 -0700 | [diff] [blame] | 69 | gboolean update_engine_service_emit_status_update( |
| 70 | UpdateEngineService* self, |
| 71 | gint64 last_checked_time, |
| 72 | gdouble progress, |
| 73 | const gchar* current_operation, |
| 74 | const gchar* new_version, |
| 75 | gint64 new_size); |
Andrew de los Reyes | 4e9b9f4 | 2010-04-26 15:06:43 -0700 | [diff] [blame] | 76 | |
| 77 | G_END_DECLS |
| 78 | |
| 79 | #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DBUS_SERVICE_H__ |