Loading media/mtp/MtpDevice.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,23 @@ MtpObjectHandle MtpDevice::getStorageID(MtpObjectHandle handle) { return -1; } MtpObjectPropertyList* MtpDevice::getObjectPropsSupported(MtpObjectFormat format) { Mutex::Autolock autoLock(mMutex); mRequest.reset(); mRequest.setParameter(1, format); if (!sendRequest(MTP_OPERATION_GET_OBJECT_PROPS_SUPPORTED)) return NULL; if (!readData()) return NULL; MtpResponseCode ret = readResponse(); if (ret == MTP_RESPONSE_OK) { return mData.getAUInt16(); } return NULL; } MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { Mutex::Autolock autoLock(mMutex); Loading @@ -348,6 +365,24 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { return NULL; } MtpProperty* MtpDevice::getObjectPropDesc(MtpObjectProperty code) { Mutex::Autolock autoLock(mMutex); mRequest.reset(); mRequest.setParameter(1, code); if (!sendRequest(MTP_OPERATION_GET_OBJECT_PROP_DESC)) return NULL; if (!readData()) return NULL; MtpResponseCode ret = readResponse(); if (ret == MTP_RESPONSE_OK) { MtpProperty* property = new MtpProperty; property->read(mData); return property; } return NULL; } // reads the object's data and writes it to the specified file path bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath, int group, int perm) { LOGD("readObject: %s", destPath); Loading media/mtp/MtpDevice.h +3 −0 Original line number Diff line number Diff line Loading @@ -85,7 +85,10 @@ public: MtpObjectHandle getParent(MtpObjectHandle handle); MtpObjectHandle getStorageID(MtpObjectHandle handle); MtpObjectPropertyList* getObjectPropsSupported(MtpObjectFormat format); MtpProperty* getDevicePropDesc(MtpDeviceProperty code); MtpProperty* getObjectPropDesc(MtpObjectProperty code); bool readObject(MtpObjectHandle handle, const char* destPath, int group, int perm); Loading Loading
media/mtp/MtpDevice.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -330,6 +330,23 @@ MtpObjectHandle MtpDevice::getStorageID(MtpObjectHandle handle) { return -1; } MtpObjectPropertyList* MtpDevice::getObjectPropsSupported(MtpObjectFormat format) { Mutex::Autolock autoLock(mMutex); mRequest.reset(); mRequest.setParameter(1, format); if (!sendRequest(MTP_OPERATION_GET_OBJECT_PROPS_SUPPORTED)) return NULL; if (!readData()) return NULL; MtpResponseCode ret = readResponse(); if (ret == MTP_RESPONSE_OK) { return mData.getAUInt16(); } return NULL; } MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { Mutex::Autolock autoLock(mMutex); Loading @@ -348,6 +365,24 @@ MtpProperty* MtpDevice::getDevicePropDesc(MtpDeviceProperty code) { return NULL; } MtpProperty* MtpDevice::getObjectPropDesc(MtpObjectProperty code) { Mutex::Autolock autoLock(mMutex); mRequest.reset(); mRequest.setParameter(1, code); if (!sendRequest(MTP_OPERATION_GET_OBJECT_PROP_DESC)) return NULL; if (!readData()) return NULL; MtpResponseCode ret = readResponse(); if (ret == MTP_RESPONSE_OK) { MtpProperty* property = new MtpProperty; property->read(mData); return property; } return NULL; } // reads the object's data and writes it to the specified file path bool MtpDevice::readObject(MtpObjectHandle handle, const char* destPath, int group, int perm) { LOGD("readObject: %s", destPath); Loading
media/mtp/MtpDevice.h +3 −0 Original line number Diff line number Diff line Loading @@ -85,7 +85,10 @@ public: MtpObjectHandle getParent(MtpObjectHandle handle); MtpObjectHandle getStorageID(MtpObjectHandle handle); MtpObjectPropertyList* getObjectPropsSupported(MtpObjectFormat format); MtpProperty* getDevicePropDesc(MtpDeviceProperty code); MtpProperty* getObjectPropDesc(MtpObjectProperty code); bool readObject(MtpObjectHandle handle, const char* destPath, int group, int perm); Loading