Index: disk.cc |
diff --git a/disk.cc b/disk.cc |
index fe0bf8c33ac49c4e334147f7f207cfeb0cfb65df..0300be66f5b4bcc04f3402b7d12de02fafb0ea45 100644 |
--- a/disk.cc |
+++ b/disk.cc |
@@ -17,12 +17,13 @@ const char kNativePath[] = "NativePath"; |
const char kDeviceFile[] = "DeviceFile"; |
const char kLabel[] = "IdLabel"; |
const char kDriveModel[] = "DriveModel"; |
-const char kPartitionSlave[] = "PartitionSlave"; |
const char kDriveIsRotational[] = "DriveIsRotational"; |
const char kDeviceIsOpticalDisc[] = "DeviceIsOpticalDisc"; |
const char kDeviceSize[] = "DeviceSize"; |
const char kReadOnly[] = "DeviceIsReadOnly"; |
+// TODO(rtc): Figure out what this field is and include it in the response. |
+const char kPartitionSlave[] = "PartitionSlave"; |
// TODO(rtc): The constructor should set some defaults, but I'm still iterating |
// on the data model. |
@@ -32,4 +33,22 @@ Disk::Disk() { |
Disk::~Disk() { |
} |
+DBusDisk Disk::ToDBusFormat() const { |
+ DBusDisk disk; |
+ disk[kDeviceIsDrive].writer().append_bool(is_drive()); |
+ disk[kDevicePresentationHide].writer().append_bool(is_hidden()); |
+ disk[kDeviceIsMounted].writer().append_bool(is_mounted()); |
+ disk[kDeviceMountPaths].writer().append_string(mount_path().c_str()); |
+ disk[kDeviceIsMediaAvailable].writer().append_bool(is_media_available()); |
+ disk[kNativePath].writer().append_string(native_path().c_str()); |
+ disk[kDeviceFile].writer().append_string(device_file().c_str()); |
+ disk[kLabel].writer().append_string(label().c_str()); |
+ disk[kDriveModel].writer().append_string(drive_model().c_str()); |
+ disk[kDriveIsRotational].writer().append_bool(is_rotational()); |
+ disk[kDeviceIsOpticalDisc].writer().append_bool(is_optical_disk()); |
+ disk[kDeviceSize].writer().append_int64(device_capacity()); |
+ disk[kReadOnly].writer().append_bool(is_read_only()); |
+ return disk; |
+} |
+ |
} // namespace cros_disks |