Chapter 4. SPP-over-IP

SPP-over-IP is a special functionality of iWRAP Bluetooth servers running in Access Servers. It offers a transparent way to transmit data from Bluetooth Serial Port Profile (SPP) enabled devices to server computers or PCs. Several transport medium are supported, such as Ethernet, Wi-Fi or and GPRS.

4.1. How SPP-over-IP Works

The SPP-over-IP application enables transparent data transfer between any Bluetooth Serial Port Profile (SPP) complaint device and a server, laptop or desktop connected to the same network. This enables plug n' play connectivity from a Bluetooth network to any standard TCP/IP based network. See Figure 4-1 for an overview of the application and a brief introduction to its functionality.

Features of SPP-over-IP are:

4.1.1. Standard Operation

With the standard configuration, SPP-over-IP works as described below:

  • Listens for incoming Serial Port Profile (SPP) connections

  • Takes control of all incoming connections

  • Opens a TCP connection to the defined IP address and TCP port

  • Forwards all incoming data from the SPP device to the established TCP connection and vice versa

Figure 4-1. SPP-over-IP Network Architecture

All the server computer needs to do is to listen for incoming TCP connections from Access Server to a specified TCP port and receive/send the application data.

4.1.2. Repeater Operation

The SPP-over-IP application can also be used in a so-called repeater mode. This feature is useful when all Access Servers can not be directly connected to the TCP/IP network, but they can be connected to other Access Servers by using Bluetooth PAN-connection. PAN enables transmitting TCP/IP packets wirelessly over Bluetooth. The figure below illustrates this configuration:

Figure 4-2. Repeater Mode in SPP-over-IP

4.1.3. SPP-over-IP over GPRS

SPP-over-IP software can also be used over GPRS instead of wired Ethernet connection. This requires that Access Server is equipped with a working GSM/GPRS compact flash card. See Appendix D for supported cards.

Figure 4-3. SPP-over-IP over GPRS

Notice when using GPRS:

  • Data upload rate is around 8-12kbps (depending on GPRS card)

  • Data download rate is around 32-48kbps (depending on GPRS card)

  • Data transmission delays can be very high, sometimes even seconds

  • GPRS connection may be unreliable and break easily. This should be taken account when designing the system. If GPRS connection breaks, all the TCP and Bluetooth connections will also be closed.

4.1.4. Opening Connections from Access Server

In the basic SPP-over-IP use case, Access Server is in passive mode and only accepts incoming connections. It is however possible to implement a system where Access Server opens the Bluetooth connections to the defined static Bluetooth devices or, alternatively, on ad-hoc basis.

In this case, special software must be developed for Access Server, which handles the outgoing connections and decides where they are opened to. This software can be developed with the Access Server Software Development Kit (SDK). The software can be written with C, C++ or standard Linux scripts.

Figure 4-4. Access Server Opening the Connections

4.1.5. SPP-over-IP and COM Ports

SPP-over-IP can also be used together with Tactical Software's Serial/IP® software. Serial/IP software simply converts the TCP connections into virtual COM ports on the host computer. This is very useful in applications, which do not have support for TCP/IP but support COM ports instead.

Figure 4-5. SPP-over-IP with Serial/IP

An evaluation version of Serial/IP can be downloaded from: http://www.tacticalsoftware.com/products/serialip.htm

4.2. Configuring SPP-over-IP

This chapter briefly instructs you to configure SPP-over-IP to work in different network setups or use cases.

4.2.1. Preparations

SPP-over-IP is easiest to configure through WWW setup, which allows you to access all the necessary configurations.

First, you must figure out Access Server's IP address (if it is connected to a TCP/IP network). This is easiest to do with the WRAPFinder software:

  1. Start the WRAPFinder software

  2. Scan your network for available Access Servers

  3. Choose the correct Access Server

  4. Press the Connect button

    Your web browser opens the WWW setup of the selected Access Server.

    Figure 4-6. WRAPFinder

  5. Once the browser window has opened, click the Setup link

    Figure 4-7. WWW Setup Login

  6. Type in you user name and password and you get access to the main view of the setup:

    Figure 4-8. WWW Setup Main View

Note: The "basic" Bluetooth Serial Port Profile must be disabled for SPP-over-IP to work. By default, this is the case. You can verify it by checking that serialport service (which implements the profile) is off in WWW SetupApplicationsDefault startup Applications (see Figure 4-9).

Figure 4-9. Checking that Bluetooth Serial Port Profile is disabled.

4.2.2. Preparations

SPP-over-IP settings are modified in iWRAP servers' configuration file /etc/bluetooth.confwhich can be edited by navigating in WWW Setup to SetupBluetooth settingsEdit startup script.

To enable SPP-over-IP, add lines similar to following to the end of that file (lines starting with # are comments which can be left out):


          # Forward incoming connection to IP 192.168.42.99 socket 7444
          SET BLUETOOTH LISTEN 1 192.168.42.99:7444
          # Add SDP record for Serial Port Profile
          SDP ADD SPP 1 "SPP-over-IP"
        

In the example configuration above, RFCOMM channel 1 is used by the SPP-over-IP service. You can, however, use any other free channel as well. The RFCOMM channel must be same in both SDP ADD (see SDP ADD for details of command syntax) and SET BLUETOOTH LISTEN (see Table 7-1 for details of command syntax) configuration commands.

The text "SPP-over-IP" is the name of the service shown in Bluetooth service discovery. Normally, there should be no need to specify a different name, but nobody forces you to use "SPP-over-IP".

In the example, connections are forwarded to a server listening for incoming connections to TCP port 7444 in host with IP address 192.168.42.99. You must change these to match your system.

See Figure 4-10 for WWW Setup example of configuration.

Figure 4-10. SPP-over-IP Configuration Made over WWW Setup

Once you have done your configuration, press the Save button and restart the server so that the settings take place.

4.2.3. Repeater Configuration

If you want to configure Access Server also to act as a repeater (see Figure 4-2) you must make some additional configurations. Add the line below to your Bluetooth startup script (line starting with # is comment which can be left out):


          # Automatically connect to Access Server with PAN-NAP enabled
          SET CONTROL AUTOEXEC CALL 00:07:80:bf:01 PAN-NAP
        

You must replace the Bluetooth address used in the example (00:07:80:80:bf:01) with the Bluetooth address of the Access Server, on which you want to receive the PAN connection.

Note: The server receiving the PAN connection must have the PAN-NAP profile enabled. This is by default not the case, so in setup or its WWW interface, ensure that the setting at → Bluetooth settingsBluetooth profilesEnable PAN network access point profile says yes. No other configuration is needed. See Section 3.2.5 for more information on PAN profiles.

The Bluetooth PIN codes must be the same in both Access Servers.

Figure 4-11. Repeater Configuration

4.2.4. Wi-Fi Configuration

If Access Servers must be connected to Wi-FI (WLAN) instead of physical Ethernet connection, you also need to make additional configurations through the WWW setup.

See Section 3.3.3 for more information.

4.2.5. GPRS Configuration

If Access Servers must be connected to GPRS network instead of physical Ethernet or Wi-Fi connection, you also need to make additional configurations through the WWW setup.

See Section 3.3.1 for more information.