| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.mtp; |
| 18 | |
| 19 | /** |
| 20 | * This class encapsulates information about a storage unit on an MTP device. |
| 21 | * This corresponds to the StorageInfo Dataset described in |
| 22 | * section 5.2.2 of the MTP specification. |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 23 | */ |
| 24 | public final class MtpStorageInfo { |
| 25 | |
| 26 | private int mStorageId; |
| 27 | private long mMaxCapacity; |
| 28 | private long mFreeSpace; |
| 29 | private String mDescription; |
| 30 | private String mVolumeIdentifier; |
| 31 | |
| 32 | // only instantiated via JNI |
| 33 | private MtpStorageInfo() { |
| 34 | } |
| 35 | |
| 36 | /** |
| Mike Lockwood | 11dd5ae | 2011-04-01 14:00:08 -0400 | [diff] [blame] | 37 | * Returns the storage ID for the storage unit. |
| 38 | * The storage ID uniquely identifies the storage unit on the MTP device. |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 39 | * |
| 40 | * @return the storage ID |
| 41 | */ |
| 42 | public final int getStorageId() { |
| 43 | return mStorageId; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Returns the maximum storage capacity for the storage unit in bytes |
| 48 | * |
| 49 | * @return the maximum capacity |
| 50 | */ |
| 51 | public final long getMaxCapacity() { |
| 52 | return mMaxCapacity; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Returns the amount of free space in the storage unit in bytes |
| 57 | * |
| 58 | * @return the amount of free space |
| 59 | */ |
| 60 | public final long getFreeSpace() { |
| 61 | return mFreeSpace; |
| 62 | } |
| 63 | |
| 64 | /** |
| Mike Lockwood | 11dd5ae | 2011-04-01 14:00:08 -0400 | [diff] [blame] | 65 | * Returns the description string for the storage unit. |
| 66 | * This is typically displayed to the user in the user interface on the |
| 67 | * MTP host. |
| Mike Lockwood | 8182e72 | 2010-12-30 15:38:45 -0500 | [diff] [blame] | 68 | * |
| 69 | * @return the storage unit description |
| 70 | */ |
| 71 | public final String getDescription() { |
| 72 | return mDescription; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Returns the volume identifier for the storage unit |
| 77 | * |
| 78 | * @return the storage volume identifier |
| 79 | */ |
| 80 | public final String getVolumeIdentifier() { |
| 81 | return mVolumeIdentifier; |
| 82 | } |
| 83 | } |