Communication Commander

User guide

Introduction

Communication commander app is a terminal for low level communication between Android smartphone and other devices, implementing various protocols and connections. App can currently:

App allows simultaneous connections to multiple devices with traffic diagnostic functions and contains interface for creating database of user defined messages and commands.

Main features:

Information in this user guide apply to the latest app version. If you do not see some features mentioned here in your app, update it to the last version.

Current app version: 8.6 open BETA (PRO)

Free version VS PRO version

Free version:

Pro version:

Smartphone requirements

Permissions

For application to function properly, it needs following permissions:

Wi-Fi connection information

Location

Reason for this permissions from Google developer guide: LE Beacons are often associated with location. In order to use BluetoothLeScanner, you must request the user's permission by declaring either the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in your app's manifest file. Without these permissions, scans won't return any results. 

Other

Layout types

Application offers 3 types of interface layouts.

To switch between layout click on menu button -> Switch layout.

Basic layout

Gamepad

Custom layout (example)

Adding a device

To make a new connection from the app, you first need to add a device - a symbolic representation of a connection. Just click on the "Add device" button. Empty device symbol will be added, with no active connection. Click on it and select the type of a connection / device which you want to initiate / connect to. All possible connections are explained in the following sections.

You can add multiple devices / connections in PRO version, FREE version is limited to 1. Each device can be configured for different type of connection. You can combine Bluetooth, TCP, UDP, MQTT, USB-serial connections.

Adding a device

Connecting to a classic Bluetooth device

To connect to a classic Bluetooth device add an empty device as described in previous section, click on it and select "Connect to classic Bluetooth device". 

NOTE: App can also open port and listen for incoming Bluetooth connections. To enable listening for remote connections, select "Open Bluetooth listening socket". Then you can initialise connection from remote device.

Click on "No device" and select task

Make sure remote Bluetooth device is paired with your phone, is turned on and is listening for incoming connections. Then select it from the list of all paired devices and the connection should be established. After successful connection, name of the device will be displayed in the list of active devices / connections with status "connected".

If your Bluetooth device is not showing in the list because it is not paired with your phone, minimalize app, pair device and return to app. If the device you just paired still does not show up in the list, return to main app screen and then select again task of connecting classic Bluetooth device - the list of paired devices will be refreshed.

If you want app to automatically try to re-connect to selected device when connection is lost (e.g. device got temporary out of range) check the checkbox Automatically try to reconnect...

Note that even if BLE devices might be listed as paired devices, they will not be connected using Serial port profile (SPP) protocol. To connect to BLE device select "Connect to BLE device" on the main screen (see following section).

In our case, we want to connect to HC-05 Bluetooth module. It is already paired so it appears in the list. Just click on the name HC-05.

Connecting to a BLE device

Make sure your BLE device is turned on and within range. Click on an empty device symbol and select "Connect to BLE device". Scanning for BLE devices will start and all found devices will be added to the list (name and device MAC address). Click on the device which you want to connect to (scanning is then automatically stopped)

In this example, we want to connect to BLE device MLT-BT05. It was successfully found by a scanner, so we just click on it.

List of devices found

After successful connection, services and characteristics are retrieved from the connected BLE device (see following image). To use a characteristic, click on it and choose if you want to use it for transmitting (TX), receiving (RX), or both (RX+TX).

Not all services and characteristics support notifications. For more information about which characteristic should be used for your device see the specification of your BLE device.

If the characteristic that you selected does not support notification (listening for incoming data cannot be executed on that characteristic) app will show an error message. Try to select another characteristics. After you select correct characteristic (listening for incoming data will be initialised successfully) app will switch back to main page and incoming data from the device will be from now shown in the log.

However you still might encounter following error when you try to send data to your device: "Sending data to BLE device failed". This means that the characteristic you specified cannot be used for sending data to that device. This most likely means that your device requires different characteristic for sending.

After you specify correct RX and TX characteristics, click on a "Connect" button.

In our example we want to use service 0000ffe0-0000-1000-8000-00805f9b34fb and characteristic 0000ffe1-0000-1000-8000-00805f9b34fb for receiving and transmitting, so we click on the respective characteristic and select RX+TX option.


List of services and characteristics

After successful setting of Rx+Tx characteristic, BLE device will be added to the device list of the main screen with status "Connected".

BLE device MLT-BT05 connected

Connecting to USB-serial device

In order to connect to USB-serial device, your smartphone must support USB OTG functionality. You also need USB OTG cable. Supported USB devices are: CP210x, CDC, FTDI, PL2303 and CH34x chips.

Plug in USB-serial converter using USB OTG cable. Click on an empty device and select "Connect to USB-serial device". USB-serial device should be automatically detected. In some cases (some smartphones) more than one USB device can be detected (might be internal USB device). In that case you need to try which one is the correct one by changing index in the drop-down menu USB#.

Following parameters can be set for the connection:

After setting up the parameters click on the "USB connect" button. After successful connection, USB-serial device will be added to the list of connected devices on the main screen and status will be set as "Connected".

TCP client

Using TCP client, app can connect to a TCP server on a network (local network or internet). Make sure you are connected to the right network. TCP server can be created on a PC, other smartphone device or any other device supporting TCP protocol. If you create TCP server on a PC, make sure firewall is not blocking connections. Alternatively you can connect to a server running on the same device using localhost address. 

To connect to a TCP server, you need to start TCP client in the app. Click on an empty device and select task "Start TCP client". To connect to a TCP server you need to enter its IP address (or host name) and port number. Click "Connect to Server" and TCP client from your smartphone will connect to specified TCP server.

You can also configure TCP client to try to automatically reconnect if connection is lost. This might be useful in scenarios where a device is moving in and out of a network range or when WiFi signal is weak. This autoreconnection simply tries to re-establish previous connection with configured parameters and is performed each second.

TCP server

App can start TCP server and allow connection of multiple TCP clients. To start TCP server click on an empty device and select task "Start TCP server". On next screen following parameters can be configured for the server.

Local Port specifies the port number on which your server will be listening. Your IP address is displayed also, use it on your TCP client together with the port number you specified to make a connection.

Following features are available in PRO version.

Client count limit determines how many client connections will server accept. When the client count is already full and new client tries to connect you can configure server to refuse incoming connection or to disconnect oldest client and allow new incoming connection. This option might be useful if your client loses connection with server (it moves out of WiFi range) and socket is not closed on server side. With this option checked you will be able to re-establish connection without the need of restarting TCP server. No connection will be overwritten in such case, because it was already lost.

In the case that multiple clients are connected to the server, it acts as a multiplexer / splitter. All outgoing data are splited to all clients and all incoming data are multiplexed to one stream for other connected device.

There is also an option to automatically disconnect connected client if no data is coming from it for set period of time. You can specify timeout in seconds. In the example below, connection with the client will be interrupted by TCP server if it receives no incoming data for 10 seconds. Uncheck the checkbox to not use this feature. If multiple clients are connected, this timeout refreshes each time when server receives data from any client. If timeout expires, all clients are disconnected.

When configuring TCP server, you also have the option to broadcast an UDP packet, if no client is connected. The purpose of this feature is to enable TCP server to be detected on the network by clients. You can include necessary information into UDP packet data.  UDP broadcast automatically stops once client is connected. If client disconnects, UDP broadcast is resumed.

Here is an example of a practical usage of such feature.

Options for UDP (broadcast) address:

Get network broadcast address automatically - Network broadcast address will be detected and used.

Use loopback broadcast address - loopback broadcast address is fixed value of 127.255.255.255

Enter address manually - With this option you can manually specify any IPv4 address.

You can use all these options in combination with autostart / autoconnect configuration.


UDP socket

App can open listening UDP socket. You can specify local port number. For remote device (remote UDP socket) you need to know and enter its IP address and its port number. 

UDP is connectionless communication - no active connection is created when you create a UDP socket. Data transmitted over network are individually addressed and routed based on information carried in each data packet. Therefore status of this connection (on the main screen) does not differentiate between connected /  disconnected state.

MQTT client

Next connection option is MQTT client. Enter typical parameters, as broker (IP address or its host name), port, connection protocol, QoS, Client ID and publish and/or subscribe topic. Either publish or subscribe topic must be entered. If only publish topic is defined, MQTT client will only send data. If only subscribe topic is defined, MQTT client will only receive data.

You can also specify credentials (username and password) if broker requires authentication. Leave these fields empty to connect without authentication.

Note about QoS parameter: QoS (Quality of Service) is a parameter used in MQTT (Message Queuing Telemetry Transport) protocol to specify the level of guarantee for delivering a message. There are three levels of QoS:

QoS 0 is the fastest and least reliable option, while QoS 2 is the slowest but most reliable option. The level of QoS is determined by the publisher and is specified when publishing a message. The subscriber can also request a specific QoS level when subscribing to a topic.

When ready, click "Connect to Broker" to establish connection.

Managing connected devices

All connected devices are displayed in the top panel of the main screen in a horizontally scrollable list. 

You can display information about connection configuration by clicking on a specific device. There is also an option to cancel the connection.

If you want to remove the device from the list (this means also cancelling the connection), use long click and select "Remove". In the same long-click menu, there is also an option to change device symbol.

If an existing connection is terminated from the other side (outside the app), device symbol changes to "No device" and the event is captured in the log. Device is not automatically removed from the list. You can use it again to re-establish the same or a different connection.

You can terminate all connecitons and remove all devices from the list by long clicking on the "Add device" button.

List of devices / connections

List of commands/messages

Commands / messages are user predefined data in hexadecimal or text form which can be send to all connected devices by simple click. List of all commands is displayed below the connected devices. It can contain 32 commands. All commands created by user are automatically saved and loaded when app starts.

Each command has its symbol, name, value (data which are sent to connected devices) and additional parameters, all assigned by user during creation process.

Once created command can be edited. To edit a command, long click on it and select "Edit".

To delete a command, long click on it and select "Remove"

If you want to remove all existing commands from the list, go to Settings and select "Clear data". This operation cannot be undone.

List of commands (4)

Creating command

To create a new command click on "Add command" and select the form in which you want to input your data (hexadecimal number or text) and follow the next instructions.

Commands can be created regardless of any active connections.

Click here to create new command

Creating HEX command

To define a new hexadecimal command, you need to define its value. You can also define its name and symbol, which will help you to easily identify the command in the list of all commands (default name and symbol will be used otherwise)

Hex command editor

Creating string (text) command

To define a new text command, you need to define a string.  Concept with the name and icon is the same as with HEX command, you can change it to help you identify the command in the list of all commands. 

String (text) command editor

Creating variable command with sensor data

You can create messages and commands containing data from phone sensors like GPS, proximity sensor, accelerometer, thermometer and also data like time, phone battery level, etc. The process is described in separate user guide:

User guide for creating messages with sensor data

Command with sensor data

Sending command (single or periodical)

If you want to send an existing command simply click on it and it will be sent once to all connected devices. If, however, during command creating process "Send periodically" option was checked, the command will be send periodically with its predefined time period. In that case its icon will change indicating that command is being sent. This time period is also included in the command description (2nd line of the command item). To stop the sending click on the command again. Icon will be changed and sending will stop.


Periodical sending is active for 2 commands

Removing / editing / copying command

To remove,  edit or create copy of existing command, simply long click on command and additional menu will show up.

If you want to remove all existing commands from basic layout, go to This layout settings -> Remove all commands or use long click on [empty] item in the list of commands.


Command options

Using quick send view

Quick send view can be used to send data to remote device(s), usually if you just want to send few bytes or a variable text without need of creating command. To select format click on txt/0x button. Enter text in a valid format and click Send. Data will be parsed and send to (all) connected devices(s).

Quick send view can be enabled or disabled in settings for this layout (click menu -> This layout settings).

Quick send view is also available as a component in custom layout in pro version.

Sending data using Quick send view

Data logging

All incoming data are automatically logged in the log on the main screen (if this option is not disabled in the settings). Format of incoming data can be selected in Global settings:

 Incoming message consist of data identifier (name of a device from which message is received and time stamp) and data itself. Outgoing commands are logged also - identifier contains command name and time stamp. Identifiers for both incoming and outgoing messages can be customised in settings. Size of the font used for logging can be changed in settings also.

To clear the log, click Menu button on main screen and select Clear log. This applies also for gamepad and custom layout. 

To change the log size, click on Menu button and select This layout settings. There you can select log size for this layout. 

In the following screenshot 3 devices are connected and each is sending data. You can identify sender by its name.

If the color differentiation is enabled in the setting, following colors will be used:

You can also copy a particular message / command from the log by long clicking on it. It will be copied to clipboard.

Data logging in the log view

Global settings

Global settings are settings related to all app layouts (basic, gamepad and custom).

To access  Global settings click on the 3 lines symbol in the top right corner in the main screen and select Global settings.

To exit settings, click on the back button. All changes are saved automatically.


Global settings

Log settings

To access log settings click on Menu button -> Global settings -> Log settings.



Log settings

Additional basic layout settings

Additional basic layout settings are available via menu button -> This layout setting. These are the settings which are related only to basic layout.



Basic layout settings

Information in this user guide apply to the latest app version (and higher). If you do not see some features mentioned here in your app, update it to the last version.

Current app version: 8.6 open BETA (PRO)

Want to become a beta tester for new features? Follow this links:

Beta testing for PRO version 

Beta testing for FREE version