Skip to content

Cross-component implementations

This section describes how to implement functionalities which use several IoTize software / hardware components.

Build a relay between your Tap and IoTize Studio

Why a relay ?

IoTize Studio cannot communicate directly with your Tap via BLE or NFC, and anyway it is unlikely that your PC has BLE or NFC.

To overcome this problem you can setup a relay with the Tap Manager App. This connects your smartphone to the Tap via BLE or NFC, and to your PC via your IP network.

You need a relay between your Tap and IoTize Studio in order to:

  • Apply the configuration from IoTize Studio to the Tap (or vice versa)
  • Test your monitoring 'Web App' from IoTize Studio

Target Settings

Types of relay and recommendations

There are 2 relay modes: Socket relay and MQTT relay

  • Socket relay
    • this is the simplest mode to implement, and also offers the highest data transfer rate
    • this mode is recommended by default
    • this mode requires that your mobile device and your PC have access to a common IP network, for example through:
      • a company WiFi network
      • the WiFi hotspot of your mobile device
  • MQTT relay
    • this mode is based on an MQTT broker
    • an implementation is provided by IoTize for TapNLink Primers (and more generally for Taps which have been provisioned in IoTize cloud platforms)
    • for standard Taps you have to implement your own broker (contact us)
    • this mode can work in ALL network configurations
    • this mode is not yet available from an iOS device.

Detailed implementation

IoTize Studio uses Tap Manager to communicate with your Tap via your mobile device.

You need to start a socket relay on the smartphone and connect to the Tap.

Start socket relay on an Android device

  1. Network settings
    • Define the network settings of your mobile device
      • Enable NFC (if you want to trigger the connection using NFC, which is simpler) and BLE connections
      • Connect your mobile device to the WiFi network OR setup your mobile device as a WiFi hotspot
    • Connect your PC to the same WiFi network used by the relay
  2. Connect Tap to mobile device

    • Tap your mobile device on your Tap (or launch Tap Manager manually)
    • Open the navigation menu (swipe your finger from the very left to right), then:

      • Set up relay

      Target Settings

      • if no device is selected:

        • Click to select a device and select your Tap.
        • Scan for modules if your Tap is not displayed.
      • check your Tap name and Tap Serial Number are correct.

      • select the socket mode (mandatory for a first connection)
      • note the IP address
      • Start the relay

    If Tap Manager has problems creating a Socket connection, try setting up the relay again, or just click on the Socket menu and change the port number. Phone menu Phone menu

Start socket relay on an iOS device

  1. Network settings

    • Define the network settings of your mobile device
      • Connect your mobile device to the WiFi network OR setup your mobile device as a WiFi hotspot
    • Connect your PC to the same WiFi network used by the relay
  2. Go to your phone settings and change Tap Manager App settings to enable the Developer Mode.

    Tap Manager Settings

  3. Start a communication relay from the mobile phone using Tap Manager

    • Start a BLE connection with your device.
    • Tap Manager will automatically open the Relay page and start listening to clients. The IP address displayed on the page corresponds to the socket server address. You should use this address to initiate a connection between Iotize Studio and the phone.

    Tap Manager Relay Page

Configure IoTize Studio

  1. Configure IoTize Studio (on your PC) to find the socket relay, and your Tap:

    • In IOTZ Explorer expand Sensor_demo.iotz Configuration
    • Click on Studio, in the details, set Connection to Tap / Protocol to 'Socket' (mandatory for a first connection) Image
    • Enter the IP address in the Socket host name/IP field
    • Launch the test connection (the upper bar) Image
    • The first connection triggers the recovery of your Tap Serial Number (with a message) Image
    • From now on, you can use the relay to configure your Tap and to test your monitoring app from IoTize Studio Image
  2. Monitoring of exchanges

    • You can see from Tap Manager (Monitoring menu) the number of packets which have been exchanged.
    • Look at the logs displayed in the output window of IoTize Studio
  3. To use an MQTT relay instead of a Socket relay:

    • Both the PC and the mobile device must access the MQTT broker through an Internet access
    • Change connection mode to 'MQTT relay' in both Tap Manager and IoTize Studio
    • Restart the relay in Tap Manager then Test Connection again in IoTize Studio
    • Check the connection on both sides.
  4. Complementary information to reinforce the security in MQTT mode (for advanced users)

    • Netkey encrypts the communication in MQTT mode
    • This is a shared key mechanism
    • This key can be copied to the Tap (or read from the Tap) when you configure it using 'Socket mode'
    • To bypass the recovery of this key from the Tap by the smartphone
      • copy the BRK file (generated in the project directory on your PC)
      • install this file in the IoTize Directory in your smartphone
    • Contact IoTize for more details