blob: fbbd388e89e75d517c3a11bb0c5dd9a90bcb9cdb [file] [log] [blame]
Mike Lockwood16864ba2010-05-11 17:16:59 -04001/*
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_CLIENT_H
18#define _MTP_CLIENT_H
19
20#include "MtpRequestPacket.h"
21#include "MtpDataPacket.h"
22#include "MtpResponsePacket.h"
23#include "mtp.h"
24
25#include "MtpUtils.h"
26
27class MtpClient {
28private:
29 struct usb_endpoint *mEndpointIn;
30 struct usb_endpoint *mEndpointOut;
31 struct usb_endpoint *mEndpointIntr;
32
33 // current session ID
34 MtpSessionID mSessionID;
35 // current transaction ID
36 MtpTransactionID mTransactionID;
37
38 MtpRequestPacket mRequest;
39 MtpDataPacket mData;
40 MtpResponsePacket mResponse;
41
42public:
43 MtpClient(struct usb_endpoint *ep_in, struct usb_endpoint *ep_out,
44 struct usb_endpoint *ep_intr);
45 virtual ~MtpClient();
46
47 bool openSession();
48 bool getDeviceInfo();
49 bool closeSession();
50
51private:
52 bool sendRequest(MtpOperationCode operation);
53 bool sendData(MtpOperationCode operation);
54 bool readData();
55 MtpResponseCode readResponse();
56
57};
58
59#endif // _MTP_CLIENT_H