|
| 1 | +.. _nfc_rpc: |
| 2 | + |
| 3 | +NFC Remote Procedure Call |
| 4 | +######################### |
| 5 | + |
| 6 | +.. contents:: |
| 7 | + :local: |
| 8 | + :depth: 2 |
| 9 | + |
| 10 | +The :ref:`NFC <ug_nfc>` Remote Procedure Call (RPC) solution is a set of libraries that allows using the NFC stack running entirely on a separate device or CPU. |
| 11 | + |
| 12 | +Overview |
| 13 | +******** |
| 14 | + |
| 15 | +The solution allows calling the NFC API (both :ref:`Type 2 Tag <lib_nfc_t2t>` and :ref:`Type 4 Tag <lib_nfc_t4t>`) on a different CPU or device. |
| 16 | +This is accomplished by running the full NFC functionality on one device and serializing the API from another device. |
| 17 | +Use this solution when you do not want your firmware to include the NFC stack, for example to offload the application CPU, save memory, or to be able to build your application in a different environment. |
| 18 | + |
| 19 | +Implementation |
| 20 | +============== |
| 21 | + |
| 22 | +The NFC RPC solution consists of the following components: |
| 23 | + |
| 24 | + * NFC RPC Client and common software libraries. |
| 25 | + These libraries serialize the NFC API and enable RPC communication, and need to be part of the user application. |
| 26 | + * NFC RPC Server, common libraries, and the Type 4 Tag library, Type 2 Tag library, or both. |
| 27 | + These libraries enable communication with NFC RPC Client, and need to run on a device or CPU that has an NFC radio hardware peripheral. |
| 28 | + |
| 29 | +You can add support for serializing NFC-related custom APIs by implementing your own client and server procedures. |
| 30 | +You can use the following files as examples: |
| 31 | + |
| 32 | + * :file:`subsys/nfc/rpc/client/nfc_rpc_t2t_client.c` |
| 33 | + * :file:`subsys/nfc/rpc/server/nfc_rpc_t2t_server.c` |
| 34 | + |
| 35 | +Requirements |
| 36 | +************ |
| 37 | + |
| 38 | +These configuration options must be enabled to use the library: |
| 39 | + |
| 40 | + * :kconfig:option:`CONFIG_NFC_RPC` |
| 41 | + * :kconfig:option:`CONFIG_NFC_RPC_CLIENT` - for the NFC RPC client |
| 42 | + * :kconfig:option:`CONFIG_NFC_RPC_SERVER` - for the NFC RPC server |
| 43 | + |
| 44 | +These configuration options related to NFC Data Exchange Format must be enabled on the client for the Type 4 Tag: |
| 45 | + |
| 46 | + * :kconfig:option:`CONFIG_NFC_NDEF` |
| 47 | + * :kconfig:option:`CONFIG_NFC_NDEF_MSG` |
| 48 | + * :kconfig:option:`CONFIG_NFC_NDEF_RECORD` |
| 49 | + * :kconfig:option:`CONFIG_NFC_NDEF_TEXT_RECORD` |
| 50 | + |
| 51 | +These configuration options related to NFC must be enabled on the server: |
| 52 | + |
| 53 | + * :kconfig:option:`CONFIG_NFC_T2T_NRFXLIB` - for Type 2 Tag |
| 54 | + * :kconfig:option:`CONFIG_NFC_T4T_NRFXLIB` - for Type 4 Tag |
| 55 | + |
| 56 | +Samples using the library |
| 57 | +************************* |
| 58 | + |
| 59 | +The following |NCS| samples use this library: |
| 60 | + |
| 61 | +* :ref:`nrf_rpc_protocols_serialization_client` |
| 62 | +* :ref:`nrf_rpc_protocols_serialization_server` |
| 63 | + |
| 64 | +Limitations |
| 65 | +*********** |
| 66 | + |
| 67 | +The library currently supports serialization of the following: |
| 68 | + |
| 69 | + * :ref:`nrfxlib:type_2_tag` |
| 70 | + * :ref:`nrfxlib:type_4_tag` |
| 71 | + |
| 72 | +The behavior of NFC with RPC is almost the same as without it, with the following exceptions: |
| 73 | + |
| 74 | + * Some NFC API functions get data by pointer, for example :c:func:`nfc_t4t_ndef_rwpayload_set`. |
| 75 | + After calling the functions on the client, the data is sent to the server. |
| 76 | + Any manipulation of data over the pointer will not affect the server's data instance. |
| 77 | + * Even though the maximum payload for Type 4 Tag can be 65520 bytes, the real length is limited by :c:macro:`NDEF_FILE_SIZE`. |
| 78 | + |
| 79 | +Dependencies |
| 80 | +************ |
| 81 | + |
| 82 | +The library has the following dependencies: |
| 83 | + |
| 84 | + * :ref:`nrf_rpc` |
| 85 | + * :ref:`nfc` |
| 86 | + |
| 87 | +.. _nfc_rpc_api: |
| 88 | + |
| 89 | +API documentation |
| 90 | +***************** |
| 91 | + |
| 92 | +This library does not define a new NFC API. |
| 93 | + |
| 94 | +| Header files: :file:`nrfxlib/nfc/include/nfc_t2t_lib.h`, :file:`nrfxlib/nfc/include/nfc_t4t_lib.h` |
| 95 | +| Source files: :file:`subsys/nfc/rpc/` |
0 commit comments