summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpPacket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/mtp/MtpPacket.cpp')
-rw-r--r--media/mtp/MtpPacket.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/media/mtp/MtpPacket.cpp b/media/mtp/MtpPacket.cpp
index bd6196f..a885249 100644
--- a/media/mtp/MtpPacket.cpp
+++ b/media/mtp/MtpPacket.cpp
@@ -84,6 +84,13 @@ void MtpPacket::dump() {
LOGV("\n");
}
+void MtpPacket::copyFrom(const MtpPacket& src) {
+ int length = src.mPacketSize;
+ allocate(length);
+ mPacketSize = length;
+ memcpy(mBuffer, src.mBuffer, length);
+}
+
uint16_t MtpPacket::getUInt16(int offset) const {
return ((uint16_t)mBuffer[offset + 1] << 8) | (uint16_t)mBuffer[offset];
}
@@ -113,6 +120,10 @@ void MtpPacket::setContainerCode(uint16_t code) {
putUInt16(MTP_CONTAINER_CODE_OFFSET, code);
}
+uint16_t MtpPacket::getContainerType() const {
+ return getUInt16(MTP_CONTAINER_TYPE_OFFSET);
+}
+
MtpTransactionID MtpPacket::getTransactionID() const {
return getUInt32(MTP_CONTAINER_TRANSACTION_ID_OFFSET);
}