18182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood/* 28182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * Copyright (C) 2010 The Android Open Source Project 38182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 48182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * Licensed under the Apache License, Version 2.0 (the "License"); 58182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * you may not use this file except in compliance with the License. 68182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * You may obtain a copy of the License at 78182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 88182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * http://www.apache.org/licenses/LICENSE-2.0 98182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 108182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * Unless required by applicable law or agreed to in writing, software 118182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * distributed under the License is distributed on an "AS IS" BASIS, 128182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * See the License for the specific language governing permissions and 148182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * limitations under the License. 158182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 168182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 178182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwoodpackage android.mtp; 188182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 198182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood/** 208182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * This class encapsulates information about a storage unit on an MTP device. 218182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * This corresponds to the StorageInfo Dataset described in 228182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * section 5.2.2 of the MTP specification. 238182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 248182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwoodpublic final class MtpStorageInfo { 258182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 268182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood private int mStorageId; 278182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood private long mMaxCapacity; 288182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood private long mFreeSpace; 298182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood private String mDescription; 308182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood private String mVolumeIdentifier; 318182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 328182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood // only instantiated via JNI 338182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood private MtpStorageInfo() { 348182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood } 358182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 368182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood /** 3711dd5ae97b1cd5889bb66862fd12718da62a9c75Mike Lockwood * Returns the storage ID for the storage unit. 3811dd5ae97b1cd5889bb66862fd12718da62a9c75Mike Lockwood * The storage ID uniquely identifies the storage unit on the MTP device. 398182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 408182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * @return the storage ID 418182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 428182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood public final int getStorageId() { 438182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood return mStorageId; 448182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood } 458182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 468182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood /** 478182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * Returns the maximum storage capacity for the storage unit in bytes 488182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 498182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * @return the maximum capacity 508182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 518182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood public final long getMaxCapacity() { 528182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood return mMaxCapacity; 538182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood } 548182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 558182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood /** 568182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * Returns the amount of free space in the storage unit in bytes 578182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 588182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * @return the amount of free space 598182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 608182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood public final long getFreeSpace() { 618182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood return mFreeSpace; 628182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood } 638182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 648182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood /** 6511dd5ae97b1cd5889bb66862fd12718da62a9c75Mike Lockwood * Returns the description string for the storage unit. 6611dd5ae97b1cd5889bb66862fd12718da62a9c75Mike Lockwood * This is typically displayed to the user in the user interface on the 6711dd5ae97b1cd5889bb66862fd12718da62a9c75Mike Lockwood * MTP host. 688182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 698182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * @return the storage unit description 708182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 718182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood public final String getDescription() { 728182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood return mDescription; 738182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood } 748182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood 758182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood /** 768182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * Returns the volume identifier for the storage unit 778182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * 788182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood * @return the storage volume identifier 798182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood */ 808182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood public final String getVolumeIdentifier() { 818182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood return mVolumeIdentifier; 828182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood } 838182e72479a8b0d832df9c392890b25bfa6f97b5Mike Lockwood} 84