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

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.

主站蜘蛛池模板: 宁波市| 卓资县| 南靖县| 镇平县| 乌海市| 醴陵市| 嘉荫县| 泾川县| 三门县| 南华县| 涟水县| 平潭县| 寿宁县| 水富县| 南涧| 安图县| 重庆市| 连山| 武强县| 合肥市| 普格县| 中西区| 体育| 花莲县| 峨边| 玛沁县| 昆明市| 岳阳市| 陵川县| 承德县| 大理市| 望城县| 青浦区| 张家港市| 萨嘎县| 阳高县| 洛扎县| 广河县| 连州市| 龙南县| 定兴县|