Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 1 | /* |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 2 | * Copyright (C) 2010, The Android Open Source Project |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 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 | * |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [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. |
| 15 | */ |
| 16 | |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 17 | package android.nfc; |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * This class defines all the error codes that can be returned by the service |
| 21 | * and producing an exception on the application level. These are needed since |
| 22 | * binders does not support exceptions. |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 23 | * |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 24 | * @hide |
| 25 | */ |
| 26 | public class ErrorCodes { |
| 27 | |
| 28 | public static boolean isError(int code) { |
| 29 | if (code < 0) { |
| 30 | return true; |
| 31 | } else { |
| 32 | return false; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | public static final int SUCCESS = 0; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 37 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 38 | public static final int ERROR_IO = -1; |
| 39 | |
| 40 | public static final int ERROR_CANCELLED = -2; |
| 41 | |
| 42 | public static final int ERROR_TIMEOUT = -3; |
| 43 | |
| 44 | public static final int ERROR_BUSY = -4; |
| 45 | |
| 46 | public static final int ERROR_CONNECT = -5; |
| 47 | |
| 48 | public static final int ERROR_DISCONNECT = -5; |
| 49 | |
| 50 | public static final int ERROR_READ = -6; |
| 51 | |
| 52 | public static final int ERROR_WRITE = -7; |
| 53 | |
| 54 | public static final int ERROR_INVALID_PARAM = -8; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 55 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 56 | public static final int ERROR_INSUFFICIENT_RESOURCES = -9; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 57 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 58 | public static final int ERROR_SOCKET_CREATION = -10; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 59 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 60 | public static final int ERROR_SOCKET_NOT_CONNECTED = -11; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 61 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 62 | public static final int ERROR_BUFFER_TO_SMALL = -12; |
| 63 | |
| 64 | public static final int ERROR_SAP_USED = -13; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 65 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 66 | public static final int ERROR_SERVICE_NAME_USED = -14; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 67 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 68 | public static final int ERROR_SOCKET_OPTIONS = -15; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 69 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 70 | public static final int ERROR_NFC_ON = -16; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 71 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 72 | public static final int ERROR_NOT_INITIALIZED = -17; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 73 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 74 | public static final int ERROR_SE_ALREADY_SELECTED = -18; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 75 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 76 | public static final int ERROR_SE_CONNECTED = -19; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 77 | |
Nick Pelly | 038cabe | 2010-09-23 16:12:11 -0700 | [diff] [blame] | 78 | public static final int ERROR_NO_SE_CONNECTED = -20; |
Nick Pelly | 590b73b | 2010-10-12 13:00:50 -0700 | [diff] [blame^] | 79 | |
| 80 | } |