libnfc
1.8.0
|
NFC library implementation. More...
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
#include <nfc/nfc.h>
#include "nfc-internal.h"
#include "target-subr.h"
#include "drivers.h"
Go to the source code of this file.
Functions | |
static int | nfc_device_validate_modulation (nfc_device *pnd, const nfc_mode mode, const nfc_modulation *nm) |
Validate combination of modulation and baud rate on the currently used device. More... | |
int | nfc_register_driver (const struct nfc_driver *ndr) |
Register an NFC device driver with libnfc. This function registers a driver with libnfc, the caller is responsible of managing the lifetime of the driver and make sure that any resources associated with the driver are available after registration. More... | |
void | nfc_init (nfc_context **context) |
Initialize libnfc. This function must be called before calling any other libnfc function. More... | |
void | nfc_exit (nfc_context *context) |
Deinitialize libnfc. Should be called after closing all open devices and before your application terminates. More... | |
nfc_device * | nfc_open (nfc_context *context, const nfc_connstring connstring) |
Open a NFC device. More... | |
void | nfc_close (nfc_device *pnd) |
Close from a NFC device. More... | |
size_t | nfc_list_devices (nfc_context *context, nfc_connstring connstrings[], const size_t connstrings_len) |
Scan for discoverable supported devices (ie. only available for some drivers) More... | |
int | nfc_device_set_property_int (nfc_device *pnd, const nfc_property property, const int value) |
Set a device's integer-property value. More... | |
int | nfc_device_set_property_bool (nfc_device *pnd, const nfc_property property, const bool bEnable) |
Set a device's boolean-property value. More... | |
int | nfc_initiator_init (nfc_device *pnd) |
Initialize NFC device as initiator (reader) More... | |
int | nfc_initiator_init_secure_element (nfc_device *pnd) |
Initialize NFC device as initiator with its secure element as target (reader) More... | |
int | nfc_initiator_select_passive_target (nfc_device *pnd, const nfc_modulation nm, const uint8_t *pbtInitData, const size_t szInitData, nfc_target *pnt) |
Select a passive or emulated tag. More... | |
int | nfc_initiator_list_passive_targets (nfc_device *pnd, const nfc_modulation nm, nfc_target ant[], const size_t szTargets) |
List passive or emulated tags. More... | |
int | nfc_initiator_poll_target (nfc_device *pnd, const nfc_modulation *pnmModulations, const size_t szModulations, const uint8_t uiPollNr, const uint8_t uiPeriod, nfc_target *pnt) |
Polling for NFC targets. More... | |
int | nfc_initiator_select_dep_target (nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout) |
Select a target and request active or passive mode for D.E.P. (Data Exchange Protocol) More... | |
int | nfc_initiator_poll_dep_target (struct nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout) |
Poll a target and request active or passive mode for D.E.P. (Data Exchange Protocol) More... | |
int | nfc_initiator_transceive_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, int timeout) |
Send data to target then retrieve data from target. More... | |
int | nfc_initiator_transceive_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar) |
Transceive raw bit-frames to a target. More... | |
int | nfc_initiator_transceive_bytes_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, uint32_t *cycles) |
Send data to target then retrieve data from target. More... | |
int | nfc_initiator_target_is_present (nfc_device *pnd, const nfc_target *pnt) |
Check target presence. More... | |
int | nfc_initiator_transceive_bits_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar, uint32_t *cycles) |
Transceive raw bit-frames to a target. More... | |
int | nfc_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, int timeout) |
Initialize NFC device as an emulated tag. More... | |
int | nfc_idle (nfc_device *pnd) |
Turn NFC device in idle mode. More... | |
int | nfc_abort_command (nfc_device *pnd) |
Abort current running command. More... | |
int | nfc_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout) |
Send bytes and APDU frames. More... | |
int | nfc_target_receive_bytes (nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, int timeout) |
Receive bytes and APDU frames. More... | |
int | nfc_target_send_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar) |
Send raw bit-frames. More... | |
int | nfc_target_receive_bits (nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar) |
Receive bit-frames. More... | |
const char * | nfc_strerror (const nfc_device *pnd) |
Return the last error string. More... | |
int | nfc_strerror_r (const nfc_device *pnd, char *pcStrErrBuf, size_t szBufLen) |
Renders the last error in pcStrErrBuf for a maximum size of szBufLen chars. More... | |
void | nfc_perror (const nfc_device *pnd, const char *pcString) |
Display the last error occured on a nfc_device. More... | |
int | nfc_device_get_last_error (const nfc_device *pnd) |
Returns last error occured on a nfc_device. More... | |
const char * | nfc_device_get_name (nfc_device *pnd) |
Returns the device name. More... | |
const char * | nfc_device_get_connstring (nfc_device *pnd) |
Returns the device connection string. More... | |
int | nfc_device_get_supported_modulation (nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt) |
Get supported modulations. More... | |
int | nfc_device_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br) |
Get supported baud rates (initiator mode). More... | |
int | nfc_device_get_supported_baud_rate_target_mode (nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br) |
Get supported baud rates for target mode. More... | |
const char * | nfc_version (void) |
Returns the library version. More... | |
void | nfc_free (void *p) |
Free buffer allocated by libnfc. More... | |
int | nfc_device_get_information_about (nfc_device *pnd, char **buf) |
Print information about NFC device. More... | |
const char * | str_nfc_baud_rate (const nfc_baud_rate nbr) |
Convert nfc_baud_rate value to string. More... | |
const char * | str_nfc_modulation_type (const nfc_modulation_type nmt) |
Convert nfc_modulation_type value to string. More... | |
int | str_nfc_target (char **buf, const nfc_target *pnt, bool verbose) |
Convert nfc_target content to string. More... | |
NFC library implementation.
Definition in file nfc.c.