//int connstring_decode(const nfc_connstring connstring, const char *driver_name, const char *bus_name, char **pparam1, char **pparam2); protected static nfc_context nfc_context_new() { nfc_context res = new nfc_context(); // Set default context values res.allow_autoscan = true; res.allow_intrusive_scan = false; if (true) { //if debug res.log_level = 3; } else { res.log_level = 1; } // Clear user defined devices array for (int i = 0; i < MAX_USER_DEFINED_DEVICES; i++) { res.user_defined_devices[i].name = ""; res.user_defined_devices[i].connstring = ""; res.user_defined_devices[i].optional = false; } res.user_defined_device_count = 0; /* #ifdef CONFFILES * // Load options from configuration file (ie. /etc/nfc/libnfc.conf) * conf_load(res); #endif // CONFFILES */ /* * // Initialize log before use it... * log_init(res); * * // Debug context state * if(DEBUG){ * log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_NONE, "log_level is set to %"PRIu32, res->log_level); * * }else{ * log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "log_level is set to %"PRIu32, res->log_level); * } * * log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "allow_autoscan is set to %s", (res->allow_autoscan) ? "true" : "false"); * log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "allow_intrusive_scan is set to %s", (res->allow_intrusive_scan) ? "true" : "false"); * * log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%d device(s) defined by user", res->user_defined_device_count); * * for (UInt32 i = 0; i < res.user_defined_device_count; i++) { * log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, " #%d name: \"%s\", connstring: \"%s\"", i, res->user_defined_devices[i].name, res->user_defined_devices[i].connstring); * } * */ return(res); }
/* NFC Device/Hardware manipulation */ /// <summary> /// nfc_open /// </summary> /// <param name="context"></param> /// <param name="port"></param> /// <returns></returns> public static nfc_device nfc_open(nfc_context context, string port) { nfc_device dev = pn532_uart.getInstance().open(context, port); if (null == dev) {//log error handle } else { } return(dev); }
public static nfc_device nfc_device_new(nfc_context context, string connstring) { nfc_device res = new nfc_device(); // Store associated context res.context = context; // Variables initiatialization // Note: Actually, these initialization will be overwritten while the device // will be setup. Putting them to _false_ while the default is _true_ ensure we // send the command to the chip res.bCrc = false; res.bPar = false; res.bEasyFraming = false; res.bInfiniteSelect = false; res.bAutoIso14443_4 = false; res.last_error = 0; res.connstring = connstring; res.driver_data = null; res.chip_data = null; return(res); }
public static void nfc_exit(nfc_context context) { return; }
///pn532_uart is being used, if multiple driver can be used, then use nfc-driver as abstract driver. /* Library initialization/deinitialization */ /// <summary> /// nfc_init /// </summary> /// <param name="context"></param> public static void nfc_init(ref nfc_context context) { context = nfc_context_new(); //TODO Init Driver }
protected void nfc_context_free(nfc_context context) { }