| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Client code to talk to the Media Transfer Protocol daemon. The MTP daemon is | 5 // Client code to talk to the Media Transfer Protocol daemon. The MTP daemon is |
| 6 // responsible for communicating with PTP / MTP capable devices like cameras | 6 // responsible for communicating with PTP / MTP capable devices like cameras |
| 7 // and smartphones. | 7 // and smartphones. |
| 8 | 8 |
| 9 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_ | 9 #ifndef DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_ |
| 10 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_ | 10 #define DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_H_ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 // A callback to handle the result of GetFileInfo. | 62 // A callback to handle the result of GetFileInfo. |
| 63 // The argument is a vector of file entries. | 63 // The argument is a vector of file entries. |
| 64 typedef base::Callback<void(const std::vector<MtpFileEntry>& file_entries) | 64 typedef base::Callback<void(const std::vector<MtpFileEntry>& file_entries) |
| 65 > GetFileInfoCallback; | 65 > GetFileInfoCallback; |
| 66 | 66 |
| 67 // A callback to handle the result of ReadFileChunkById. | 67 // A callback to handle the result of ReadFileChunkById. |
| 68 // The argument is a string containing the file data. | 68 // The argument is a string containing the file data. |
| 69 typedef base::Callback<void(const std::string& data)> ReadFileCallback; | 69 typedef base::Callback<void(const std::string& data)> ReadFileCallback; |
| 70 | 70 |
| 71 // A callback to handle the result of RenameObject. |
| 72 typedef base::Closure RenameObjectCallback; |
| 73 |
| 71 // A callback to handle the result of CopyFileFromLocal. | 74 // A callback to handle the result of CopyFileFromLocal. |
| 72 typedef base::Closure CopyFileFromLocalCallback; | 75 typedef base::Closure CopyFileFromLocalCallback; |
| 73 | 76 |
| 74 // A callback to handle the result of DeleteObject. | 77 // A callback to handle the result of DeleteObject. |
| 75 typedef base::Closure DeleteObjectCallback; | 78 typedef base::Closure DeleteObjectCallback; |
| 76 | 79 |
| 77 // A callback to handle storage attach/detach events. | 80 // A callback to handle storage attach/detach events. |
| 78 // The first argument is true for attach, false for detach. | 81 // The first argument is true for attach, false for detach. |
| 79 // The second argument is the storage name. | 82 // The second argument is the storage name. |
| 80 typedef base::Callback<void(bool is_attach, | 83 typedef base::Callback<void(bool is_attach, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // |file_id| is a MTP-device specific id for a file. | 139 // |file_id| is a MTP-device specific id for a file. |
| 137 // |offset| is the offset into the file. | 140 // |offset| is the offset into the file. |
| 138 // |bytes_to_read| cannot exceed 1 MiB. | 141 // |bytes_to_read| cannot exceed 1 MiB. |
| 139 virtual void ReadFileChunk(const std::string& handle, | 142 virtual void ReadFileChunk(const std::string& handle, |
| 140 uint32 file_id, | 143 uint32 file_id, |
| 141 uint32 offset, | 144 uint32 offset, |
| 142 uint32 bytes_to_read, | 145 uint32 bytes_to_read, |
| 143 const ReadFileCallback& callback, | 146 const ReadFileCallback& callback, |
| 144 const ErrorCallback& error_callback) = 0; | 147 const ErrorCallback& error_callback) = 0; |
| 145 | 148 |
| 149 // Calls RenameObject method. |callback| is called after the method call |
| 150 // succeeds, otherwise, |error_callback| is called. |
| 151 // |object_is| is an id of object to be renamed. |
| 152 // |new_name| is new name of the object. |
| 153 virtual void RenameObject(const std::string& handle, |
| 154 const uint32 object_id, |
| 155 const std::string& new_name, |
| 156 const RenameObjectCallback& callback, |
| 157 const ErrorCallback& error_callback) = 0; |
| 158 |
| 146 // Calls CopyFileFromLocal method. |callback| is called after the method call | 159 // Calls CopyFileFromLocal method. |callback| is called after the method call |
| 147 // succeeds, otherwise, |error_callback| is called. | 160 // succeeds, otherwise, |error_callback| is called. |
| 148 // |source_file_descriptor| is a file descriptor of source file. | 161 // |source_file_descriptor| is a file descriptor of source file. |
| 149 // |parent_id| is a object id of a target directory. | 162 // |parent_id| is a object id of a target directory. |
| 150 // |file_name| is a file name of a target file. | 163 // |file_name| is a file name of a target file. |
| 151 virtual void CopyFileFromLocal(const std::string& handle, | 164 virtual void CopyFileFromLocal(const std::string& handle, |
| 152 const int source_file_descriptor, | 165 const int source_file_descriptor, |
| 153 const uint32 parent_id, | 166 const uint32 parent_id, |
| 154 const std::string& file_name, | 167 const std::string& file_name, |
| 155 const CopyFileFromLocalCallback& callback, | 168 const CopyFileFromLocalCallback& callback, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 175 // Create() should be used instead. | 188 // Create() should be used instead. |
| 176 MediaTransferProtocolDaemonClient(); | 189 MediaTransferProtocolDaemonClient(); |
| 177 | 190 |
| 178 private: | 191 private: |
| 179 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient); | 192 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient); |
| 180 }; | 193 }; |
| 181 | 194 |
| 182 } // namespace device | 195 } // namespace device |
| 183 | 196 |
| 184 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_
H_ | 197 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_
H_ |
| OLD | NEW |