summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2024-06-20 16:51:14 +0900
committerChanwoo Choi <cw00.choi@samsung.com>2024-06-20 16:51:14 +0900
commit1e519193b65205ff66fcd340a7ad3b66997d4ec6 (patch)
treee91fc8b4f97df3bd035107368005909f743881e3
parent8604c36e00059b3c38e4b93b09031ee6bf7da692 (diff)
downloadnfc-1e519193b65205ff66fcd340a7ad3b66997d4ec6.tar.gz
nfc-1e519193b65205ff66fcd340a7ad3b66997d4ec6.tar.bz2
nfc-1e519193b65205ff66fcd340a7ad3b66997d4ec6.zip
Add support for HAL_MODULE_NFC v1.0 interface
HAL_MODULE_NFC will support the multiple version of HAL interface. So that v1.0 is first supported version of HAL_MODULE_NFC. hal-nfc-interface-1.h contains the v1.0 HAL interface. Change-Id: Ie1d36c138a636caae548f24f188eff97361607a7 Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-rw-r--r--CMakeLists.txt4
-rwxr-xr-xinclude/hal-nfc-interface-1.h103
-rwxr-xr-xinclude/hal-nfc-interface.h81
3 files changed, 105 insertions, 83 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eaa916f..81a8cc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,7 +46,5 @@ SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
CONFIGURE_FILE( ${PROJECT_NAME}.pc ${PROJECT_NAME}.pc @ONLY)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR}/hal)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-nfc.h DESTINATION ${INCLUDEDIR}/hal)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-nfc-interface.h DESTINATION ${INCLUDEDIR}/hal)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/hal-nfc-types.h DESTINATION ${INCLUDEDIR}/hal)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${INCLUDEDIR}/hal FILES_MATCHING PATTERN "hal-nfc*.h")
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)
diff --git a/include/hal-nfc-interface-1.h b/include/hal-nfc-interface-1.h
new file mode 100755
index 0000000..31f9113
--- /dev/null
+++ b/include/hal-nfc-interface-1.h
@@ -0,0 +1,103 @@
+/*
+ * HAL (Hardware Abstract Layer) NFC API
+ *
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __HAL_NFC_INTERFACE_1__
+#define __HAL_NFC_INTERFACE_1__
+
+#include <hal/hal-common-interface.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <hal-nfc-types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _hal_backend_nfc_funcs {
+ bool (*start)(net_nfc_error_e * result);;
+ bool (*stop)(void);
+ bool (*register_listener)(target_detection_listener_cb target_detection_listener, se_transaction_listener_cb se_transaction_listener, llcp_event_listener_cb llcp_event_listener, hce_apdu_listener_cb hce_apdu_listener, net_nfc_error_e * result);
+ bool (*unregister_listener)(void);
+ bool (*get_firmware_version)(data_s ** data, net_nfc_error_e * result);
+ bool (*support_nfc)(net_nfc_error_e * result);
+ bool (*check_firmware_version)(net_nfc_error_e * result);
+ bool (*update_firmware)(net_nfc_error_e * result);
+ bool (*get_stack_information)(net_nfc_stack_information_s * stack_info, net_nfc_error_e * result);
+ bool (*configure_discovery)(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e * result);
+ bool (*check_target_presence)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*connect)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*disconnect)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*check_ndef)(net_nfc_target_handle_s * handle, uint8_t * ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e * result);
+ bool (*read_ndef)(net_nfc_target_handle_s * handle, data_s ** data, net_nfc_error_e * result);
+ bool (*write_ndef)(net_nfc_target_handle_s * handle, data_s * data, net_nfc_error_e * result);
+ bool (*make_read_only_ndef)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*format_ndef)(net_nfc_target_handle_s * handle, data_s * secure_key, net_nfc_error_e * result);
+ bool (*transceive)(net_nfc_target_handle_s * handle, net_nfc_transceive_info_s * info, data_s ** data, net_nfc_error_e * result);
+ bool (*exception_handler)(void);
+ bool (*is_ready)(net_nfc_error_e * result);
+ bool (*llcp_config)(net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
+ bool (*llcp_check_llcp)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*llcp_activate_llcp)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*llcp_create_socket)(net_nfc_llcp_socket_t * socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_bind)(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result);
+ bool (*llcp_listen)(net_nfc_target_handle_s * handle, uint8_t * service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_accept)(net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_connect_by_url)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t * service_access_name, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_connect)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_disconnect)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_socket_close)(net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
+ bool (*llcp_recv)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_send)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_recv_from)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_send_to)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, uint8_t service_access_point, net_nfc_error_e * result, void *user_param);
+ bool (*llcp_reject)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
+ bool (*llcp_get_remote_config)(net_nfc_target_handle_s * handle, net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
+ bool (*llcp_get_remote_socket_info)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s * option, net_nfc_error_e * result);
+ bool (*secure_element_open)(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s ** handle, net_nfc_error_e * result);
+ bool (*secure_element_get_atr)(net_nfc_target_handle_s * handle, data_s ** atr, net_nfc_error_e * result);
+ bool (*secure_element_send_apdu)(net_nfc_target_handle_s * handle, data_s * command, data_s ** response, net_nfc_error_e * result);
+ bool (*secure_element_close)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
+ bool (*get_secure_element_list)(net_nfc_secure_element_info_s * list, int *count, net_nfc_error_e * result);
+ bool (*set_secure_element_mode)(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e * result);
+ bool (*sim_test)(net_nfc_error_e * result);
+ bool (*prbs_test)(net_nfc_error_e * result, uint32_t tech, uint32_t rate);
+ bool (*test_mode_on)(net_nfc_error_e * result);
+ bool (*test_mode_off)(net_nfc_error_e * result);
+ bool (*eedata_register_set)(net_nfc_error_e * result, uint32_t mode, uint32_t reg_id, data_s * data);
+ bool (*ese_test)(net_nfc_error_e * result);
+ bool (*test_set_se_tech_type)(net_nfc_error_e * result, net_nfc_se_type_e type, uint32_t tech);
+ bool (*hce_response_apdu)(net_nfc_target_handle_s * handle, data_s * response, net_nfc_error_e * result);
+ bool (*secure_element_route_aid)(data_s * aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e * result);
+ bool (*secure_element_unroute_aid)(data_s * aid, net_nfc_error_e * result);
+ bool (*secure_element_commit_routing)(net_nfc_error_e * result);
+ bool (*secure_element_set_default_route)(net_nfc_se_type_e switch_on, net_nfc_se_type_e switch_off, net_nfc_se_type_e battery_off, net_nfc_error_e * result);
+ bool (*secure_element_clear_aid_table)(net_nfc_error_e * result);
+ bool (*secure_element_get_aid_table_size)(int *AIDTableSize, net_nfc_error_e * result);
+ bool (*secure_element_set_route_entry)(net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e * result);
+ bool (*secure_element_clear_routing_entry)(net_nfc_se_entry_type_e type, net_nfc_error_e * result);
+ bool (*secure_element_set_listen_tech_mask)(net_nfc_se_tech_protocol_type_e screen_state, net_nfc_error_e * result);
+ bool (*set_screen_state)(net_nfc_screen_state_type_e screen_state, net_nfc_error_e * result);
+} hal_backend_nfc_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __HAL_NFC_INTERFACE_1__ */
diff --git a/include/hal-nfc-interface.h b/include/hal-nfc-interface.h
index 5e80c71..1ec4345 100755
--- a/include/hal-nfc-interface.h
+++ b/include/hal-nfc-interface.h
@@ -19,85 +19,6 @@
#ifndef __HAL_NFC_INTERFACE__
#define __HAL_NFC_INTERFACE__
-#include <hal/hal-common-interface.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <hal-nfc-types.h>
+#include <hal-nfc-interface-1.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _hal_backend_nfc_funcs {
- bool (*start)(net_nfc_error_e * result);;
- bool (*stop)(void);
- bool (*register_listener)(target_detection_listener_cb target_detection_listener, se_transaction_listener_cb se_transaction_listener, llcp_event_listener_cb llcp_event_listener, hce_apdu_listener_cb hce_apdu_listener, net_nfc_error_e * result);
- bool (*unregister_listener)(void);
- bool (*get_firmware_version)(data_s ** data, net_nfc_error_e * result);
- bool (*support_nfc)(net_nfc_error_e * result);
- bool (*check_firmware_version)(net_nfc_error_e * result);
- bool (*update_firmware)(net_nfc_error_e * result);
- bool (*get_stack_information)(net_nfc_stack_information_s * stack_info, net_nfc_error_e * result);
- bool (*configure_discovery)(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e * result);
- bool (*check_target_presence)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*connect)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*disconnect)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*check_ndef)(net_nfc_target_handle_s * handle, uint8_t * ndef_card_state, int *max_data_size, int *real_data_size, net_nfc_error_e * result);
- bool (*read_ndef)(net_nfc_target_handle_s * handle, data_s ** data, net_nfc_error_e * result);
- bool (*write_ndef)(net_nfc_target_handle_s * handle, data_s * data, net_nfc_error_e * result);
- bool (*make_read_only_ndef)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*format_ndef)(net_nfc_target_handle_s * handle, data_s * secure_key, net_nfc_error_e * result);
- bool (*transceive)(net_nfc_target_handle_s * handle, net_nfc_transceive_info_s * info, data_s ** data, net_nfc_error_e * result);
- bool (*exception_handler)(void);
- bool (*is_ready)(net_nfc_error_e * result);
- bool (*llcp_config)(net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
- bool (*llcp_check_llcp)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*llcp_activate_llcp)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*llcp_create_socket)(net_nfc_llcp_socket_t * socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e * result, void *user_param);
- bool (*llcp_bind)(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result);
- bool (*llcp_listen)(net_nfc_target_handle_s * handle, uint8_t * service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
- bool (*llcp_accept)(net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
- bool (*llcp_connect_by_url)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t * service_access_name, net_nfc_error_e * result, void *user_param);
- bool (*llcp_connect)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e * result, void *user_param);
- bool (*llcp_disconnect)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result, void *user_param);
- bool (*llcp_socket_close)(net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
- bool (*llcp_recv)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
- bool (*llcp_send)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
- bool (*llcp_recv_from)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, net_nfc_error_e * result, void *user_param);
- bool (*llcp_send_to)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, data_s * data, uint8_t service_access_point, net_nfc_error_e * result, void *user_param);
- bool (*llcp_reject)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_error_e * result);
- bool (*llcp_get_remote_config)(net_nfc_target_handle_s * handle, net_nfc_llcp_config_info_s * config, net_nfc_error_e * result);
- bool (*llcp_get_remote_socket_info)(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s * option, net_nfc_error_e * result);
- bool (*secure_element_open)(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s ** handle, net_nfc_error_e * result);
- bool (*secure_element_get_atr)(net_nfc_target_handle_s * handle, data_s ** atr, net_nfc_error_e * result);
- bool (*secure_element_send_apdu)(net_nfc_target_handle_s * handle, data_s * command, data_s ** response, net_nfc_error_e * result);
- bool (*secure_element_close)(net_nfc_target_handle_s * handle, net_nfc_error_e * result);
- bool (*get_secure_element_list)(net_nfc_secure_element_info_s * list, int *count, net_nfc_error_e * result);
- bool (*set_secure_element_mode)(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e * result);
- bool (*sim_test)(net_nfc_error_e * result);
- bool (*prbs_test)(net_nfc_error_e * result, uint32_t tech, uint32_t rate);
- bool (*test_mode_on)(net_nfc_error_e * result);
- bool (*test_mode_off)(net_nfc_error_e * result);
- bool (*eedata_register_set)(net_nfc_error_e * result, uint32_t mode, uint32_t reg_id, data_s * data);
- bool (*ese_test)(net_nfc_error_e * result);
- bool (*test_set_se_tech_type)(net_nfc_error_e * result, net_nfc_se_type_e type, uint32_t tech);
- bool (*hce_response_apdu)(net_nfc_target_handle_s * handle, data_s * response, net_nfc_error_e * result);
- bool (*secure_element_route_aid)(data_s * aid, net_nfc_se_type_e se_type, int power, net_nfc_error_e * result);
- bool (*secure_element_unroute_aid)(data_s * aid, net_nfc_error_e * result);
- bool (*secure_element_commit_routing)(net_nfc_error_e * result);
- bool (*secure_element_set_default_route)(net_nfc_se_type_e switch_on, net_nfc_se_type_e switch_off, net_nfc_se_type_e battery_off, net_nfc_error_e * result);
- bool (*secure_element_clear_aid_table)(net_nfc_error_e * result);
- bool (*secure_element_get_aid_table_size)(int *AIDTableSize, net_nfc_error_e * result);
- bool (*secure_element_set_route_entry)(net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e * result);
- bool (*secure_element_clear_routing_entry)(net_nfc_se_entry_type_e type, net_nfc_error_e * result);
- bool (*secure_element_set_listen_tech_mask)(net_nfc_se_tech_protocol_type_e screen_state, net_nfc_error_e * result);
- bool (*set_screen_state)(net_nfc_screen_state_type_e screen_state, net_nfc_error_e * result);
-} hal_backend_nfc_funcs;
-
-#ifdef __cplusplus
-}
-#endif
#endif /* __HAL_NFC_INTERFACE__ */