-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage_burn_service.h
58 lines (43 loc) · 1.84 KB
/
image_burn_service.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2011 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IMAGE_BURNER_IMAGE_BURN_SERVICE_H_
#define IMAGE_BURNER_IMAGE_BURN_SERVICE_H_
#include <stdint.h>
#include <string>
#include <brillo/dbus/dbus_object.h>
#include <chromeos/dbus/service_constants.h>
#include "image-burner/dbus_adaptors/org.chromium.ImageBurnerInterface.h"
#include "image-burner/image_burner_impl.h"
#include "image-burner/image_burner_utils_interfaces.h"
namespace imageburn {
// Provides a wrapper for exporting ImageBurnerInterface to
// D-Bus.
class ImageBurnService : public org::chromium::ImageBurnerInterfaceInterface,
public org::chromium::ImageBurnerInterfaceAdaptor,
public SignalSender {
public:
ImageBurnService(scoped_refptr<dbus::Bus> bus, BurnerImpl* burner_impl);
virtual ~ImageBurnService();
void RegisterAsync(
brillo::dbus_utils::AsyncEventSequencer::CompletionAction cb);
// org::chromium::ImageBurnerInterfaceInterface overrides.
bool BurnImage(brillo::ErrorPtr* error,
const std::string& from_path,
const std::string& to_path) override;
void SendFinishedSignal(const char* target_path,
bool success,
const char* error_message) override;
void SendProgressSignal(int64_t amount_burnt,
int64_t total_size,
const char* target_path) override;
private:
void BurnImageInternal(const std::string& from_path,
const std::string& to_path);
brillo::dbus_utils::DBusObject dbus_object_;
int64_t amount_burnt_for_next_signal_;
bool burning_;
BurnerImpl* burner_impl_;
};
} // namespace imageburn
#endif // IMAGE_BURNER_IMAGE_BURN_SERVICE_H_