libnfc  1.7.1
Functions
NFC Device/Hardware manipulation

Functions

nfc_devicenfc_open (nfc_context *context, const nfc_connstring connstring)
 Open a NFC device.
void nfc_close (nfc_device *pnd)
 Close from a NFC device.
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)
int nfc_idle (nfc_device *pnd)
 Turn NFC device in idle mode.
int nfc_abort_command (nfc_device *pnd)
 Abort current running command.

Detailed Description

The functionality documented below is designed to help with the following operations:


Function Documentation

int nfc_abort_command ( nfc_device pnd)

Abort current running command.

Returns:
Returns 0 on success, otherwise returns libnfc's error code.
Parameters:
pndnfc_device struct pointer that represent currently used device

Some commands (ie. nfc_target_init()) are blocking functions and will return only in particular conditions (ie. external initiator request). This function attempt to abort the current running command.

Note:
The blocking function (ie. nfc_target_init()) will failed with DEABORT error.

Definition at line 991 of file nfc.c.

void nfc_close ( nfc_device pnd)

Close from a NFC device.

Parameters:
pndnfc_device struct pointer that represent currently used device

Initiator's selected tag is closed and the device, including allocated nfc_device struct, is released.

Definition at line 300 of file nfc.c.

int nfc_idle ( nfc_device pnd)

Turn NFC device in idle mode.

Returns:
Returns 0 on success, otherwise returns libnfc's error code.
Parameters:
pndnfc_device struct pointer that represent currently used device

This function switch the device in idle mode. In initiator mode, the RF field is turned off and the device is set to low power mode (if avaible); In target mode, the emulation is stoped (no target available from external initiator) and the device is set to low power mode (if avaible).

Definition at line 974 of file nfc.c.

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)

Returns:
Returns the number of devices found.
Parameters:
contextThe context to operate on, or NULL for the default context.
connstringsarray of nfc_connstring.
connstrings_lensize of the connstrings array.

Definition at line 317 of file nfc.c.

nfc_device* nfc_open ( nfc_context context,
const nfc_connstring  connstring 
)

Open a NFC device.

Parameters:
contextThe context to operate on.
connstringThe device connection string if specific device is wanted, NULL otherwise
Returns:
Returns pointer to a nfc_device struct if successfull; otherwise returns NULL value.

If connstring is NULL, the first available device from nfc_list_devices function is used.

If connstring is set, this function will try to claim the right device using information provided by connstring.

When it has successfully claimed a NFC device, memory is allocated to save the device information. It will return a pointer to a nfc_device struct. This pointer should be supplied by every next functions of libnfc that should perform an action with this device.

Note:
Depending on the desired operation mode, the device needs to be configured by using nfc_initiator_init() or nfc_target_init(), optionally followed by manual tuning of the parameters if the default parameters are not suiting your goals.

Definition at line 238 of file nfc.c.