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:
open listening Bluetooth socket,
connect to classic Bluetooth device,
connect to Bluetooth LE device,
connect to USB-serial converter device (supported chipset required),
start TCP server,
start TCP client,
open UDP socket,
start MQTT client.
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:
Connection and communication with multiple devices simultaneously (only in PRO version).
Editor for creating commands / messages, in hexadecimal and text format, or messages containing phone sensor data.
Simple send-by-click interface.
Designer for creating custom user interface (only in PRO version).
Time based (periodical) transmission options.
Advanced logging functions, logging of multiple connected devices, color differentiations, time stamps, etc.
Combination of different device / connection types at the same time is possible.
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:
ads
one connection possible
limited to basic layout and gamepad
Pro version:
no ads
multiple connections possible
all app features and layouts available (basic, gamepad, custom layout)
quick access to the newest features
Smartphone requirements
Android 4.1 and up, for connecting to BLE device Android 4.3 is required (Apple devices are currently not supported)
Bluetooth adapter
Wifi connection (for TCP, UDP and MQTT)
USB OTG (for USB-serial connections)
Permissions
For application to function properly, it needs following permissions:
Wi-Fi connection information
view Wi-Fi connections
Location
approximate location (network-based)
precise location (GPS and network-based)
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
access Bluetooth settings
view network connections
full network access
prevent device from sleeping
pair with Bluetooth devices
Layout types
Application offers 3 types of interface layouts.
Basic layout - Default layout in which commands are organised in a list view. Connection panel is placed in the top and log (with customisable size) in the bottom.
Gamepad - suitable for controlling moving devices where it is required to control features like driving directions, arm position, object orientation or moving parts in general, but it can be used for any other purposes and device types.
Custom layout - (available in PRO version) fully customisable user interface. You can design your own layout which suits your needs.
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:
Baud rate[bps]
Data bits
Parity
Stop bits
Flow control
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: At most once delivery (fire and forget)
QoS 1: At least once delivery (acknowledged delivery)
QoS 2: Exactly once delivery (assured delivery)
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)
In this example we create a command which will turn on a switch on our control board. Let`s name it Switch_ON and enter its value of 0xFFC101
We want this command to be sent once when clicked so we left "Send periodically" unchecked
We want command value to be sent least significant byte first (meaning byte 0x01 will be sent first)
We go with default command icon
To finish the process, we click "Add command" button and the command will be added to the list of all commands in the main screen
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.
In this example we want a command which will be send each second. We name it "1_second_tick" and we set the string value to "tick"
Since we want this command to be send periodically, we check "Send periodically" and set the time interval to 1000ms
We also want to include line feed(0x0A) at the end of the command, so we select that option
We also changed the icon, by clicking on the default icon and selecting a new one
To finish the process, we click "Add command" button and the command will be added to the list of all commands in the main screen
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:
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.
The number of commands which can be turned on for periodical sending is not limited, however beware, that if you start periodical sending for too many commands, especially with short time interval, a delay might occur between the transmissions. In the worst case app might become unresponsive or freeze.
In the following screenshot 2 commands are being send. One with period 1000 ms and one with period 60000 ms. Such setting is no problem for the app.
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.
Selecting Edit will take you to command customisation screen, where its parameters can be changed.
Selecting Remove will remove command from the list of commands. This operation cannot be undone.
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.
You can create a copy of an existing command by selecting Create copy option. Duplicate of the command will be created, which can be further edited and customised. This option is useful if you want to create multiple similar commands. [this option is available from app version 6.1]
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:
hexadecimal
decimal
text
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:
cyan and white for data received from connected devices
light grey for outgoing commands
dark grey for informational messages
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.
In Screen setting you can set if you want your phone screen to stay always on (with full brightness or dimmed) or if you want it to be turned off (turn off timeout for screen can be changed in Android settings, usually under Display/Sleep options)
Incoming stream setting lets you select if you want to log incoming data from connected devices or no. Default option is to log incoming data. If you do not need to see incoming data, you can turn this feature off.
Format of incoming messages determines formatting of incoming data in the log. It can be hexadecimal (byte values in 0x format), decimal (byte values in decimal format) or string (text format).
Log settings contains advanced settings and customisation options
Export log - allows to save content of the log to a text file. (This feature is currently available for BETA testers)
How it works - shot instructions, with a link to full user guide.
About section contains additional information about Bluetooth Commander app
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.
By changing Font size in log you can adjust text size in the log on the main screen to fit your needs. Valid font size is between 8-20.
Message identifier data allows to customise data identifier for incoming and outgoing messages. Time stamp contains time of the message reception or transmission.
Message identifier show lets you customise when you want the message identifier be shown. Options are: never, always and only if sender changes.
By default text color differentiation is used in main log (separate color used for incoming messages from BLE device and classic Bluetooth devices, outgoing messages and informational messages). This option can be disable in which case only white color will be used for all text in log.
Message limit in log determines how many lines can main log hold. If this limit is exceeded, oldest messages will be automatically removed. This limit is adjustable within range 100 - 4000 lines.
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.
Log size option determines the size of log in the main screen. Options are small, medium, large and full. Full means that log is almost full screen and list of commands is not visible. This option is useful if you want to primary observe incoming data from connected devices. Log size can be also changed by long click on log window in the main screen.
Screen orientation allows to select between fixed portrait or fixed landscape orientation or automatic orientation. To use automatic rotation, enable rotation on your device.
Quick send view option determines if Quick send component is visible on main screen.
Remove all commands removes all stored commands in this layout. Gamepad and custom layout is not influenced.
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: