Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d5b0a32 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "MTP: Partial implementation of the GetObjectPropList command"

parents c0aaccc4 e2ad6ec1
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -21,6 +21,30 @@ package android.media;
 */
public final class MtpConstants {

// MTP Data Types
    public static final int TYPE_UNDEFINED = 0x0000;
    public static final int TYPE_INT8 = 0x0001;
    public static final int TYPE_UINT8 = 0x0002;
    public static final int TYPE_INT16 = 0x0003;
    public static final int TYPE_UINT16 = 0x0004;
    public static final int TYPE_INT32 = 0x0005;
    public static final int TYPE_UINT32 = 0x0006;
    public static final int TYPE_INT64 = 0x0007;
    public static final int TYPE_UINT64 = 0x0008;
    public static final int TYPE_INT128 = 0x0009;
    public static final int TYPE_UINT128 = 0x000A;
    public static final int TYPE_AINT8 = 0x4001;
    public static final int TYPE_AUINT8 = 0x4002;
    public static final int TYPE_AINT16 = 0x4003;
    public static final int TYPE_AUINT16 = 0x4004;
    public static final int TYPE_AINT32 = 0x4005;
    public static final int TYPE_AUINT32 = 0x4006;
    public static final int TYPE_AINT64 = 0x4007;
    public static final int TYPE_AUINT64 = 0x4008;
    public static final int TYPE_AINT128 = 0x4009;
    public static final int TYPE_AUINT128 = 0x400A;
    public static final int TYPE_STR = 0xFFFF;

// MTP Response Codes
    public static final int RESPONSE_UNDEFINED = 0x2000;
    public static final int RESPONSE_OK = 0x2001;
+255 −139

File changed.

Preview size limit exceeded, changes collapsed.

+76 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.media;

/**
 * Encapsulates the ObjectPropList dataset used by the GetObjectPropList command.
 * The fields of this class are read by JNI code in android_media_MtpDatabase.cpp
 *
 * {@hide}
 */

public class MtpPropertyList {

    // number of results returned
    public final int        mCount;
    // result code for GetObjectPropList
    public int              mResult;
    // list of object handles (first field in quadruplet)
    public final int[]      mObjectHandles;
    // list of object propery codes (second field in quadruplet)
    public final int[]      mPropertyCodes;
    // list of data type codes (third field in quadruplet)
    public final int[]     mDataTypes;
    // list of long int property values (fourth field in quadruplet, when value is integer type)
    public long[]     mLongValues;
    // list of long int property values (fourth field in quadruplet, when value is string type)
    public String[]   mStringValues;

    // constructor only called from MtpDatabase
    public MtpPropertyList(int count, int result) {
        mCount = count;
        mResult = result;
        mObjectHandles = new int[count];
        mPropertyCodes = new int[count];
        mDataTypes = new int[count];
        // mLongValues and mStringValues are created lazily since both might not be necessary
    }

    public void setProperty(int index, int handle, int property, int type, long value) {
        if (mLongValues == null) {
            mLongValues = new long[mCount];
        }
        mObjectHandles[index] = handle;
        mPropertyCodes[index] = property;
        mDataTypes[index] = type;
        mLongValues[index] = value;
    }

    public void setProperty(int index, int handle, int property, String value) {
        if (mStringValues == null) {
            mStringValues = new String[mCount];
        }
        mObjectHandles[index] = handle;
        mPropertyCodes[index] = property;
        mDataTypes[index] = MtpConstants.TYPE_STR;
        mStringValues[index] = value;
    }

    public void setResult(int result) {
        mResult = result;
    }
}
+265 −79

File changed.

Preview size limit exceeded, changes collapsed.

+6 −0
Original line number Diff line number Diff line
@@ -75,6 +75,12 @@ public:

    virtual MtpResponseCode         resetDeviceProperty(MtpDeviceProperty property) = 0;

    virtual MtpResponseCode         getObjectPropertyList(MtpObjectHandle handle,
                                            MtpObjectFormat format,
                                            MtpObjectProperty property,
                                            int groupCode, int depth,
                                            MtpDataPacket& packet) = 0;

    virtual MtpResponseCode         getObjectInfo(MtpObjectHandle handle,
                                            MtpDataPacket& packet) = 0;

Loading