A Flutter-based mobile application for controlling smart door locks via Bluetooth Low Energy (BLE). This project provides a user-friendly interface for configuring and managing access control systems.
- Bluetooth LE Connectivity: Seamless connection to BLE-enabled door locks
- Real-time Status: Live monitoring of door lock status and connection state
- Secure Communication: Encrypted command transmission between app and device
- Device Configuration: Easy setup and management of paired devices
- Dark Theme: Modern dark mode UI with intuitive navigation
- Settings Management: Store and manage device credentials and preferences
- Cross-platform: Works on both Android and iOS devices
(Add screenshots of your app in action here)
- Flutter: 3.9.2 or higher
- Dart SDK: 3.9.2 or higher
- Android: API level 21+ (Android 5.0+)
- iOS: iOS 11.0+
- Bluetooth Low Energy (BLE) capable smartphone
- BLE-enabled smart door lock compatible with the app's communication protocol
flutter_blue_plus: ^1.9.0 - Bluetooth LE communicationpermission_handler: ^11.0.0 - Runtime permissions managementshared_preferences: ^2.2.2 - Local data storagecupertino_icons: ^1.0.8 - iOS-style icons
-
Install Flutter:
# Follow the official guide at https://flutter.dev/docs/get-started/install flutter doctor -
Set up development environment:
- Android Studio with Android SDK
- Xcode (for iOS development on macOS)
- VS Code with Flutter extensions (alternative)
-
Clone the repository:
git clone https://github.com/yourusername/ble_access_control.git cd ble_access_control -
Install dependencies:
flutter pub get
-
Configure permissions:
Android (
android/app/src/main/AndroidManifest.xml):<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
iOS (
ios/Runner/Info.plist):<key>NSBluetoothAlwaysUsageDescription</key> <string>This app needs Bluetooth access to control smart door locks</string> <key>NSBluetoothPeripheralUsageDescription</key> <string>This app needs Bluetooth access to control smart door locks</string> <key>NSLocationWhenInUseUsageDescription</key> <string>This app needs location access to discover Bluetooth devices</string>
-
Run the app:
# For development flutter run # For production build flutter build apk # Android APK flutter build ios # iOS build
The app communicates with BLE devices using specific UUIDs. Configure these in lib/core/constants/app_constants.dart:
class AppConstants {
static const String serviceUuid = "4fafc201-1fb5-459e-8fcc-c5c9c331914b";
static const String controlUuid = "beb5483e-36e1-4688-b7f5-ea07361b26a8";
static const String serialUuid = "a1b2c3d4-5678-90ab-cdef-1234567890ab";
}The app uses a command-based communication protocol:
- Command Format:
SECRET|DEVICE_SERIAL|COMMAND - Supported Commands:
LOCK- Lock the doorRELEASE- Unlock the doorALWAYS_ON- Set door to always unlocked mode
lib/
βββ core/
β βββ constants/
β β βββ app_constants.dart # App-wide constants and configurations
β βββ services/
β β βββ bluetooth_service.dart # BLE communication layer
β β βββ notification_service.dart # UI notifications and dialogs
β β βββ storage_service.dart # Local data persistence
β βββ utils/
β βββ error_handler.dart # Error management and logging
β βββ logger.dart # Comprehensive logging system
β βββ debug_helper.dart # Debug utilities
βββ models/
β βββ bluetooth_device_info.dart # BLE device data model
β βββ door_state.dart # Door lock state management
βββ viewmodels/
β βββ door_viewmodel.dart # Main door control logic
β βββ settings_viewmodel.dart # Settings management
βββ views/
βββ home_view.dart # Main user interface
βββ settings_view.dart # Configuration and settings
We welcome contributions! Here's how you can help:
-
Fork the repository
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes and follow the code style:
- Use
flutter analyzeto check for issues - Run
flutter testbefore submitting - Follow the existing coding conventions
- Use
-
Test thoroughly:
flutter test flutter analyze -
Commit your changes:
git commit -m "feat: add your feature description" -
Push to your fork and create a pull request
- Follow effective dart guidelines
- Use meaningful variable and function names
- Add appropriate comments for complex logic
- Ensure proper error handling throughout the app
-
Bluetooth not working:
- Ensure Bluetooth is enabled on your device
- Check that location permissions are granted (required for BLE scanning on Android)
- Verify that your BLE device is advertising correctly
-
Build failures:
flutter clean flutter pub get flutter doctor # Check for environment issues -
Connection issues:
- Check if the device is within range
- Verify the UUIDs match your hardware configuration
- Ensure the device is not already connected to another app
-
Permission denied errors:
- Go to Settings > Apps > [Your App] > Permissions
- Grant all required permissions (Bluetooth, Location)
Enable debug logging by setting DebugHelper.setDebugMode(true) in main.dart. This will provide detailed logs for troubleshooting.
This project is licensed under the MIT License - see the LICENSE file for details.
- Flutter - Cross-platform development framework
- flutter_blue_plus - BLE communication library
- The Flutter community for excellent packages and support
- π§ Email: revanza.firdaus@gmail.com.com
- π Issues: GitHub Issues
Built with β€οΈ