1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _MTP_TYPES_H 18 #define _MTP_TYPES_H 19 20 #include <stdint.h> 21 #include <vector> 22 23 namespace android { 24 25 typedef int32_t int128_t[4]; 26 typedef uint32_t uint128_t[4]; 27 28 typedef uint16_t MtpOperationCode; 29 typedef uint16_t MtpResponseCode; 30 typedef uint16_t MtpEventCode; 31 typedef uint32_t MtpSessionID; 32 typedef uint32_t MtpStorageID; 33 typedef uint32_t MtpTransactionID; 34 typedef uint16_t MtpPropertyCode; 35 typedef uint16_t MtpDataType; 36 typedef uint16_t MtpObjectFormat; 37 typedef MtpPropertyCode MtpDeviceProperty; 38 typedef MtpPropertyCode MtpObjectProperty; 39 40 // object handles are unique across all storage but only within a single session. 41 // object handles cannot be reused after an object is deleted. 42 // values 0x00000000 and 0xFFFFFFFF are reserved for special purposes. 43 typedef uint32_t MtpObjectHandle; 44 45 // Special values 46 #define MTP_PARENT_ROOT 0xFFFFFFFF // parent is root of the storage 47 #define kInvalidObjectHandle 0xFFFFFFFF 48 49 class MtpStorage; 50 class MtpDevice; 51 class MtpProperty; 52 53 typedef std::vector<MtpStorage *> MtpStorageList; 54 typedef std::vector<MtpDevice*> MtpDeviceList; 55 typedef std::vector<MtpProperty*> MtpPropertyList; 56 57 typedef std::vector<uint8_t> UInt8List; 58 typedef std::vector<uint16_t> UInt16List; 59 typedef std::vector<uint32_t> UInt32List; 60 typedef std::vector<uint64_t> UInt64List; 61 typedef std::vector<int8_t> Int8List; 62 typedef std::vector<int16_t> Int16List; 63 typedef std::vector<int32_t> Int32List; 64 typedef std::vector<int64_t> Int64List; 65 66 typedef UInt16List MtpObjectPropertyList; 67 typedef UInt16List MtpDevicePropertyList; 68 typedef UInt16List MtpObjectFormatList; 69 typedef UInt32List MtpObjectHandleList; 70 typedef UInt16List MtpObjectPropertyList; 71 typedef UInt32List MtpStorageIDList; 72 73 enum UrbPacketDivisionMode { 74 // First packet only contains a header. 75 FIRST_PACKET_ONLY_HEADER, 76 // First packet contains payload much as possible. 77 FIRST_PACKET_HAS_PAYLOAD 78 }; 79 80 }; // namespace android 81 82 #endif // _MTP_TYPES_H 83