官术网_书友最值得收藏!

Testing your app all together

So far, we have set up and configured several parts of the puzzle—from Open NFC Android Edition to the Simulator, passing through the AVD and the Connection Center tool.

While these puzzle pieces are very important, we can't do much with the individual pieces. So, it's time to bring them all together.

Getting ready

The following are the settings required for this recipe:

  • Make sure you have downloaded Open NFC SDK Edition—refer to the Downloading Open NFC SDK Edition recipe
  • Make sure you have properly configured the Connection Center tool—refer to the Configuring the Connection Center tool recipe
  • Make sure you have properly configured an AVD—refer to the Configuring an NFC-enabled testing AVD recipe
  • It's assumed that the Open NFC SDK Edition Core is located at the NFCBook folder in your home directory and that the Android SDK location is known

How to do it…

We'll run everything and perform a simple test to make sure everything works properly before we start our first application:

  1. Start the Connection Center tool located in the Open NFC SDK Edition folder. You will receive a Waiting for a connection… message.
  2. Start the NFC Simulator tool located in the Open NFC SDK Edition folder. In the previously started Connection Center tool, we should see a Connected! message as shown in the following screenshot:
    How to do it…

    The Trace Server should be automatically started as well. We should now have the Connection Center tool, the NFC Controller Simulator, and the Trace Server running.

  3. Start the previously configured AVD by clicking on Start in the Android Virtual Device Manager located in the Android SDK folder.
  4. Once the AVD has started, we should see the following (or similar) information in the previously started tools:
    • In the Connection Center tool, we should start seeing the following NFC Controller-connected messages:
      How to do it…
    • In the Trace Server, we should start seeing a tree that shows the devices connected (on the left) and any activity in the log list, as shown in the following screenshot:
      How to do it…
    • In the NFC Controller Simulator, several orange lights should appear that indicate what communication standards the device supports, as shown in the following screenshot:
    How to do it…
  5. Now, we are going to do the final test. In the NFC Controller Simulator, double-click on [MIREFIRE_UL_TAG2_LOCKED] in the Object List panel.

    In the NFC Device #1 Antenna panel, a green light should appear, which means the tag was successfully dispatched to the simulator. In the simulator, the browser should be started. Now navigate to http://www.google.com/indexToFillSomeC, as shown in the following screenshot:

    How to do it…

How it works…

The Connection Center tool is the first to be started. It listens for connection requests; so, when the Simulator and the AVD start, they will try to connect to a listening server. If no listener is running, nothing happens.

In the Trace Server, we can see what's happening in the communication between the devices. The sent and received messages and communications errors can be found here.

In the Simulator, we can easily see when a device is connected by looking at the top-right box. Here, we find a lot of information such as the communication standard supported by the device, represented by the orange circles, and the standard used in the last communication, represented by the green circles. The Simulator tool provides many other features such as creating custom tags. There is a detailed manual on this in the Open NFC SDK Edition Core folder.

主站蜘蛛池模板: 永兴县| 郓城县| 伽师县| 乐平市| 吕梁市| 南宁市| 牙克石市| 内乡县| 崇礼县| 明溪县| 原阳县| 威远县| 北京市| 鄂托克旗| 隆尧县| 抚宁县| 德安县| 横峰县| 开封市| 凤城市| 广灵县| 东辽县| 锡林郭勒盟| 全州县| 禹州市| 岳普湖县| 香河县| 沙田区| 蓬安县| 翁牛特旗| 曲周县| 钦州市| 灵石县| 永德县| 松阳县| 伽师县| 茂名市| 永清县| 五常市| 买车| 繁峙县|