blob: 40cb987ec0c91412d92a558b2bbca9b7e80694b6 [file] [log] [blame]
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -07001// 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 Reyes63b96d72010-05-10 13:08:54 -070018#define UPDATE_ENGINE_SERVICE(obj) \
19 (G_TYPE_CHECK_INSTANCE_CAST((obj), UPDATE_ENGINE_TYPE_SERVICE, \
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -070020 UpdateEngineService))
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070021#define UPDATE_ENGINE_IS_SERVICE(obj) \
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -070022 (G_TYPE_CHECK_INSTANCE_TYPE((obj), UPDATE_ENGINE_TYPE_SERVICE))
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070023#define UPDATE_ENGINE_SERVICE_CLASS(klass) \
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -070024 (G_TYPE_CHECK_CLASS_CAST((klass), UPDATE_ENGINE_TYPE_SERVICE, \
25 UpdateEngineService))
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070026#define UPDATE_ENGINE_IS_SERVICE_CLASS(klass) \
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -070027 (G_TYPE_CHECK_CLASS_TYPE((klass), UPDATE_ENGINE_TYPE_SERVICE))
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070028#define UPDATE_ENGINE_SERVICE_GET_CLASS(obj) \
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -070029 (G_TYPE_INSTANCE_GET_CLASS((obj), UPDATE_ENGINE_TYPE_SERVICE, \
30 UpdateEngineService))
31
32G_BEGIN_DECLS
33
34struct UpdateEngineService {
35 GObject parent_instance;
36
37 chromeos_update_engine::UpdateAttempter* update_attempter_;
38};
39
40struct UpdateEngineServiceClass {
41 GObjectClass parent_class;
42};
43
44UpdateEngineService* update_engine_service_new(void);
45GType update_engine_service_get_type(void);
46
47// Methods
48
49gboolean update_engine_service_get_status(UpdateEngineService* self,
Andrew de los Reyes63b96d72010-05-10 13:08:54 -070050 int64_t* last_checked_time,
51 double* progress,
52 gchar** current_operation,
53 gchar** new_version,
54 int64_t* new_size,
55 GError **error);
56
57gboolean update_engine_service_check_for_update(UpdateEngineService* self,
58 GError **error);
59
60gboolean update_engine_service_emit_status_update(
61 UpdateEngineService* self,
62 gint64 last_checked_time,
63 gdouble progress,
64 const gchar* current_operation,
65 const gchar* new_version,
66 gint64 new_size);
Andrew de los Reyes4e9b9f42010-04-26 15:06:43 -070067
68G_END_DECLS
69
70#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DBUS_SERVICE_H__