nfc1-sys
This crate provides low-level bindings to libnfc, generated by bindgen.
In contrast to nfc-sys, this crate additionally provides:
- Access to internal methods (such as
pn53x_*), which are useful for accessing manufacturer-specific features in NFC devices - Metadata which allows dependent crates to find the
nfc/nfc.hheader, compile native code that depends onlibnfcor link to it in Rust code. - Vendored submodule copy of
libnfc(with build tweaks forx86_64-pc-windows-msvc), which means you don't have to separately installlibnfcto use this crate. The vendoring is optional and can be disabled by removing thevendoredfeature.
Features
| Feature | Default? | Description |
|---|---|---|
| vendored | Yes | Use vendored libnfc, instead of installed one on the platform. |
| drivers | Yes | Add chip or driver specific symbols from vendored libnfc. |
| logging | No | Enables logging when using the vendored libnfc. |
| conffiles | No | Enables config files on vendored libnfc. |
| envvars | No | Enables environment variables on vendored libnfc. |
Usage
Add nfc1-sys as a dependency in your project's Cargo.toml file:
[]
= "0.3"
Import the nfc1_sys crate in your project, then you can use all functions starting with nfc_ from libnfc.
See the libnfc wiki or libnfc 1.8.0 examples for information on how to use it. The API is the same, as this is just a binding.
Usage example
Note that there is quite a lot of unsafe code here. This is because this is just a simple binding, not a safe wrapper.
extern crate nfc1_sys;
use CStr;
use MaybeUninit;
use ;