bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 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 | * |
bigbiff bigbiff | af32bb9 | 2018-12-18 18:39:53 -0500 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 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. |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef _MTP_DEBUG_H |
| 18 | #define _MTP_DEBUG_H |
| 19 | |
| 20 | // #define LOG_NDEBUG 0 |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 21 | #include "MtpTypes.h" |
| 22 | |
bigbiff bigbiff | af32bb9 | 2018-12-18 18:39:53 -0500 | [diff] [blame] | 23 | #include <log/log.h> |
| 24 | |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | void mtpdebug(const char *fmt, ...); |
| 29 | |
Matt Mower | ff2c6b2 | 2017-02-14 20:57:36 -0600 | [diff] [blame] | 30 | #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 bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 33 | |
| 34 | #ifdef __cplusplus |
| 35 | } |
| 36 | #endif |
| 37 | |
| 38 | class MtpDebug { |
| 39 | public: |
| 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 Yonker | 6d154c4 | 2014-09-03 14:19:43 -0500 | [diff] [blame] | 44 | static void enableDebug(); |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 45 | }; |
| 46 | |
bigbiff bigbiff | c7eee6f | 2014-09-02 18:59:01 -0400 | [diff] [blame] | 47 | #endif // _MTP_DEBUG_H |