Sorry, you need to enable JavaScript to visit this website.

Services

Services

Services initialization

The HU Connectivity module makes it easy to discover nearby HUs and establish communication with
them. It uses technologies such as Bluetooth, Wi-Fi or direct cable connection. The messages are
exchanged with nearby devices in real-time, regardless of network connectivity. Sample use case:

  • Share location (e.g. destination) with HU

  • Share full route with HU

  • Forward map update (e.g. IQ Maps package) with HU

The primary goal of the HU Connectivity module is to provide a platform that is simple, reliable
and performant. The developed SDK should automatically detect which communication channels are
available and use the most valuable one, leveraging the strengths of each while circumventing
their respective weaknesses. For instance, when the user is close to the car and BT connection
with HU is established, BLE should be used. However, when the user is e.g. in the office, the Wi-Fi
connection with NavCloud in the middle should be used. The user may also force a specific channel
to be used each time and ignore other possibilities. In the most positive scenario, the communication
channel should be transparent for the user and the developer, allowing them to focus on the features
that are important for them.

To obtain access to this module you will need to add following dependency to your build.gradle file:

implementation("com.tomtom.online:sdk-connectivity-services:2.4307")

Services module gives access to ConnectivityApi interface and PriorityConnectivityApi implementation.
ConnectivityApi is used to manage connections and send data between devices. In addition it also accepts multiple communicators that will be used to send/receive data.

ConnectivityApi provides access to the following methods:

  • Connect

  • Disconnect

  • Send(Command)

In order to create an instance use PriorityConnectivityApiBuilder and provide required parameters to it which are:

  • StatusHandler

  • One or more CommunicatorFactory

  • One or more CommandModule

val connectivityApi = PriorityConnectivityApiBuilder(applicationContext)
    .addCommunicator(communicatorFactory1)
    .addCommunicator(communicatorFactory2)
    .addModule(commandModule)
    .withStatusHandler(statusHandler)
    .build()

StatusHandler will be used by ConnectivityApi for notification of an operations status.
To achieve that implement StatusHandler interface or create an ReferenceStatusHandler in the following manner:

protected val statusHandler = ReferenceStatusHandler(
    onReadStatusReady = { communicatorInfo, status -> onReadStatusReady(communicatorInfo, status) },
    onWriteStatusReady = { communicatorInfo, status -> onWriteStatusReady(communicatorInfo, status) },
    onConnectionStatusReady = { communicatorInfo, status -> onConnectionStatusReady(communicatorInfo, status) },
    onDisconnect = { communicatorInfo -> onDisconnect(communicatorInfo) }
)

Communicators

By default, ConnectivityApi does not support any Communicator. Several communicator modules adapt
specific connection type:

  • Bluetooth Low Energy Server

  • Bluetooth Low Energy Client

You are here