# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.3] - 2024-12-19

### Changed

- **Code Formatting**: Applied precise formatting to sdk.dart file for improved readability
- **Code Quality**: Minor fixes and improvements for better maintainability

## [0.2.2] - 2024-12-19

### Added

- **Package Name Update**: Changed package name from `feasybeacon_flutter_sdk` to `adonna`
- **Enhanced Package Description**: Updated description to better reflect the plugin's capabilities
- **Improved Homepage Reference**: Added link to Feasycom documentation

### Changed

- **Package Identity**: Updated package name for better branding and clarity
- **Documentation**: Enhanced package description and metadata

## [0.2.1] - 2024-12-19

### Fixed

- **Pub.dev Analysis Issues**: Resolved all formatting and documentation problems
  - Fixed Dart formatting for all source files using `dart format .`
  - Improved code readability with proper line breaks and indentation
  - Enhanced method parameter formatting for better readability
  - Standardized EventChannel declarations with consistent formatting

### Changed

- **Code Formatting**: Improved overall code structure and readability
  - Better parameter formatting for long method signatures
  - Consistent EventChannel declaration formatting
  - Improved method parameter alignment and readability
  - Standardized documentation comment formatting

### Documentation

- **100% API Documentation**: All public methods now have comprehensive documentation
  - Library-level documentation with usage examples
  - Class-level documentation with key features and platform support
  - Method-level documentation with parameters, return values, and examples
  - Organized documentation structure with clear sections

## [0.2.0] - 2024-12-19

### Added

- **Comprehensive Android Background Monitoring**: Complete rewrite with full beacon lifecycle detection
  - **Beacon Power-On Detection**: `beacon_turned_on` event when favorite devices first appear
  - **Button Press Detection**: `button_pressed` event when advertising interval ≤ threshold (fast)
  - **Normal Operation Detection**: `beacon_normal` event when advertising interval > threshold (slow)
  - **Connection-Based Interval Reading**: Connect to beacon and read actual advertising interval parameter
  - **Event Type System**: 5 distinct event types with detailed information
    - `beacon_turned_on`: New favorite beacon detected
    - `button_pressed`: Fast advertising interval (button pressed)
    - `beacon_normal`: Normal advertising interval (standard operation)
    - `connection_failed`: Failed to connect to beacon
    - `interval_read_failed`: Failed to read advertising interval
- **Enhanced Example App UI**: Professional event display system
  - **Color-Coded Events**: Green for power-on, orange for button press, blue for normal operation
  - **Event Icons**: Appropriate icons for each event type (power, touch, bluetooth, error, warning)
  - **Detailed Event Information**: Device name, address, interval value, timestamp
  - **Improved Threshold Configuration**: Helper text explaining button press vs normal logic
  - **Real-Time Event Updates**: Live background events with proper scrolling and layout
- **Cross-Platform Consistency**: Android and iOS now use identical monitoring logic
  - Both platforms detect beacon power-on events
  - Both platforms connect to read advertising interval
  - Both platforms compare interval to threshold for button press detection
  - Both platforms emit consistent event types and data structure

### Changed

- **Android Monitoring Strategy**: Replaced simple interval-based detection with full lifecycle monitoring
  - New devices trigger `beacon_turned_on` event immediately
  - Connection attempts to read actual interval parameters
  - Event determination based on real interval values vs threshold
  - Proper device state tracking and connection management
- **Event Data Structure**: Enhanced background events with comprehensive information
  - Added `eventType` field for event classification
  - Added `intervalMs` field for actual advertising interval
  - Added `timestamp` field for event timing
  - Maintained location and device information
- **Threshold Logic**: Clear distinction between button press and normal operation
  - **≤threshold**: Button pressed (fast advertising)
  - **>threshold**: Normal operation (slow advertising)
  - Default threshold: 200ms for optimal detection

### Fixed

- **Compilation Issues**: Resolved all Android build errors
  - Fixed method signatures for FscBeaconCallbacks interface
  - Corrected BluetoothDeviceWrapper constructor usage
  - Implemented proper connection status checking
  - Added missing abstract method implementations
- **Event Filtering**: Background monitoring now only processes favorite devices
  - Proper address filtering in Android service
  - Consistent behavior across platforms
  - No more false events from non-favorite beacons

### Technical Improvements

- **Documentation**: Comprehensive code comments explaining monitoring strategy
- **Error Handling**: Proper exception handling for connection and reading failures
- **Thread Safety**: Scheduled executor for non-blocking interval checks
- **Resource Management**: Proper cleanup of connections and resources
- **Mock Implementation**: Ready for real GATT characteristic reading implementation

## [0.1.2] - 2024-12-19

### Added

- **iOS SDK 100% Implementation**: All iOS setters now fully implemented
  - `setConnectable(bool)` - Configure device connectability
  - `setGsensor(bool)` - Enable/disable G-sensor functionality
  - `setKey(bool)` - Configure key functionality
  - `setPhy(String)` - Set PHY mode (1M, 2M, Coded)
  - `setLongRange(bool)` - Enable/disable long range mode
- **Enhanced Example App**: Complete redesign with tabbed interface
  - **Devices Tab**: Live BLE scanning with device list and connection controls
  - **Favorites Tab**: Persistent favorite devices with swipe-to-delete
  - **Background Tab**: Android/iOS background monitoring configuration
- **Automatic Favorites**: Devices are automatically added to favorites when connected
- **OTA File Picker**: Real file-based OTA update testing with progress monitoring
- **Device Info Display**: JSON viewer for connected device parameters
- **Background Event Logging**: Real-time display of background monitoring events

### Fixed

- iOS background monitoring now properly handles all parameter types
- All iOS setters return proper boolean responses instead of NotImplementedException
- Example app properly handles device state management and UI updates

### Changed

- Example app now uses Material 3 design with improved UX
- Background monitoring configuration moved to dedicated tab
- Device connection flow improved with automatic scan stopping

## [0.1.1] - 2024-12-19

### Added

- **iOS Background Monitoring**: Region-based monitoring using Core Location
  - iBeacon region monitoring with UUID/major filtering
  - Fast Core Bluetooth connection on region entry
  - Advertising interval threshold detection
  - Local notification triggers
- **Enhanced Example App**: iOS background monitoring UI
  - UUID and major input fields
  - Threshold configuration
  - Background event display
- **Comprehensive iOS SDK Support**: Full API parity with native SDK
  - Beacon CRUD operations (add, update, delete, get)
  - Device parameter management
  - OTA update functionality
  - Low-level packet communication

### Fixed

- Android background monitoring thread safety issues
- iOS method channel parameter handling
- Example app permission handling

## [0.1.0] - 2024-12-19

### Added

- **Core Flutter Plugin**: Cross-platform FeasyBeacon SDK wrapper
- **Android SDK Integration**: Full native SDK functionality
  - BLE scanning and device discovery
  - Device connection and management
  - Parameter configuration (name, PIN, interval, TLM, extensions)
  - Beacon CRUD operations
  - OTA update support
  - Background monitoring service
- **iOS SDK Integration**: Full native SDK functionality
  - BLE scanning and device discovery
  - Device connection and management
  - Parameter configuration
  - Beacon CRUD operations
  - OTA update support
- **Background Monitoring**: Android foreground service for continuous monitoring
  - Fast interval detection (button press)
  - Location-based notifications
  - Event streaming to Flutter
- **Example Application**: Complete demo app with all features
  - BLE scanning interface
  - Device connection controls
  - Parameter configuration
  - Background monitoring controls
- **Comprehensive Testing**: Unit tests for all API methods
- **Documentation**: Complete README and API reference
