8. SmartConsole Android and iOS Application
8.1. Overview
The SmartConsole reference application comes with a CodeLess demo application for Android. The SmartConsole application can discover, connect, and exchange AT commands or data with CodeLess enabled devices within the Bluetooth RF range of the mobile device.
Feature List:
Device discovery
Connection to a discovered device
Command mode
Binary mode
8.2. Installation
8.2.1. Android Application
The Android application can be found in Google Play Store and easily installed from there as any other Android application. To find the application, a user can search for “Dialog SmartConsole”. Then the user should open the application’s description and press the ‘Install’ button. During the installation, permission to access device resources will be requested as shown in Figure 46. The permission should be granted. After installation is complete, the application can be open either using the “Open” button in the Play Store or from the Android application drawer.
8.2.2. iOS Application
The iOS application can be found in Apple App Store and easily installed from there as any other iOS application. To find the application, a user can search for “SmartConsole” or “Dialog SmartConsole”. Then the user has to open the applications description and press the cloud button to download and install it. After installation is complete, the application can be opened either using the “Open” button in the App Store or from the iOS desktop.
8.3. Device List
The SmartConsole Android application can discover and connect to CodeLess devices. When the application starts, the scan screen is displayed, showing the CodeLess devices in range. Device name, BD Address, RSSI, and advertised services are displayed in the list of discovered devices. By pressing the filter button (top right corner), the user can open the Scan Filter screen, to add and apply any scan filter in terms of Signal, Services, Beacon/Device name, address, and advertising data.
If the desired CodeLess device is not found, the scan process can be reinitiated by clicking SCAN control at the top of the screen. The user can connect to any of the retrieved BLE CodeLess enabled devices by clicking the corresponding item of the list. During connection establishment, the “Connecting, please wait…” screen message will appear. Upon successful connection, the AT Console screen will be shown. Otherwise, the application will return to the Scan screen, showing an indication “Device disconnected”.
8.5. Information and Disclaimer Screens
The Information screen displays contact information and the version of the application as shown below. The Disclaimer screen contains the disclaimer notes.
8.6. Enter/Exit CodeLess Binary mode using Generic GATT Client
When developing a custom mobile application for transferring data to Codeless peripheral in Binary mode. To enter this mode user needs to implement a sequence of GATT commands between the mobile application and the Codeless peripheral. The sequence of commands shown in below table needs to be followed from start to finish.
# |
Action |
Direction |
Value |
UUID |
Comment |
---|---|---|---|---|---|
1 |
Write Request |
From Mobile application to |
0x01 |
0x e2048b39-d4f9-4a45-9f25-1856c10d5639 |
Enable the CodeLess Flow Control notification. The +COMMAND MODE SUPPORTED string will be printed to the console of the CodeLess |
2 |
Write Request |
From Mobile application to |
0x01 |
0x 0783b03e-8535-b5a0-7140-a304d2495cb8 |
Enable the DSPS Server Tx notification.The +BINARY MODE SUPPORTED string will be printed to the console of the CodeLess peripheral |
3 |
Write Request |
From Mobile application to |
0x01 |
0x 0783b03e-8535-b5a0-7140-a304d2495cb9 |
Enable the DSPS Flow Control notification |
4 |
Write Command |
From Mobile application to |
0x01 |
0x 0783b03e-8535-b5a0-7140-a304d2495cb9 |
Write value 0x01 to the DSPS Flow Control Characteristic |
5 |
Write Request |
From Mobile application to |
0x 41 54 2b 42 49 4e 52 45 51 00 |
0x 914f8fb9-e8cd-411d-b7d1-14594de45425 |
Write the CodeLess Inbound Command characteristic with the AT+BINREQ command sent from the mobile phone to the CodeLess Peripheral.The |
6 |
Read Request |
From Mobile application to |
N/A |
0x 3bb535aa-50b2-4fbe-aa09-6b06dc59a404 |
Read the CodeLess Outbound Command characteristic. An OK (0x 0d 0a 4f 4b 0d 0a) is expected in the Read Response. This must be read otherwise |
7 |
Enter the AT+BINREQACK |
From CodeLess peripheral to |
N/A |
0x e2048b39-d4f9-4a45-9f25-1856c10d5639 |
A notification will be sent to the mobile phone application informing it that new data has been written to the CodeLess Outbound Command |
8 |
Read Request |
From Mobile application to |
N/A |
0x 3bb535aa-50b2-4fbe-aa09-6b06dc59a404 |
Read the CodeLess Outbound Command characteristic.The AT+BINREQACK string (0x 41 54 2b 42 49 4e 52 45 51 41 43 4b) is sent from the CodeLess |
9 |
Write Request |
From Mobile application to |
0x 0d 0a 4f 4b 0d 0a 00 |
0x 914f8fb9-e8cd-411d-b7d1-14594de45425 |
Write the CodeLess Inbound Command characteristic to acknowledge the AT+BINREQACK string. It is expected that an OK will be printed to the CodeLess |
After completing all the mentioned steps successfully the CodeLess peripheral will now be set in Binary mode. In binary mode the data can be sent and received between the mobile application and the CodeLess peripheral. See the below table to implement data transfer.
Direction |
Service Name |
UUID |
Method |
Comment |
---|---|---|---|---|
From Mobile Application to |
DSPS Server RX |
0x 0783b03e-8535b5a0-7140a304-d2495cba |
Write No Response |
Data will be forwarded to the |
From Codeless Peripheral to |
DSPS Server TX |
0x 0783b03e-8535b5a0-7140a304-d2495cb8 |
Notify |
- |
Similarly, to exit the binary mode a sequence of GATT commands needs to be followed. The below table shows how to exit the binary mode:
# |
Action |
Direction |
Value |
UUID |
Comment |
---|---|---|---|---|---|
1 |
Write Request |
From Mobile application to |
0x01 |
0x e2048b39-d4f9-4a45-9f25-1856c10d5639 |
Enable the CodeLess Flow Control notification. The +COMMAND MODE SUPPORTED string will be printed to the console of the CodeLess |
2 |
Write Request |
From Mobile application to |
0x01 |
0x 0783b03e-8535-b5a0-7140-a304d2495cb8 |
Enable the DSPS Server Tx notification.The +BINARY MODE SUPPORTED string will be printed to the console of the CodeLess peripheral |
3 |
Write Request |
From Mobile application to |
0x01 |
0x 0783b03e-8535-b5a0-7140-a304d2495cb9 |
Enable the DSPS Flow Control notification |
4 |
Write Command |
From Mobile application to |
0x01 |
0x 0783b03e-8535-b5a0-7140-a304d2495cb9 |
Write value 0x01 to the DSPS Flow Control Characteristic |
5 |
Write Request |
From Mobile application to |
0x 41 54 2b 42 49 4e 52 45 51 45 58 49 54 00 |
0x 914f8fb9-e8cd-411d-b7d1-14594de45425 |
Write the CodeLess Inbound Command characteristic with the AT+BINREQEXIT command sent from the mobile phone to the CodeLess Peripheral.The |
6 |
Read Request |
From Mobile application to |
N/A |
0x 3bb535aa-50b2-4fbe-aa09-6b06dc59a404 |
Read the CodeLess Outbound Command characteristic. An OK (0x 0d 0a 4f 4b 0d 0a) is expected in the Read Response. This must be read otherwise |
7 |
Enter the AT+BINREQEXITACK |
From CodeLess peripheral to |
0x 41 54 2b 42 49 4e 52 45 51 45 58 49 54 41 43 4b 00 |
0x 914f8fb9-e8cd-411d-b7d1-14594de45425 |
A notification will be sent to the mobile phone application informing it that new data has been written to the CodeLess Outbound Command |
8 |
Read Request |
From Mobile application to |
N/A |
0x 3bb535aa-50b2-4fbe-aa09-6b06dc59a404 |
Read the CodeLess Outbound Command characteristic.The AT+BINREQEXITACK string (0x 41 54 2b 42 49 4e 52 45 51 41 43 4b 00) is sent from the CodeLess |
9 |
Write Request |
From Mobile application to |
0x 0d 0a 4f 4b 0d 0a 00 |
0x 914f8fb9-e8cd-411d-b7d1-14594de45425 |
Write the CodeLess Inbound Command characteristic to acknowledge the AT+BINREQEXITACK string. It is expected that an OK will be printed to the CodeLess |
The procedures mentioned in this section can be tested using the Renesas Smartbond application which is a Generic GATT Client application. For more information user can refer to the source code of SmartConsole application which is an application specifically for CodeLess.