• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 ESE_APP_RESULT_H_
18 #define ESE_APP_RESULT_H_ 1
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // EseAppResult is structured with the low order bits being
25 // the enum below and the high order bits being a short
26 // from the applet when the code is ERROR_OS or ERROR_APPLET.
27 typedef enum {
28   ESE_APP_RESULT_FALSE,
29   ESE_APP_RESULT_OK = ESE_APP_RESULT_FALSE,
30   ESE_APP_RESULT_TRUE = 1,
31   ESE_APP_RESULT_ERROR_ARGUMENTS,
32   ESE_APP_RESULT_ERROR_COMM_FAILED,
33   ESE_APP_RESULT_ERROR_OS,
34   ESE_APP_RESULT_ERROR_APPLET,
35   ESE_APP_RESULT_ERROR_UNCONFIGURED,
36   ESE_APP_RESULT_ERROR_COOLDOWN,
37 } EseAppResult;
38 
39 #define EseAppResultValue(_res) (res & 0xffff)
40 #define EseAppResultAppValue(_res) (res >> 16)
41 #define ese_make_os_result(_app_hi, _app_lo) \
42   ((((_app_hi) << 8 | (_app_lo)) << 16) | (ESE_APP_RESULT_ERROR_OS))
43 #define ese_make_app_result(_app_hi, _app_lo) \
44   ((((_app_hi) << 8 | (_app_lo)) << 16) | (ESE_APP_RESULT_ERROR_APPLET))
45 
46 #ifdef __cplusplus
47 }  /* extern "C" */
48 #endif
49 
50 #endif  /* ESE_APP_RESULT_H_ */
51