Nfcd: Difference between revisions

From iPhone Development Wiki
(Formatting.)
No edit summary
Line 65: Line 65:
|}
|}


These are formatted into a JSON list i.e.
A command is send by using the key "command" which is set to the corresponding uint64_t value above.
i.e
<source lang='javascript'>
xpc_dictionary_set_uint64(xpc_dictionary, "command", <command here>")
</source>
see https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/xpc_dictionary_set_uint64.3.html


<source lang="javascript">{
==NFDaemon - (int)q_registerConnection:(XPCConnection) info:()==
    command = 1;
 
}</source>
==NFDaemon - (unsigned int)q_unregisterConnection:(XPCConnection)==
This functions checks for an existing controller for the
*[NFCardEmulationController embeddedCardEmulationController]
*[NFCardEmulationController UICCCardEmulationController]
*[NFSecureElementController seController]
*[NFFieldDetectController fieldDetectController]
Then when it finds the appropriate controller then calls the unregister function for it.

Revision as of 05:27, 28 September 2015

nfcd is a daemon running under the mobile user. It handles the communications between PassKit and the underlying hardware and libraries.

The core objects in it are:

  • NFDaemon
  • NFFieldDetectController
  • NFCoreTelephonyConnection
  • NFPowerManager
  • NFAbstractController
  • NFCardEmulationController
  • NFSecureElementController

NFDaemon - (void)XPCConnection:(id) didReceiveCommand:(id)

Launchd plist

{
    EnablePressuredExit = 1;
    EnableTransactions = 1;
    ExitTimeOut = 45;
    Label = "com.apple.nfcd";
    MachServices =     {
        "com.apple.nfcd" = 1;
    };
    ProcessType = Interactive;
    Program = "/usr/libexec/nfcd";
    UserName = mobile;
}

Where the XPC service is registered under the "com.apple.nfcd" name

Supported XPC Commands

ID Command
1 q_registerConnection:info:
2 q_unregisterConnection:
3-64 send command to SE controller
65 q_updateSecureElementPowerState
66 _seIsInRestrictedMode
67 restrictedModeChanged
68-239 callSEContoller
240 setDeviceString
241 q_getControllerInfo
242 q_getSecureElementInfo
243 q_getBoosterInfo
244 q_readBoosterRegister
245 q_sendBoosterCommand
246 q_triggerAssertion
>247 throw error

A command is send by using the key "command" which is set to the corresponding uint64_t value above. i.e

xpc_dictionary_set_uint64(xpc_dictionary, "command", <command here>")

see https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/xpc_dictionary_set_uint64.3.html

NFDaemon - (int)q_registerConnection:(XPCConnection) info:()

NFDaemon - (unsigned int)q_unregisterConnection:(XPCConnection)

This functions checks for an existing controller for the

  • [NFCardEmulationController embeddedCardEmulationController]
  • [NFCardEmulationController UICCCardEmulationController]
  • [NFSecureElementController seController]
  • [NFFieldDetectController fieldDetectController]

Then when it finds the appropriate controller then calls the unregister function for it.