-
Notifications
You must be signed in to change notification settings - Fork 12
Ble server #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Ble server #4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AndroidBLEClientConnector.kt opens the gatt server, configure the services and starts advertising BLEServerUUID.kt contains the server services, characteristics uuid BLEConstructorDSL.kt provides a simple way to configure a service, characteristics or description via the domain based models BLEServerGattCallback.kt manages the incomming connection read/ write execution its incomplete yet after the nus is ready it can be tested!
BLEServerConnector.kt included flow for is server running and errors flow as there can be some errors while starting the server BLEServerServiceQueue.kt a queue needed to be maintained as we cannot add service at one go when its added then only the next one can be added Included a battery service, this can be used to read battery of the mobile via BatteryReader.kt DeviceModule.kt will contain device specific providers Converted BLEServerServices values into functions Separated BLEMessageModel.kt into Echo and NUS message models with tx value in nus message BatteryReader.kt uses the battery manager to read the charging state and battery level BLEServerGattCallback.kt changes related to adding new service ,characteristics and descriptor and how to handle each response Battery Service notify is not ready yet will be adding that next
A new environmental sensing service included to read and notify about the light sensor values LightSensorReader.kt reads the ambient light In AndroidBLEServerConnector.kt and BLEServerGattCallback.kt included notifications the values are read and the map is maintained for subscribers according to the last notification client list is made and notified for notification corrected some portion in AndroidBLEServerConnector::onStartServer BLEMessageModel.kt updated and for notification we use BLENotificationModel.kt Included using sensor.light in AndroidManifest.xml
Updating the BLE Client code rename exceptions, included permission checking before calling connect . In BLE Scan logic the auto cancel before timeout logic updated, using the finally clause the stop is always called in-case the scan is stopped or some error is thrown Using locks in SampleUUIDReader.kt so that loading the sample uuid's in memory doesn't happen twice
Also made some Ui Changes Notable changes include adding the service and characteristics count, Using surface in place of card in BluetoothDeviceCard.kt and BluetoothLEDeviceCard.kt is the device is not paired using a different icon color BluetoothLEDeviceCard.kt also include a signal indicator based on the rssi values. In BluetoothPermissionButton.kt checking all the bluetooth based permission include advertise which is used for advertising the server services
User is prompted to start the server with service configuration (yet to build) On starting the server the services and connected client will be shown the user then can stop the server when done, Included BLEServer route in Routes.kt Included BLEServerViewModel.kt in ViewModelModule.kt Drawer navigation to BLEServer screen
BLEServerServices will handle what services the server should run with, on BLEServerConnector.kt onStart it now need a set of services options, the options will be converted to bleServices via BLEServerServicesToGatt.kt IN BLEDeviceViewModel.kt add a toast message to show client re-connected Again some work on the ble server screen and added BLEServerOptionSelectorBottomSheet.kt which will let the user know what services are running or will be ran later IN BLEServerViewModel.kt handling the screen state via BLEServerScreenState.kt
LightSensorReaderImpl.kt some manufacturer may not actually allow the device to register thus need to check if sensor callback is registered BLEServerNotificationManager.kt and BLENotificationTypes.kt now manages the logic for clients subscribed to device based notification battery and illuminance Updated ble_service_uuids.json with new service names Corrections in BLEServerGattCallback.kt, broadcast receivers are register when client count>0 and unregister if client count ==0 LightSensorReaderImpl.kt can give null value if not registered so its a gatt failure Using the sample reader to update all the probable names for services and characteristics AndroidBLEServerConnector.kt the issue that the characteristics change was not notified as the service were not the same, so once the service are registered they are used to set the broadcast channels
Added string resources for most raw strings in ble feature (clients and server) For client included BLEDeviceScreenContent.kt which shows a connecting progress indicator when the client profile is unavailable. Changed the color and shape of BLEDeviceProfile.kt. IN BLEServerOptionSelectorBottomSheet.kt added a checkbox as its tell the user its selected or unselected the color doesn't define that fully Replaced icons in BTAppNavigationDrawer.kt Width of the content in Start server box corrected for classic server
THe blue yellow green theming was looking bad as there was no synergy between the colors thus used a sandy yellow color scheme Removed unwanted resources from the project
Bumped up version no to 1.2.0 Mentioned BLEServer in README.md file
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bluetooth Low Energy Server and UI/UX improvements
Included a full-featured Bluetooth Low Energy (BLE) server, allowing the app to broadcast services and characteristics to connected clients. It also includes significant UI/UX enhancements, bug fixes, and dependency updates.
Changes
UI/UX improvements
Fixes and Refactoring