Skip to content

Conversation

Xicrosoft
Copy link

This pull request introduces a new feature to manage display sleep behavior based on RSSI (Received Signal Strength Indicator) thresholds in the BLEUnlock application. The key changes include adding a "Sleep RSSI" menu, updating the logic to handle display sleep based on RSSI, and extending localization files to support the new feature.

Close #153

Warning

As mentioned in #84, the original code's display sleep functionality does not appear to work as expected.
This pull request does not modify that logic and continues to use the original implementation.

Feature Addition: Sleep RSSI Menu

  • Added a new sleepRSSIMenu to the app, along with logic to manage its state and validate menu items based on RSSI thresholds. (BLEUnlock/AppDelegate.swift: [1] [2] [3]
  • Introduced logic to trigger display sleep when the RSSI falls below the specified "Sleep RSSI" threshold, preventing unnecessary locking. (BLEUnlock/AppDelegate.swift: BLEUnlock/AppDelegate.swiftR248-R254)
  • Added a method setSleepRSSI to handle updates to the "Sleep RSSI" value and persist it in user preferences. (BLEUnlock/AppDelegate.swift: BLEUnlock/AppDelegate.swiftR523-R528)
  • Updated the app's initialization to load the "Sleep RSSI" value from user preferences. (BLEUnlock/AppDelegate.swift: BLEUnlock/AppDelegate.swiftR725-R728)
  • Added a new property sleepRSSI to the BLE class to store the RSSI threshold for triggering display sleep. (BLEUnlock/BLE.swift: BLEUnlock/BLE.swiftR132)

Localization Updates

- Introduced sleepRSSI menu to allow the display to sleep based on Bluetooth signal strength.
- Updated BLE class to include a sleepRSSI property.
- Updated localization files to include "sleep_rssi".

Note:
As mentioned in ts1#84, the original code's display sleep functionality does not appear to work as expected.
This commit does not modify that logic and continues to use the original implementation.

Signed-off-by: Noah <xicrosofts@gmail.com>
Signed-off-by: Noah <xicrosofts@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance Lock and Sleep Logic Based on Bluetooth Signal Strength Thresholds
1 participant