diff options
| author | 2010-10-14 18:03:25 -0400 | |
|---|---|---|
| committer | 2010-11-15 11:46:51 -0500 | |
| commit | e2ad6ec1718ef0c0e8230f8f62e7cfefcf598b6a (patch) | |
| tree | 0f7de42a1ed233d704558830643e73acd954b940 /media/mtp/MtpServer.cpp | |
| parent | 44d47ad56502a1ccb308a9ec2cd05120a53fac3d (diff) | |
MTP: Partial implementation of the GetObjectPropList command
In this initial implementation we only support fetching one property at a time.
Support depth = 0 (single object) or depth = 1 (all objects in a directory)
Reimplemented GetObjectPropValue on top of GetObjectPropList, since the former
is a special case of the latter.
Change-Id: Ia76ee61741d6ee3902b5c5d9fc094cf86dfaf650
Signed-off-by: Mike Lockwood <lockwood@google.com>
Diffstat (limited to 'media/mtp/MtpServer.cpp')
| -rw-r--r-- | media/mtp/MtpServer.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp index 5ba6be918477..6cf70ec244d1 100644 --- a/media/mtp/MtpServer.cpp +++ b/media/mtp/MtpServer.cpp @@ -72,6 +72,10 @@ static const MtpOperationCode kSupportedOperationCodes[] = { MTP_OPERATION_GET_OBJECT_PROP_DESC, MTP_OPERATION_GET_OBJECT_PROP_VALUE, MTP_OPERATION_SET_OBJECT_PROP_VALUE, + MTP_OPERATION_GET_OBJECT_PROP_LIST, +// MTP_OPERATION_SET_OBJECT_PROP_LIST, +// MTP_OPERATION_GET_INTERDEPENDENT_PROP_DESC, +// MTP_OPERATION_SEND_OBJECT_PROP_LIST, MTP_OPERATION_GET_OBJECT_REFERENCES, MTP_OPERATION_SET_OBJECT_REFERENCES, // MTP_OPERATION_SKIP, @@ -276,6 +280,9 @@ bool MtpServer::handleRequest() { case MTP_OPERATION_RESET_DEVICE_PROP_VALUE: response = doResetDevicePropValue(); break; + case MTP_OPERATION_GET_OBJECT_PROP_LIST: + response = doGetObjectPropList(); + break; case MTP_OPERATION_GET_OBJECT_INFO: response = doGetObjectInfo(); break; @@ -523,6 +530,20 @@ MtpResponseCode MtpServer::doResetDevicePropValue() { return mDatabase->resetDeviceProperty(property); } +MtpResponseCode MtpServer::doGetObjectPropList() { + + MtpObjectHandle handle = mRequest.getParameter(1); + MtpObjectFormat format = mRequest.getParameter(2); + MtpDeviceProperty property = mRequest.getParameter(3); + int groupCode = mRequest.getParameter(4); + int depth = mRequest.getParameter(4); + LOGD("GetObjectPropList %d format: %s property: %s group: %d depth: %d\n", + handle, MtpDebug::getFormatCodeName(format), + MtpDebug::getObjectPropCodeName(property), groupCode, depth); + + return mDatabase->getObjectPropertyList(handle, format, property, groupCode, depth, mData); +} + MtpResponseCode MtpServer::doGetObjectInfo() { MtpObjectHandle handle = mRequest.getParameter(1); return mDatabase->getObjectInfo(handle, mData); |