Alex Vakulenko | 89d9d5e | 2014-09-12 10:27:23 -0700 | [diff] [blame] | 1 | // Copyright 2014 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 BUFFET_LIBBUFFET_PRIVATE_COMMAND_PROPERTY_SET_H_ |
| 6 | #define BUFFET_LIBBUFFET_PRIVATE_COMMAND_PROPERTY_SET_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/macros.h> |
| 11 | #include <chromeos/any.h> |
| 12 | #include <chromeos/dbus/data_serialization.h> |
| 13 | #include <dbus/object_manager.h> |
| 14 | |
| 15 | #include "buffet/libbuffet/export.h" |
| 16 | |
| 17 | namespace dbus { |
| 18 | // Specialize dbus::Property for chromeos::dbus_utils::Dictionary type. |
| 19 | template class Property<chromeos::dbus_utils::Dictionary>; |
| 20 | |
| 21 | template <> |
| 22 | inline bool Property<chromeos::dbus_utils::Dictionary>::PopValueFromReader( |
| 23 | MessageReader* reader) { |
| 24 | return chromeos::dbus_utils::PopVariantValueFromReader(reader, &value_); |
| 25 | } |
| 26 | |
| 27 | template <> |
| 28 | inline void Property<chromeos::dbus_utils::Dictionary>::AppendSetValueToWriter( |
| 29 | MessageWriter* writer) { |
| 30 | chromeos::dbus_utils::AppendValueToWriterAsVariant(writer, set_value_); |
| 31 | } |
| 32 | } // namespace dbus |
| 33 | |
| 34 | namespace buffet { |
| 35 | |
| 36 | // PropertySet for remote D-Bus GCD Command object from Buffet daemon. |
| 37 | class CommandPropertySet : public dbus::PropertySet { |
| 38 | public: |
| 39 | CommandPropertySet(dbus::ObjectProxy* object_proxy, |
| 40 | const std::string& interface_name, |
| 41 | const PropertyChangedCallback& callback); |
| 42 | dbus::Property<std::string> id; |
| 43 | dbus::Property<std::string> name; |
| 44 | dbus::Property<std::string> category; |
| 45 | dbus::Property<std::string> status; |
| 46 | dbus::Property<int32_t> progress; |
| 47 | dbus::Property<chromeos::dbus_utils::Dictionary> parameters; |
| 48 | |
| 49 | private: |
| 50 | DISALLOW_COPY_AND_ASSIGN(CommandPropertySet); |
| 51 | }; |
| 52 | |
| 53 | } // namespace buffet |
| 54 | |
| 55 | #endif // BUFFET_LIBBUFFET_PRIVATE_COMMAND_PROPERTY_SET_H_ |