本文整理汇总了C++中MtpDevice::getStorageInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ MtpDevice::getStorageInfo方法的具体用法?C++ MtpDevice::getStorageInfo怎么用?C++ MtpDevice::getStorageInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MtpDevice
的用法示例。
在下文中一共展示了MtpDevice::getStorageInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ALOGE
static jobject
android_mtp_MtpDevice_get_storage_info(JNIEnv *env, jobject thiz, jint storageID)
{
MtpDevice* device = get_device_from_object(env, thiz);
if (!device)
return NULL;
MtpStorageInfo* storageInfo = device->getStorageInfo(storageID);
if (!storageInfo)
return NULL;
jobject info = env->NewObject(clazz_storageInfo, constructor_storageInfo);
if (info == NULL) {
ALOGE("Could not create a MtpStorageInfo object");
delete storageInfo;
return NULL;
}
if (storageInfo->mStorageID)
env->SetIntField(info, field_storageInfo_storageId, storageInfo->mStorageID);
if (storageInfo->mMaxCapacity)
env->SetLongField(info, field_storageInfo_maxCapacity, storageInfo->mMaxCapacity);
if (storageInfo->mFreeSpaceBytes)
env->SetLongField(info, field_storageInfo_freeSpace, storageInfo->mFreeSpaceBytes);
if (storageInfo->mStorageDescription)
env->SetObjectField(info, field_storageInfo_description,
env->NewStringUTF(storageInfo->mStorageDescription));
if (storageInfo->mVolumeIdentifier)
env->SetObjectField(info, field_storageInfo_volumeIdentifier,
env->NewStringUTF(storageInfo->mVolumeIdentifier));
delete storageInfo;
return info;
}