Home | History | Annotate | Download | only in nfc
      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  *
      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 package com.android.nfc;
     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.
     23  */
     24 public class ErrorCodes {
     25 
     26     public static boolean isError(int code) {
     27         if (code < 0) {
     28             return true;
     29         } else {
     30             return false;
     31         }
     32     }
     33 
     34     public static final int SUCCESS = 0;
     35 
     36     public static final int ERROR_IO = -1;
     37 
     38     public static final int ERROR_CANCELLED = -2;
     39 
     40     public static final int ERROR_TIMEOUT = -3;
     41 
     42     public static final int ERROR_BUSY = -4;
     43 
     44     public static final int ERROR_CONNECT = -5;
     45 
     46     public static final int ERROR_DISCONNECT = -5;
     47 
     48     public static final int ERROR_READ = -6;
     49 
     50     public static final int ERROR_WRITE = -7;
     51 
     52     public static final int ERROR_INVALID_PARAM = -8;
     53 
     54     public static final int ERROR_INSUFFICIENT_RESOURCES = -9;
     55 
     56     public static final int ERROR_SOCKET_CREATION = -10;
     57 
     58     public static final int ERROR_SOCKET_NOT_CONNECTED = -11;
     59 
     60     public static final int ERROR_BUFFER_TO_SMALL = -12;
     61 
     62     public static final int ERROR_SAP_USED = -13;
     63 
     64     public static final int ERROR_SERVICE_NAME_USED = -14;
     65 
     66     public static final int ERROR_SOCKET_OPTIONS = -15;
     67 
     68     public static final int ERROR_NFC_ON = -16;
     69 
     70     public static final int ERROR_NOT_INITIALIZED = -17;
     71 
     72     public static final int ERROR_SE_ALREADY_SELECTED = -18;
     73 
     74     public static final int ERROR_SE_CONNECTED = -19;
     75 
     76     public static final int ERROR_NO_SE_CONNECTED = -20;
     77 
     78 
     79 
     80 
     81 
     82 
     83 }
     84