-
Notifications
You must be signed in to change notification settings - Fork 0
Classes description
This section describes the functional modules of the application and the classes (Activity) that they consist of.
Only methods that contain application-specific logic are considered, i.e. standard methods onCreate()
, onResume()
, etc., not carrying specific logic in themselves, will not be described.
Classes, methods and functions (or part of the method) of rendering the application interface are not considered in detail, because this is a simple basic interface made for a prototype.
This functional module is the main one in the operation of the application and implements the user (User mode) mode of operation of the application.
The main class of the application, it contains entrypoint, access to settings, advanced mode, and it is from it that device scanning is started with subsequent connection
Protected methods:
-
onCreate
- calls private methods for initializing, configuring and scanning Bluetooth, as well as access rights for Bluetooth and checking for BLE support.
Private methods:
-
getBluetoothAdapterAndLeScanner
- initializes objects of theBluetooth Adapter
andBluetooth Le Scanner
classes -
scanBleDevices
- starts scanning Bluetooth devices with a certainscan_period
time, passes a list of device addresses to theLightManageActivity
class -
meanRSSI
- calculates the average value of the RSSI signal strength from the input array of values -
loadSettings
- loads the settings (scan_period
) fromroot_preferences.xml
Inner classes:
-
Kalman
- the class implementing the Kalman filter has one public methodfilter(int init_rssi, ArrayList<Integer> rssi_list)
, which directly performs filtering
A class containing all the necessary methods for creating and managing Bluetooth connections.
Public methods:
-
initialize
- initializes an object of theBluetoothAdapter
class -
connect
- connects a Bluetooth device to GATT at the specified MAC address -
multiconnect
- connects to several GATT Bluetooth devices at once using the specified list of MAC addresses -
disconnect
- disconnects from one or several Bluetooth devices at once -
сlose
- closes the connection/GATT connections of Bluetooth devices -
readCharacteristic
- reads the value of a certain GATT characteristic of one Bluetooth device or several at once -
writeCharacteristic
- writes a value to a specific GATT characteristic of one Bluetooth device or several at once -
setCharacteristicNotification
- sets or disables notification for a specific GATT characteristic of one Bluetooth device or several at once -
getSupportedGattServices
- returns a list of available GATT Bluetooth device services
Private methods:
-
loadSettings
- loads the settings (reconnection_attempts
) fromroot_preferences.xml
Inner classes:
-
BluetoothGattExt
- class that is an extension of theBluetoothGatt
class. Connects the Bluetooth device and theBluetoothGatt
object more closely, because the standardBluetoothGatt
can connect to multiple devices, which does not provide data exchange with multiple devices at once.
A class responsible for authentication and control of light modes on a connected Bluetooth device (services Authentication
and Light manage
). Authentication is only needed to access the values entry in the Level of light
characteristic for controlling light modes, i.e. you can connect to the GATT of the BLightESP32 device and see its services and characteristics, but without authentication (access_token
) through the Authorization data
characteristic, it will be impossible to control the light mode.
Protected methods:
-
onCreate
- performs initial calculations of the step of changing the light mode based on the selected settings, initializes the visual interface for selecting the mode, initializes the connection to Bluetooth devices BLightESP32
Private methods:
-
initServiceConnection
- connects to Bluetooth devices, also defines a callback method for reconnecting if it is not possible to connect the first time -
authDataSending
- passes authentication data (access_token
) to theAuthorization data
characteristic for future access to recording light mode values in theLevel of light
characteristic -
loadSettings
- loads the settings (access_token
,effect_color_temp_min_key
,effect_color_temp_max_key
) fromroot_preferences.xml
A class that implements an interface for user interaction with application settings via root_preferences.xml
, allows you to reset the settings to the default values. Basically, this class contains visual functionality, so it will not be described in detail.
This module implements the advanced mode (Developer mode) of using the application.
The main class for interacting with Bluetooth devices implements a graphical interface for representing all available devices within Bluetooth range.
Protected methods:
-
onCreate
- Calls private methods for initializing, configuring and scanning Bluetooh, defines callback functions for theFilter ON/OFF
andMultiple connect
buttons calls private methods for initializing, configuring and scanning Bluetooh, defines callback functions for theFilter ON/OFF
andMultiple connect
buttons
Private methods:
-
getBTDeviceType
- determines the type of the selected Bluetooth device before connecting directly -
getBluetoothAdapterAndLeScanner
- initializes objects of theBluetoothAdapter
andBluetoothLeScanner
classes -
scanLeDevice
- theSCAN
button starts scanning devices until theSTOP
button is pressed
Inner classes:
-
BluetoothDeviceExt
- a class that is an extension of theBluetoothDevice
class. Allows you to more closely link a Bluetooth device and its RSSI
This class implements a mechanism for connecting to a Bluetooth device, similar to the LightManageActivity
class, only for one device. Builds a graphical interface for direct interaction with the services and characteristics of the GATT device through text dialog boxes
This class implements a mechanism for connecting to a Bluetooth device, similar to the LightManageActivity
class, to several BLightESP32 devices at once. Builds a single graphical interface for direct interaction with GATT services and characteristics of all devices at once through text dialog boxes
This module contains classes for storing collections (dictionaries) UUID GATT matches of services, characteristics, descriptors and their names.
Contains a dictionary of service names and their corresponding UUIDs
Contains a dictionary of feature names and their corresponding UUIDs
Contains a dictionary of descriptor names and their corresponding UUIDs
This module contains the implementation of a graphical interface for selecting the light mode in the user mode (User mode) of the application. Implementation by modification of the library Pikolo