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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 // |file_ids| is a list of MTP-device specific file ids. | 118 // |file_ids| is a list of MTP-device specific file ids. |
119 // |offset| is the index into |file_ids| to read from. | 119 // |offset| is the index into |file_ids| to read from. |
120 // |entries_to_read| is the maximum number of file entries to read. | 120 // |entries_to_read| is the maximum number of file entries to read. |
121 virtual void GetFileInfo(const std::string& handle, | 121 virtual void GetFileInfo(const std::string& handle, |
122 const std::vector<uint32>& file_ids, | 122 const std::vector<uint32>& file_ids, |
123 size_t offset, | 123 size_t offset, |
124 size_t entries_to_read, | 124 size_t entries_to_read, |
125 const GetFileInfoCallback& callback, | 125 const GetFileInfoCallback& callback, |
126 const ErrorCallback& error_callback) = 0; | 126 const ErrorCallback& error_callback) = 0; |
127 | 127 |
128 // TODO(thestig): Rename to ReadFileChunk. | 128 // Calls ReadFileChunj method. |callback| is called after the method call |
tommycli
2014/08/04 19:54:33
typo
Lei Zhang
2014/08/04 20:10:16
Done.
| |
129 // Calls ReadFilePathById method. |callback| is called after the method call | |
130 // succeeds, otherwise, |error_callback| is called. | 129 // succeeds, otherwise, |error_callback| is called. |
131 // |file_id| is a MTP-device specific id for a file. | 130 // |file_id| is a MTP-device specific id for a file. |
131 // |offset| is the offset into the file. | |
132 // |bytes_to_read| cannot exceed 1 MiB. | 132 // |bytes_to_read| cannot exceed 1 MiB. |
133 virtual void ReadFileChunkById(const std::string& handle, | 133 virtual void ReadFileChunk(const std::string& handle, |
134 uint32 file_id, | 134 uint32 file_id, |
135 uint32 offset, | 135 uint32 offset, |
136 uint32 bytes_to_read, | 136 uint32 bytes_to_read, |
137 const ReadFileCallback& callback, | 137 const ReadFileCallback& callback, |
138 const ErrorCallback& error_callback) = 0; | 138 const ErrorCallback& error_callback) = 0; |
139 | 139 |
140 // Registers given callback for events. Should only be called once. | 140 // Registers given callback for events. Should only be called once. |
141 // |storage_event_handler| is called when a mtp storage attach or detach | 141 // |storage_event_handler| is called when a mtp storage attach or detach |
142 // signal is received. | 142 // signal is received. |
143 virtual void ListenForChanges(const MTPStorageEventHandler& handler) = 0; | 143 virtual void ListenForChanges(const MTPStorageEventHandler& handler) = 0; |
144 | 144 |
145 // Factory function, creates a new instance and returns ownership. | 145 // Factory function, creates a new instance and returns ownership. |
146 static MediaTransferProtocolDaemonClient* Create(dbus::Bus* bus); | 146 static MediaTransferProtocolDaemonClient* Create(dbus::Bus* bus); |
147 | 147 |
148 protected: | 148 protected: |
149 // Create() should be used instead. | 149 // Create() should be used instead. |
150 MediaTransferProtocolDaemonClient(); | 150 MediaTransferProtocolDaemonClient(); |
151 | 151 |
152 private: | 152 private: |
153 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient); | 153 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClient); |
154 }; | 154 }; |
155 | 155 |
156 } // namespace device | 156 } // namespace device |
157 | 157 |
158 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_ H_ | 158 #endif // DEVICE_MEDIA_TRANSFER_PROTOCOL_MEDIA_TRANSFER_PROTOCOL_DAEMON_CLIENT_ H_ |
OLD | NEW |