入门打开NFC模拟器 [英] Getting started with Open NFC emulator

查看:285
本文介绍了入门打开NFC模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开始使用开发NFC应用程序为Android。我已经开始与Android最近,我发现这是一个非常有趣的平台来开发。在我走出去,投资在Android设备有一个内置的NFC读写器和标签的购买,我想了解如何人真正写code对他们的感觉。

我发现它似乎并是什么,我的打开NFC Android模拟器寻找。我已经下载: 1.打开NFC为Android 2.打开NFC核​​心版

在创建AVD,对于开放式NFC,我跟着指示。

现在的问题,我面对的是,在模拟器,当我去到无线设置,然后启用NFC,它说,有一个错误。我曾尝试设置IP为10.0.2.2,也是我从IPCONFIG但无济于事获取IP。有没有日志,我可以看到。 此外,我已经试过完全在运行,以便它不会因意外受阻禁用防火墙。

作为一个方面说明,我想提一提,我有连接管理器开始之前,我启动模拟器。

没有任何人有与Open NFC Android的经验,如果有人可以点我到一个更好的指令集,我将感激不尽相反,如果有人能提出另一个模拟器通过它我可以尝试一些样品code和获取有关NFC更深入的了解。

在亚行logcat的输出为

  W / KeyCharacterMap(165):没有键盘ID 0
W / KeyCharacterMap(165):使用默认的键盘对应:/system/usr/keychars/qwerty.kcm.bin
D / NfcSettings(165):在preferenceChange:设置NFC键:nfc_cc_ip
D / NfcSettings(165):在preferenceChange:NFC设定值:10.0.2.2
D / NfcSettings(165):在preferenceChange:设置系统NFC NFC_CC_IP:10.0.2.2
D / NfcSettings(165):在preferenceChange:设置NFC键:nfc_hal_mode_list
D / NfcSettings(165):在preferenceChange:NFC设定值:1
D / NfcSettings(165):在preferenceChange:设置NFC米preferenceNfcHalMode:模拟器:1
D / NfcSettings(165):在preferenceChange:设置系统NFC NFC_HAL_MODE:1
W / InputManagerService(68):窗口已经集中,忽略了聚焦增益:com.android.internal.view.IInputMethodClient$Stub$Proxy@406df430
D / NfcEnabler(165):设置NFC功能状态:真正的
D / OpenNFCService(250):启用NFC。 previous = FALSE
D / OpenNFCService(250):mIsNfcEnabled NFC = FALSE
D / OpenNFCService(250):_ENABLE =真
D / OpenNFCService(250):IOpenNFCService:setNFCEnabled(真)
D / OpenNFCService(250):无效的IP地址
D / OpenNFCService(250):无法创建配置!
D / OpenNFCService(250):updateNfcOnSetting:假的
D / OpenNFCService(250):_enabletrue的NFC成功)是假的
D / OpenNFCService(250):$$$ NFC $$$将连接! $$$ NFC $$$
W / NfcEnabler(165):错误NFC功能的状态设置为true
 

我得到同样的错误,当我更改IP与IPCONFIG获得的之一。

  D / NfcSettings(165):在preferenceChange:设置NFC键:nfc_cc_ip
D / NfcSettings(165):在preferenceChange:NFC设定值:114.31.179.86
D / NfcSettings(165):在preferenceChange:设置系统NFC NFC_CC_IP:114.31.179.86
D / NfcEnabler(165):设置NFC功能状态:真正的
D / OpenNFCService(250):启用NFC。 previous = FALSE
D / OpenNFCService(250):mIsNfcEnabled NFC = FALSE
D / OpenNFCService(250):_ENABLE =真
D / OpenNFCService(250):IOpenNFCService:setNFCEnabled(真)
D / OpenNFCService(250):无效的IP地址
D / OpenNFCService(250):无法创建配置!
D / OpenNFCService(250):updateNfcOnSetting:假的
D / OpenNFCService(250):_enabletrue的NFC成功)是假的
D / OpenNFCService(250):$$$ NFC $$$将连接! $$$ NFC $$$
W / NfcEnabler(165):错误NFC功能的状态设置为true
 

解决方案

@nikhil: 感谢您的链接,以TCP回声服务器。我得到了我的OpenNFC堆栈上运行回声服务器后工作。这样其他用户就可以从这项工作中受益,这里是做什么来设置OpenNFC堆栈与NFC控制器摘要(NFCC)模拟器。

- 堆栈(与NFCC仿真器)支持的 Windows主机仅上,因为两者的连接中心和NFCC模拟器都是Windows应用程序。

- 需要下载所有3包

  1. <一个href="http://sourceforge.net/projects/open-nfc/files/Open%20NFC%204.3%20beta%20%2810381%29/Open%20NFC%20for%20Android%20SDK%20Addon%20v4.3.0%20%2810381%29.zip/download">OpenNFC Android的SDK插件
  2. <一个href="http://sourceforge.net/projects/open-nfc/files/Open%20NFC%204.3.0%20%2810877%29/Open%20NFC%20-%20Core%20Edition%20v4.3.0%20%2810877%29.zip/download">OpenNFC核心版,具有连接中心和NFCC模拟器的应用程序。
  3. 回声服务器: EchoTool

- 安装的SDK插件,和使用SDK插件创建一个AVD

- 启动连接中心(运行连接Center.exe),并配置它接受来自其他机器的客户端连接。

- 启动NFCC模拟器(运行NfcSimulator.exe)

- 启动回显服务器(端口7),使用CMD:echotool /对TCP / s的7

- 使用AVD刚刚创建启动Android模拟器

- 从仿真器中,选择设置 - >无线和网络 - > NFC设置

- 在IP连接中心进入10.0.2.2

- 选择模拟器NFC HAL实施

! - 现在点击NFC切换(复选框),启动NFC堆栈

I would like to get started with developing NFC apps for android. I have started with android recently and I'm finding it a very interesting platform to develop for. Before I go out and invest in an Android device that has a built in NFC reader and purchase tags, I would like to get a feel of how one actually writes code for them.

I found the Open NFC Android emulator and it appears to be what I'm looking for. I have downloaded : 1. The Open NFC for Android 2. The Open NFC core Edition

After creating an avd that for Open NFC, I followed the instructions.

Now the problem that I face is that in the emulator, when I go to the Wireless Settings and then I enable NFC, It says that there was an error. I have tried setting the IP to 10.0.2.2 and also the IP that I get from ipconfig but to no avail. There's no log that I can see. Also I have tried to disable the firewall completely while running it so that it doesn't get blocked accidentally.

As a side note, I would like to mention that I have the Connection Manager Started before I launch the emulator.

Does anybody have experience with Open NFC for Android, If somebody can point me to a better set of instructions I'd be most grateful alternatively If someone could suggest another simulator by which I can try out some sample code and get a better understanding about NFC.

The output of the adb logcat is

W/KeyCharacterMap(  165): No keyboard for id 0
W/KeyCharacterMap(  165): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
D/NfcSettings(  165): onPreferenceChange: Setting NFC key: nfc_cc_ip
D/NfcSettings(  165): onPreferenceChange: Setting NFC value: 10.0.2.2
D/NfcSettings(  165): onPreferenceChange: Setting System NFC NFC_CC_IP: 10.0.2.2
D/NfcSettings(  165): onPreferenceChange: Setting NFC key: nfc_hal_mode_list
D/NfcSettings(  165): onPreferenceChange: Setting NFC value: 1
D/NfcSettings(  165): onPreferenceChange: Setting NFC mPreferenceNfcHalMode: SIMULATOR:1
D/NfcSettings(  165): onPreferenceChange: Setting System NFC NFC_HAL_MODE: 1
W/InputManagerService(   68): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@406df430
D/NfcEnabler(  165): Setting NFC enabled state to: true
D/OpenNFCService(  250): Enabling NFC.  previous =false
D/OpenNFCService(  250): mIsNfcEnabled NFC =false
D/OpenNFCService(  250): _enable =true
D/OpenNFCService(  250): IOpenNFCService:setNFCEnabled(true)
D/OpenNFCService(  250): Invalid IP address
D/OpenNFCService(  250): can't create configuration !
D/OpenNFCService(  250): updateNfcOnSetting: false
D/OpenNFCService(  250): NFC success of _enabletrue) is false
D/OpenNFCService(  250): $$$NFC$$$ Will connect ! $$$NFC$$$
W/NfcEnabler(  165): Error setting NFC enabled state to true

I get the same error when I change the IP to the one obtained with ipconfig.

D/NfcSettings(  165): onPreferenceChange: Setting NFC key: nfc_cc_ip
D/NfcSettings(  165): onPreferenceChange: Setting NFC value: 114.31.179.86
D/NfcSettings(  165): onPreferenceChange: Setting System NFC NFC_CC_IP: 114.31.179.86
D/NfcEnabler(  165): Setting NFC enabled state to: true
D/OpenNFCService(  250): Enabling NFC.  previous =false
D/OpenNFCService(  250): mIsNfcEnabled NFC =false
D/OpenNFCService(  250): _enable =true
D/OpenNFCService(  250): IOpenNFCService:setNFCEnabled(true)
D/OpenNFCService(  250): Invalid IP address
D/OpenNFCService(  250): can't create configuration !
D/OpenNFCService(  250): updateNfcOnSetting: false
D/OpenNFCService(  250): NFC success of _enabletrue) is false
D/OpenNFCService(  250): $$$NFC$$$ Will connect ! $$$NFC$$$
W/NfcEnabler(  165): Error setting NFC enabled state to true

解决方案

@nikhil: Thanks for the link to TCP Echo Server. I got my OpenNFC stack to work after running the echo server. So that other users can benefit from this exercise, here's a summary of what to do to set up the OpenNFC stack with the NFC controller (NFCC) simulator.

--The stack (with NFCC simulator) is supported on Windows host only, since both the Connection Center and the NFCC simulator are Windows apps.

--Need to download all 3 packages:

  1. OpenNFC Android SDK addon
  2. OpenNFC core Edition, which has the Connection Center and the NFCC simulator apps.
  3. The echo server: EchoTool

--Install the SDK addon, and create an AVD using the SDK Addon.

--start Connection Center (run "Connection Center.exe") and config it to accept client connections from other machines.

--start NFCC simulator (run "NfcSimulator.exe").

--start echo server (on port 7), using the cmd: echotool /p tcp /s 7

--start Android emulator using the AVD just created.

--from the emulator, select Settings->Wireless & networks->NFC settings

--enter 10.0.2.2 in IP Connection Center

--select Simulator for NFC HAL implementation

--now click the NFC toggle (check box) to start the NFC stack!

这篇关于入门打开NFC模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆