diff options
author | Mike Lockwood <lockwood@android.com> | 2010-07-12 18:54:16 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-07-13 20:04:22 -0400 |
commit | be125a50b41f15810145671e0fcbdaf13b363e03 (patch) | |
tree | a0af388e0524314a55da06d48d16928bfc90c1a0 /media/mtp/MtpEventPacket.h | |
parent | 77ad5e64116ba692efea060d528681c069aa439b (diff) | |
download | frameworks_base-be125a50b41f15810145671e0fcbdaf13b363e03.zip frameworks_base-be125a50b41f15810145671e0fcbdaf13b363e03.tar.gz frameworks_base-be125a50b41f15810145671e0fcbdaf13b363e03.tar.bz2 |
MTP: Add support for sending events to the host when objects are added and removed
Change-Id: Ia1d5232b919c644c670ff9ca651eca92b3f9ad42
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpEventPacket.h')
-rw-r--r-- | media/mtp/MtpEventPacket.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/media/mtp/MtpEventPacket.h b/media/mtp/MtpEventPacket.h new file mode 100644 index 0000000..30ae869 --- /dev/null +++ b/media/mtp/MtpEventPacket.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#ifndef _MTP_EVENT_PACKET_H +#define _MTP_EVENT_PACKET_H + +#include "MtpPacket.h" +#include "mtp.h" + +namespace android { + +class MtpEventPacket : public MtpPacket { + +public: + MtpEventPacket(); + virtual ~MtpEventPacket(); + +#ifdef MTP_DEVICE + // write our data to the given file descriptor + int write(int fd); +#endif + +#ifdef MTP_HOST + // read our buffer from the given endpoint + int read(struct usb_endpoint *ep); +#endif + + inline MtpEventCode getEventCode() const { return getContainerCode(); } + inline void setEventCode(MtpEventCode code) + { return setContainerCode(code); } +}; + +}; // namespace android + +#endif // _MTP_EVENT_PACKET_H |