blob: 61ae4b7aeed9f82deabb08ed47ba5bd926ae7953 [file] [log] [blame]
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -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 *
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -05008 * http://www.apache.org/licenses/LICENSE-2.0
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -04009 *
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.
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040015 */
16
17#ifndef _MTP_DEBUG_H
18#define _MTP_DEBUG_H
19
20// #define LOG_NDEBUG 0
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040021#include "MtpTypes.h"
22
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -050023#include <log/log.h>
24
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040025#ifdef __cplusplus
26extern "C" {
27#endif
28void mtpdebug(const char *fmt, ...);
29
Matt Mowerff2c6b22017-02-14 20:57:36 -060030#define MTPI(...) fprintf(stdout, "I:[MTP] " __VA_ARGS__)
31#define MTPD(...) mtpdebug("D:[MTP] " __VA_ARGS__)
32#define MTPE(...) fprintf(stdout, "E:[MTP] " __VA_ARGS__)
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040033
34#ifdef __cplusplus
35}
36#endif
37
38class MtpDebug {
39public:
40 static const char* getOperationCodeName(MtpOperationCode code);
41 static const char* getFormatCodeName(MtpObjectFormat code);
42 static const char* getObjectPropCodeName(MtpPropertyCode code);
43 static const char* getDevicePropCodeName(MtpPropertyCode code);
Ethan Yonker6d154c42014-09-03 14:19:43 -050044 static void enableDebug();
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040045};
46
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040047#endif // _MTP_DEBUG_H