diff --git a/.editorconfig b/.editorconfig
index 005f2c7ad..2b8edd122 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -16,5 +16,5 @@ indent_size = 4
trim_trailing_whitespace = false
max_line_length = off
-[*.{py,java,r,R,kt,xml,kts}]
+[*.{py,java,r,R,kt,xml,kts,h,hpp,cpp,qml}]
indent_size = 4
diff --git a/AAP Definitions.md b/AAP Definitions.md
index 42dc6025c..87b23d905 100644
--- a/AAP Definitions.md
+++ b/AAP Definitions.md
@@ -122,7 +122,7 @@ If primary is removed, mic will be changed and the secondary will be the new pri
## Conversational Awareness
-AirPods send conversational awareness packets when the person wearing them start speaking. The packet format is as follows:
+AirPods send conversational awareness packets when the person wearing them starts speaking. The packet format is as follows:
```plaintext
04 00 04 00 4B 00 02 00 01 [level]
@@ -307,7 +307,7 @@ All values are formatted as IEEE 754 floats in little endian order.
## Configure Stem Long Press
-I have noted all the packets sent to configure what the press and hold of the steam should do. The packets sent are specific to the current state. And are probably overwritten everytime the AirPods are connected to a new (apple) device that is not synced with icloud (i think)... So, for non-Apple device too, the configuration needs to be stored and overwritten everytime the AirPods are connected to the device. That is the only way to keep the configuration.
+I have noted all the packets sent to configure what the press and hold of the steam should do. The packets sent are specific to the current state. And are probably overwritten everytime the AirPods are connected to a new (apple) device that is not synced with icloud (i think)... So, for non-Apple devices too, the configuration needs to be stored and overwritten everytime the AirPods are connected to the device. That is the only way to keep the configuration.
This is also the only way to control the configuration as the previous state needs to be known, and then the new state can be set.
@@ -403,20 +403,3 @@ Once tracking is active, the AirPods stream sensor packets with the following co
| orientation 3 | 47 | 2 |
| Horizontal Acceleration | 51 | 2 |
| Vertical Acceleration | 53 | 2 |
-
-# LICENSE
-
-LibrePods - AirPods liberated from Apple’s ecosystem
-Copyright (C) 2025 LibrePods contributors
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published
-by the Free Software Foundation, either version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program. If not, see .
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index a75bca6fd..000000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,128 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-We as members, contributors, and leaders pledge to make participation in our
-community a harassment-free experience for everyone, regardless of age, body
-size, visible or invisible disability, ethnicity, sex characteristics, gender
-identity and expression, level of experience, education, socio-economic status,
-nationality, personal appearance, race, religion, or sexual identity
-and orientation.
-
-We pledge to act and interact in ways that contribute to an open, welcoming,
-diverse, inclusive, and healthy community.
-
-## Our Standards
-
-Examples of behavior that contributes to a positive environment for our
-community include:
-
-* Demonstrating empathy and kindness toward other people
-* Being respectful of differing opinions, viewpoints, and experiences
-* Giving and gracefully accepting constructive feedback
-* Accepting responsibility and apologizing to those affected by our mistakes,
- and learning from the experience
-* Focusing on what is best not just for us as individuals, but for the
- overall community
-
-Examples of unacceptable behavior include:
-
-* The use of sexualized language or imagery, and sexual attention or
- advances of any kind
-* Trolling, insulting or derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or email
- address, without their explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Enforcement Responsibilities
-
-Community leaders are responsible for clarifying and enforcing our standards of
-acceptable behavior and will take appropriate and fair corrective action in
-response to any behavior that they deem inappropriate, threatening, offensive,
-or harmful.
-
-Community leaders have the right and responsibility to remove, edit, or reject
-comments, commits, code, wiki edits, issues, and other contributions that are
-not aligned to this Code of Conduct, and will communicate reasons for moderation
-decisions when appropriate.
-
-## Scope
-
-This Code of Conduct applies within all community spaces, and also applies when
-an individual is officially representing the community in public spaces.
-Examples of representing our community include using an official e-mail address,
-posting via an official social media account, or acting as an appointed
-representative at an online or offline event.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported to the community leaders responsible for enforcement at
-report@kavishdevar.me.
-All complaints will be reviewed and investigated promptly and fairly.
-
-All community leaders are obligated to respect the privacy and security of the
-reporter of any incident.
-
-## Enforcement Guidelines
-
-Community leaders will follow these Community Impact Guidelines in determining
-the consequences for any action they deem in violation of this Code of Conduct:
-
-### 1. Correction
-
-**Community Impact**: Use of inappropriate language or other behavior deemed
-unprofessional or unwelcome in the community.
-
-**Consequence**: A private, written warning from community leaders, providing
-clarity around the nature of the violation and an explanation of why the
-behavior was inappropriate. A public apology may be requested.
-
-### 2. Warning
-
-**Community Impact**: A violation through a single incident or series
-of actions.
-
-**Consequence**: A warning with consequences for continued behavior. No
-interaction with the people involved, including unsolicited interaction with
-those enforcing the Code of Conduct, for a specified period of time. This
-includes avoiding interactions in community spaces as well as external channels
-like social media. Violating these terms may lead to a temporary or
-permanent ban.
-
-### 3. Temporary Ban
-
-**Community Impact**: A serious violation of community standards, including
-sustained inappropriate behavior.
-
-**Consequence**: A temporary ban from any sort of interaction or public
-communication with the community for a specified period of time. No public or
-private interaction with the people involved, including unsolicited interaction
-with those enforcing the Code of Conduct, is allowed during this period.
-Violating these terms may lead to a permanent ban.
-
-### 4. Permanent Ban
-
-**Community Impact**: Demonstrating a pattern of violation of community
-standards, including sustained inappropriate behavior, harassment of an
-individual, or aggression toward or disparagement of classes of individuals.
-
-**Consequence**: A permanent ban from any sort of public interaction within
-the community.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage],
-version 2.0, available at
-https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
-
-Community Impact Guidelines were inspired by [Mozilla's code of conduct
-enforcement ladder](https://github.com/mozilla/diversity).
-
-[homepage]: https://www.contributor-covenant.org
-
-For answers to common questions about this code of conduct, see the FAQ at
-https://www.contributor-covenant.org/faq. Translations are available at
-https://www.contributor-covenant.org/translations.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 91629e341..000000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# Welcome to LibrePods contributing guide
-
-Thank you for considering a contribution to LibrePods! Your support helps bring Apple-exclusive AirPods features to Linux and Android.
-
-Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approachable and respectful.
-
-This guide provides an overview of the contribution workflow, from opening an issue to creating and reviewing a pull request (PR).
-
-## New contributor guide
-
-To get an overview of the project, read the [README](./README.md). Here are some resources to help you get started with open-source contributions:
-
-- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
-- [Set up Git](https://docs.github.com/en/get-started/getting-started-with-git/set-up-git)
-- [GitHub flow](https://docs.github.com/en/get-started/using-github/github-flow)
-- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)
-
-## Getting started
-
-To navigate our codebase with confidence, see the [README](./README.md) for setup instructions and usage details. We accept various types of contributions, which don’t always require writing code (like translations).
-
-To develop for the Android App, Android Studio is the preferred IDE. And you can use any IDE for the linux program, it is just python!
-
-### Issues
-
-#### Create a new issue
-
-If you find a bug or want to suggest a feature, check if an issue already exists by searching through our [existing issues](https://github.com/kavishdevar/librepods/issues). If no relevant issue exists, open a new one and fill in the details.
-
-#### Solve an issue
-
-Browse our [issues list](https://github.com/kavishdevar/librepods/issues) to find an interesting issue to work on. Use labels to filter issues and pick one that matches your expertise. If you’d like to work on an issue, open a PR with your solution.
-
-### Make Changes
-
-#### Make changes locally
-
-1. Fork the repository and clone it to your local environment.
-```
-git clone https://github.com/kavishdevar/librepods.git
-cd AirPods-Like-Normal
-```
-2. Create a working branch to start your changes.
-```
-git checkout -b your-feature-branch
-```
-3. Make your changes, following the existing style and structure.
-
-4. Test your changes to ensure they work as expected and do not introduce new issues.
-
-### Commit your changes
-
-Commit your changes with a descriptive message.
-
-### Pull Request
-
-When your changes are ready, create a pull request (PR):
-- Fill out the PR template to help reviewers understand your changes.
-- If your PR is related to an issue, don’t forget to [link your PR to it](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
-- Enable the checkbox to allow maintainers to edit your PR, so any required changes can be merged easily.
-
-Once your PR is open, a team member will review it. They may ask questions or request additional information.
-
-- If changes are requested, apply them in your fork and commit them to the PR branch.
-- Mark conversations as resolved as you apply feedback.
-- For merge conflicts, follow this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to resolve them.
-
-### Your PR is merged!
-
-Congratulations! :tada: Once merged, your contributions will be publicly available in LibrePods.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index 29ebfa545..81aaff562 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
@@ -7,15 +7,17 @@
Preamble
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
+the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
-software for all its users.
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
@@ -24,34 +26,44 @@ them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
@@ -60,7 +72,7 @@ modification follow.
0. Definitions.
- "This License" refers to version 3 of the GNU Affero General Public License.
+ "This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
@@ -537,45 +549,35 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
+ 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
+under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
+Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
+GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
+versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
@@ -633,29 +635,40 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
+ GNU General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
+ You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
\ No newline at end of file
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
\ No newline at end of file
diff --git a/README.md b/README.md
index c533b170e..a515c1924 100644
--- a/README.md
+++ b/README.md
@@ -1,29 +1,36 @@
-
+
-[](https://xdaforums.com/t/app-root-for-now-airpodslikenormal-unlock-apple-exclusive-airpods-features-on-android.4707585/)
-[](https://github.com/kavishdevar/librepods/releases/latest)
-[](https://github.com/kavishdevar/librepods/releases)
-[](https://github.com/kavishdevar/librepods/stargazers)
-[](https://github.com/kavishdevar/librepods/issues)
-[](https://github.com/kavishdevar/librepods/blob/main/LICENSE)
-[](https://github.com/kavishdevar/librepods/graphs/contributors)
+>[!IMPORTANT]
+Development paused due to lack of time until 17th May 2026 (JEE Advanced). PRs and issues might not be responded to until then.
+
-## What is LibrePods?
+# What is LibrePods?
LibrePods unlocks Apple's exclusive AirPods features on non-Apple devices. Get access to noise control modes, adaptive transparency, ear detection, hearing aid, customized transparency mode, battery status, and more - all the premium features you paid for but Apple locked to their ecosystem.
-## Device Compatibility
+# Device Compatibility
| Status | Device | Features |
| ------ | --------------------- | ---------------------------------------------------------- |
| ✅ | AirPods Pro (2nd Gen) | Fully supported and tested |
| ✅ | AirPods Pro (3rd Gen) | Fully supported (except heartrate monitoring) |
+| ✅ | AirPods Max | Fully supported (client shows unsupported features) |
| ⚠️ | Other AirPods models | Basic features (battery status, ear detection) should work |
-Most features should work with any AirPods. Currently, I've only got AirPods Pro 2 to test with.
+Most features should work with any AirPods. Currently, I've only got AirPods Pro 2 to test with. But, I believe the protocol remains the same for all other AirPods (based on analysis of the bluetooth stack on macOS).
-## Key Features
+# Key Features
- **Noise Control Modes**: Easily switch between noise control modes without having to reach out to your AirPods to long press
- **Ear Detection**: Controls your music automatically when you put your AirPods in or take them out, and switch to phone speaker when you take them out
@@ -36,83 +43,101 @@ Most features should work with any AirPods. Currently, I've only got AirPods Pro
- **Other customizations**:
- Rename your AirPods
- Customize long-press actions
- - Few accessibility features
+ - All accessibility settings
- And more!
-See our [pinned issue](https://github.com/kavishdevar/librepods/issues/20) for a complete feature list and roadmap.
+* Features marked with an asterisk require the VendorID to be change to that of Apple.
-## Platform Support
+# Platform Support
-### Linux
+## Linux
+for the old version see the [Linux README](./linux/README.md). (doesn't have many features, maintainer didn't have time to work on it)
-The Linux version runs as a system tray app. Connect your AirPods and enjoy:
+new version in development ([#241](https://github.com/kavishdevar/librepods/pull/241))
-- Battery monitoring
-- Automatic Ear detection
-- Conversational Awareness
-- Switching Noise Control modes
-- Device renaming
+
-> [!NOTE]
-> Work in progress, but core functionality is stable and usable.
+## Android
-For installation and detailed info, see the [Linux README](/linux/README.md).
+### Screenshots
-### Android
-
-#### Screenshots
-
-| | | |
-| -------------------------------------------------------------------------------------- | ------------------------------------------------- | --------------------------------------------------------------------------- |
-|  |  |  |
-|  |  |  |
-|  |  |  |
-|  |  |  |
-|  |  |  |
+| | | |
+| --------------------------------------------------------------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------- |
+|  |  |  |
+|  |  |  |
+|  |  |  |
+|  |  |  |
+|  |  |  |
here's a very unprofessional demo video
https://github.com/user-attachments/assets/43911243-0576-4093-8c55-89c1db5ea533
-#### Root Requirement
+### Root Requirement
-> [!CAUTION]
-> **You must have a rooted device with Xposed to use LibrePods on Android.** This is due to a [bug in the Android Bluetooth stack](https://issuetracker.google.com/issues/371713238). Please upvote the issue by clicking the '+1' icon on the IssueTracker page.
->
-> There are **no exceptions** to the root requirement until Google merges the fix.
+If you are using ColorOS/OxygenOS 16, Android 16 QPR3, Android 17 Beta 3 or higher, you don't need root except for customizing transparency mode, setting up hearing aid, and use Bluetooth Multipoint. Changing ANC, conversational awareness, ear detection, and other customizations will work without root.
-Until then, you must xposed. I used to provide a non-xposed method too, where the module used overlayfs to replace the bluetooth library with a locally patched one, but that was broken due to how various devices handled overlayfs and a patched library. With xposed, you can also enable the DID hook enabling a few extra features.
+For everyone else:
+**You must have a rooted device with Xposed to use LibrePods on Android.**
-## Bluetooth DID (Device Identification) Hook
+### A few notes
-Turns out, if you change the manufacturerid to that of Apple, you get access to several special features!
+- Due to recent AirPods' firmware upgrades, you must enable `Off listening mode` to switch to `Off`. This is because in this mode, loud sounds are not reduced.
-### Multi-device Connectivity
+- If you have take both AirPods out, the app will automatically switch to the phone speaker. But, Android might keep on trying to connect to the AirPods because the phone is still connected to them, just the A2DP profile is not connected. The app tries to disconnect the A2DP profile as soon as it detects that Android has connected again if they're not in the ear.
-Upto two devices can be simultaneously connected to AirPods, for audio and control both. Seamless connection switching. The same notification shows up on Apple device when Android takes over the AirPods as if it were an Apple device ("Move to iPhone"). Android also shows a popup when the other device takes over.
+- When renaming your AirPods through the app, you'll need to re-pair them with your phone for the name change to take effect. This is a limitation of how Bluetooth device naming works on Android.
+
+- If you want the AirPods icon and battery status to show in Android Settings app, install the app as a system app by using the root module.
-### Accessibility Settings and Hearing Aid
+# Changing VendorID in the DID profile to that of Apple
-Accessibility settings like customizing transparency mode (amplification, balance, tone, conversation boost, and ambient noise reduction), and loud sound reduction can be configured.
+Turns out, if you change the VendorID in DID Profile to that of Apple, you get access to several special features!
-All hearing aid customizations can be done from Android, including setting the audiogram result. The app doesn't provide a way to take a hearing test because it requires much more precision. It is much better to use an already available audiogram result.
+You can do this on Linux by editing the DeviceID in `/etc/bluetooth/main.conf`. Add this line to the config file `DeviceID = bluetooth:004C:0000:0000`. For android you can enable the `act as Apple device` setting in the app's settings.
-To enable these features, enable App Settings -> `act as Apple Device`.
+## Multi-device Connectivity
-#### A few notes
+Upto two devices can be simultaneously connected to AirPods, for audio and control both. Seamless connection switching. The same notification shows up on Apple device when Android takes over the AirPods as if it were an Apple device ("Move to iPhone"). Android also shows a popup when the other device takes over.
-- Due to recent AirPods' firmware upgrades, you must enable `Off listening mode` to switch to `Off`. This is because in this mode, louds sounds are not reduced.
+## Accessibility Settings and Hearing Aid
-- If you have take both AirPods out, the app will automatically switch to the phone speaker. But, Android might keep on trying to connect to the AirPods because the phone is still connected to them, just the A2DP profile is not connected. The app tries to disconnect the A2DP profile as soon as it detects that Android has connected again if they're not in the ear.
+Accessibility settings like customizing transparency mode (amplification, balance, tone, conversation boost, and ambient noise reduction), and loud sound reduction can be configured.
-- When renaming your AirPods through the app, you'll need to re-pair them with your phone for the name change to take effect. This is a limitation of how Bluetooth device naming works on Android.
+All hearing aid customizations can be done from Android (linux soon), including setting the audiogram result. The app doesn't provide a way to take a hearing test because it requires much more precision. It is much better to use an already available audiogram result.
-- If you want the AirPods icon and battery status to show in Android Settings app, install the app as a system app by using the root module.
+# Supporters
+
+A huge thank you to everyone supporting the project!
+- @davdroman
+- @tedsalmon
+- @wiless
+- @SmartMsg
+- @lunaroyster
+- @ressiwage
+
+# Special thanks
+- @tyalie for making the first documentation on the protocol! ([tyalie/AAP-Protocol-Definition](https://github.com/tyalie/AAP-Protocol-Defintion))
+- @rithvikvibhu and folks over at lagrangepoint for helping with the hearing aid feature ([gist](https://gist.github.com/rithvikvibhu/45e24bbe5ade30125f152383daf07016))
+- @devnoname120 for helping with the first root patch
+- @timgromeyer for making the first version of the linux app
+- @hackclub for hosting [High Seas](https://highseas.hackclub.com) and [Low Skies](https://low-skies.hackclub.com)!
+
+# Alternates for other platforms:
+- CAPod - A companion app for AirPods on Android. ([play store](https://play.google.com/store/apps/details?id=eu.darken.capod) | [source code](https://github.com/d4rken-org/capod)). Use this if you're using Android version 16 QPR3 or below and are not rooted.
+- MagicPods for Steam Deck ([website](https://magicpods.app/steamdeck/))
+- MagicPods - if you're looking for "LibrePods for Windows" ([ms store](https://apps.microsoft.com/store/detail/9P6SKKFKSHKM) [installer](https://magicpods.app/installer/MagicPods.appinstaller) | [website](https://magicpods.app/))
-## Star History
+# Star History
-[](https://star-history.com/#kavishdevar/librepods&Date)
+
+
+
+
+
+
+
# License
@@ -120,15 +145,16 @@ LibrePods - AirPods liberated from Apple’s ecosystem
Copyright (C) 2025 LibrePods contributors
This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published
-by the Free Software Foundation, either version 3 of the License.
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Affero General Public License for more details.
+GNU General Public License for more details.
-You should have received a copy of the GNU Affero General Public License
-along with this program over [here](/LICENSE). If not, see .
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
All trademarks, logos, and brand names are the property of their respective owners. Use of them does not imply any affiliation with or endorsement by them. All AirPods images, symbols, and the SF Pro font are the property of Apple Inc.
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
index fe0c8bd61..e111da42b 100644
--- a/android/app/build.gradle.kts
+++ b/android/app/build.gradle.kts
@@ -12,9 +12,9 @@ android {
defaultConfig {
applicationId = "me.kavishdevar.librepods"
- minSdk = 28
+ minSdk = 33
targetSdk = 36
- versionCode = 8
+ versionCode = 9
versionName = "0.2.0"
}
@@ -38,6 +38,9 @@ android {
compose = true
viewBinding = true
}
+ androidResources {
+ generateLocaleConfig = true
+ }
externalNativeBuild {
cmake {
path = file("src/main/cpp/CMakeLists.txt")
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 8474e9107..20b58c82e 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -10,8 +10,6 @@
-
diff --git a/android/app/src/main/cpp/l2c_fcr_hook.cpp b/android/app/src/main/cpp/l2c_fcr_hook.cpp
index 70fb3fdd6..6e6a4e6d2 100644
--- a/android/app/src/main/cpp/l2c_fcr_hook.cpp
+++ b/android/app/src/main/cpp/l2c_fcr_hook.cpp
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
#include
#include
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt b/android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt
index 3e589b6a6..8de1b77d4 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
@@ -156,10 +156,6 @@ class MainActivity : ComponentActivity() {
setContent {
LibrePodsTheme {
- getSharedPreferences("settings", MODE_PRIVATE).edit {
- putLong(
- "textColor",
- MaterialTheme.colorScheme.onSurface.toArgb().toLong())}
Main()
}
}
@@ -381,7 +377,7 @@ fun Main() {
TroubleshootingScreen(navController)
}
composable("head_tracking") {
- HeadTrackingScreen(navController)
+ HeadTrackingScreen()
}
composable("onboarding") {
Onboarding(navController, context)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/QuickSettingsDialogActivity.kt b/android/app/src/main/java/me/kavishdevar/librepods/QuickSettingsDialogActivity.kt
index bd46412b5..85a957306 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/QuickSettingsDialogActivity.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/QuickSettingsDialogActivity.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/AboutCard.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/AboutCard.kt
index 264f941b2..f4c20676c 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/AboutCard.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/AboutCard.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/AudioSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/AudioSettings.kt
index 8a0da0c67..f6dbaa60a 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/AudioSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/AudioSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryIndicator.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryIndicator.kt
index 3beef1c00..b34ffc4e2 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryIndicator.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryIndicator.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryView.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryView.kt
index 62893f700..9dfb9d441 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryView.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/BatteryView.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/CallControlSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/CallControlSettings.kt
index 616e8ac14..09b80ff2a 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/CallControlSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/CallControlSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/ConfirmationDialog.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/ConfirmationDialog.kt
index 7a40f3d59..e2c347bb9 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/ConfirmationDialog.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/ConfirmationDialog.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/ConnectionSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/ConnectionSettings.kt
index 4d07eeaae..a21bfd129 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/ConnectionSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/ConnectionSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterButton.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterButton.kt
index 6de28766f..241363bf5 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterButton.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterButton.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:Suppress("unused")
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterNoiseControlSegmentedButton.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterNoiseControlSegmentedButton.kt
index 743e918ad..c41fdab93 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterNoiseControlSegmentedButton.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/ControlCenterNoiseControlSegmentedButton.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/HearingHealthSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/HearingHealthSettings.kt
index 725acad05..fe7548914 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/HearingHealthSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/HearingHealthSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/MicrophoneSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/MicrophoneSettings.kt
index 2c1b4a086..bba8c70b8 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/MicrophoneSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/MicrophoneSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/NavigationButton.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/NavigationButton.kt
index 8d96a54d0..c66f2bc65 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/NavigationButton.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/NavigationButton.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlButton.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlButton.kt
index 504c9d053..6c7ec361e 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlButton.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlButton.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlSettings.kt
index 1dd01b4d2..d613d4bea 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/NoiseControlSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/PressAndHoldSettings.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/PressAndHoldSettings.kt
index 4c5deeae7..1eddfafcb 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/PressAndHoldSettings.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/PressAndHoldSettings.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledButton.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledButton.kt
index 01438bdfc..93ea96e15 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledButton.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledButton.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledDropdown.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledDropdown.kt
index 73cf74493..394c15575 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledDropdown.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledDropdown.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledIconButton.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledIconButton.kt
index 5f7071879..6454ee5a6 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledIconButton.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledIconButton.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledScaffold.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledScaffold.kt
index 6c034f90f..21fdc19fc 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledScaffold.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledScaffold.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSelectList.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSelectList.kt
index 58e196c86..c91fa1bf6 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSelectList.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSelectList.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSlider.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSlider.kt
index 3aba12635..495b5991b 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSlider.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSlider.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSwitch.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSwitch.kt
index 621a4d34c..0799281bc 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSwitch.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledSwitch.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledToggle.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledToggle.kt
index 2afd64b05..4b578e7d8 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledToggle.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/StyledToggle.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
@@ -472,7 +472,12 @@ fun StyledToggle(
val attManager = ServiceManager.getService()?.attManager ?: return
val isDarkTheme = isSystemInDarkTheme()
val textColor = if (isDarkTheme) Color.White else Color.Black
- val checkedValue = attManager.read(attHandle).getOrNull(0)?.toInt()
+ val checkedValue = try {
+ attManager.read(attHandle).getOrNull(0)?.toInt()
+ } catch (e: Exception) {
+ Log.w("StyledToggle", "Error reading initial value for $label: ${e.message}")
+ null
+ } ?: 0
var checked by remember { mutableStateOf(checkedValue !=0) }
var backgroundColor by remember { mutableStateOf(if (isDarkTheme) Color(0xFF1C1C1E) else Color(0xFFFFFFFF)) }
val animatedBackgroundColor by animateColorAsState(targetValue = backgroundColor, animationSpec = tween(durationMillis = 500))
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/composables/VerticalVolumeSlider.kt b/android/app/src/main/java/me/kavishdevar/librepods/composables/VerticalVolumeSlider.kt
index 8929ca649..8c82da4f6 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/composables/VerticalVolumeSlider.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/composables/VerticalVolumeSlider.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.composables
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/constants/Packets.kt b/android/app/src/main/java/me/kavishdevar/librepods/constants/Packets.kt
index 943f52b85..3c83a1ac2 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/constants/Packets.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/constants/Packets.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.constants
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/constants/StemAction.kt b/android/app/src/main/java/me/kavishdevar/librepods/constants/StemAction.kt
index 206fc3269..ddf74c0e2 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/constants/StemAction.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/constants/StemAction.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.constants
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/receivers/BootReceiver.kt b/android/app/src/main/java/me/kavishdevar/librepods/receivers/BootReceiver.kt
index 7a240c6be..180a7e953 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/receivers/BootReceiver.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/receivers/BootReceiver.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/AccessibilitySettingsScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/AccessibilitySettingsScreen.kt
index 0a37dfd32..0f64d59ac 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/AccessibilitySettingsScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/AccessibilitySettingsScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
@@ -160,9 +160,9 @@ fun AccessibilitySettingsScreen(navController: NavController) {
val mediaEQEnabled = remember { mutableStateOf(false) }
val pressSpeedOptions = mapOf(
- 0.toByte() to "Default",
- 1.toByte() to "Slower",
- 2.toByte() to "Slowest"
+ 0.toByte() to stringResource(R.string.default_option),
+ 1.toByte() to stringResource(R.string.slower),
+ 2.toByte() to stringResource(R.string.slowest)
)
val selectedPressSpeedValue =
aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.DOUBLE_CLICK_INTERVAL }?.value?.takeIf { it.isNotEmpty() }
@@ -196,9 +196,9 @@ fun AccessibilitySettingsScreen(navController: NavController) {
}
val pressAndHoldDurationOptions = mapOf(
- 0.toByte() to "Default",
- 1.toByte() to "Slower",
- 2.toByte() to "Slowest"
+ 0.toByte() to stringResource(R.string.default_option),
+ 1.toByte() to stringResource(R.string.slower),
+ 2.toByte() to stringResource(R.string.slowest)
)
val selectedPressAndHoldDurationValue =
aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.CLICK_HOLD_INTERVAL }?.value?.takeIf { it.isNotEmpty() }
@@ -234,9 +234,9 @@ fun AccessibilitySettingsScreen(navController: NavController) {
}
val volumeSwipeSpeedOptions = mapOf(
- 1.toByte() to "Default",
- 2.toByte() to "Longer",
- 3.toByte() to "Longest"
+ 1.toByte() to stringResource(R.string.default_option),
+ 2.toByte() to stringResource(R.string.longer),
+ 3.toByte() to stringResource(R.string.longest)
)
val selectedVolumeSwipeSpeedValue =
aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.VOLUME_SWIPE_INTERVAL }?.value?.takeIf { it.isNotEmpty() }
@@ -322,7 +322,7 @@ fun AccessibilitySettingsScreen(navController: NavController) {
label = stringResource(R.string.press_speed),
description = stringResource(R.string.press_speed_description),
options = pressSpeedOptions.values.toList(),
- selectedOption = selectedPressSpeed?: "Default",
+ selectedOption = selectedPressSpeed?: stringResource(R.string.default_option),
onOptionSelected = { newValue ->
selectedPressSpeed = newValue
aacpManager?.sendControlCommand(
@@ -340,7 +340,7 @@ fun AccessibilitySettingsScreen(navController: NavController) {
label = stringResource(R.string.press_and_hold_duration),
description = stringResource(R.string.press_and_hold_duration_description),
options = pressAndHoldDurationOptions.values.toList(),
- selectedOption = selectedPressAndHoldDuration?: "Default",
+ selectedOption = selectedPressAndHoldDuration?: stringResource(R.string.default_option),
onOptionSelected = { newValue ->
selectedPressAndHoldDuration = newValue
aacpManager?.sendControlCommand(
@@ -403,7 +403,7 @@ fun AccessibilitySettingsScreen(navController: NavController) {
label = stringResource(R.string.volume_swipe_speed),
description = stringResource(R.string.volume_swipe_speed_description),
options = volumeSwipeSpeedOptions.values.toList(),
- selectedOption = selectedVolumeSwipeSpeed?: "Default",
+ selectedOption = selectedVolumeSwipeSpeed?: stringResource(R.string.default_option),
onOptionSelected = { newValue ->
selectedVolumeSwipeSpeed = newValue
aacpManager?.sendControlCommand(
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/AdaptiveStrengthScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/AdaptiveStrengthScreen.kt
index e6e537b8a..151be9c5f 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/AdaptiveStrengthScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/AdaptiveStrengthScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/AirPodsSettingsScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/AirPodsSettingsScreen.kt
index 90ef913a3..8566348d4 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/AirPodsSettingsScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/AirPodsSettingsScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
@@ -218,7 +218,9 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
val darkMode = isSystemInDarkTheme()
val hazeStateS = remember { mutableStateOf(HazeState()) }
- val showDialog = remember { mutableStateOf(!sharedPreferences.getBoolean("donationDialogShown", false)) }
+ // val showDialog = remember { mutableStateOf(!sharedPreferences.getBoolean("donationDialogShown", false)) }
+
+ val showDialog = remember { mutableStateOf(false) }
StyledScaffold(
title = deviceName.text,
@@ -384,7 +386,7 @@ fun AirPodsSettingsScreen(dev: BluetoothDevice?, service: AirPodsService,
.fillMaxWidth(0.9f)
) {
Text(
- text = "Troubleshoot Connection",
+ text = stringResource(R.string.troubleshooting),
style = TextStyle(
fontSize = 16.sp,
fontWeight = FontWeight.Medium,
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt
index 5dc271457..feac543cc 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/AppSettingsScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/CameraControlScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/CameraControlScreen.kt
index 8f5c5295b..7ad0f2954 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/CameraControlScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/CameraControlScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/DebugScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/DebugScreen.kt
index 27db1f8ea..401fc91a6 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/DebugScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/DebugScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalHazeMaterialsApi::class, ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/HeadTrackingScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/HeadTrackingScreen.kt
index 6dcf5214f..f3c841627 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/HeadTrackingScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/HeadTrackingScreen.kt
@@ -1,20 +1,23 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+
+// this is absolutely unnecessary, why did I make this. a simple toggle would've sufficed
@file:OptIn(ExperimentalEncodingApi::class)
@@ -83,7 +86,6 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
-import androidx.navigation.NavController
import com.kyant.backdrop.backdrops.layerBackdrop
import com.kyant.backdrop.backdrops.rememberLayerBackdrop
import dev.chrisbanes.haze.hazeSource
@@ -108,7 +110,7 @@ import kotlin.random.Random
@RequiresApi(Build.VERSION_CODES.Q)
@OptIn(ExperimentalMaterial3Api::class, ExperimentalAnimationApi::class)
@Composable
-fun HeadTrackingScreen(navController: NavController) {
+fun HeadTrackingScreen() {
DisposableEffect(Unit) {
ServiceManager.getService()?.startHeadTracking()
onDispose {
@@ -743,5 +745,5 @@ private fun AccelerationPlot() {
@Preview
@Composable
fun HeadTrackingScreenPreview() {
- HeadTrackingScreen(navController = NavController(LocalContext.current))
+ HeadTrackingScreen()
}
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidAdjustmentsScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidAdjustmentsScreen.kt
index 34cb87577..6925fbb8c 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidAdjustmentsScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidAdjustmentsScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
@@ -96,13 +96,10 @@ fun HearingAidAdjustmentsScreen(@Suppress("unused") navController: NavController
val toneSliderValue = remember { mutableFloatStateOf(0.5f) }
val ambientNoiseReductionSliderValue = remember { mutableFloatStateOf(0.0f) }
val conversationBoostEnabled = remember { mutableStateOf(false) }
- val eq = remember { mutableStateOf(FloatArray(8)) }
+ val leftEQ = remember { mutableStateOf(FloatArray(8)) }
+ val rightEQ = remember { mutableStateOf(FloatArray(8)) }
val ownVoiceAmplification = remember { mutableFloatStateOf(0.5f) }
- val phoneMediaEQ = remember { mutableStateOf(FloatArray(8) { 0.5f }) }
- val phoneEQEnabled = remember { mutableStateOf(false) }
- val mediaEQEnabled = remember { mutableStateOf(false) }
-
val initialLoadComplete = remember { mutableStateOf(false) }
val initialReadSucceeded = remember { mutableStateOf(false) }
@@ -111,8 +108,8 @@ fun HearingAidAdjustmentsScreen(@Suppress("unused") navController: NavController
val hearingAidSettings = remember {
mutableStateOf(
HearingAidSettings(
- leftEQ = eq.value,
- rightEQ = eq.value,
+ leftEQ = leftEQ.value,
+ rightEQ = rightEQ.value,
leftAmplification = amplificationSliderValue.floatValue + (0.5f - balanceSliderValue.floatValue) * amplificationSliderValue.floatValue * 2,
rightAmplification = amplificationSliderValue.floatValue + (balanceSliderValue.floatValue - 0.5f) * amplificationSliderValue.floatValue * 2,
leftTone = toneSliderValue.floatValue,
@@ -157,7 +154,8 @@ fun HearingAidAdjustmentsScreen(@Suppress("unused") navController: NavController
toneSliderValue.floatValue = parsed.leftTone
ambientNoiseReductionSliderValue.floatValue = parsed.leftAmbientNoiseReduction
conversationBoostEnabled.value = parsed.leftConversationBoost
- eq.value = parsed.leftEQ.copyOf()
+ leftEQ.value = parsed.leftEQ.copyOf()
+ rightEQ.value = parsed.rightEQ.copyOf()
ownVoiceAmplification.floatValue = parsed.ownVoiceAmplification
Log.d(TAG, "Updated hearing aid settings from notification")
} else {
@@ -192,8 +190,8 @@ fun HearingAidAdjustmentsScreen(@Suppress("unused") navController: NavController
}
hearingAidSettings.value = HearingAidSettings(
- leftEQ = eq.value,
- rightEQ = eq.value,
+ leftEQ = leftEQ.value,
+ rightEQ = rightEQ.value,
leftAmplification = amplificationSliderValue.floatValue + if (balanceSliderValue.floatValue < 0) -balanceSliderValue.floatValue else 0f,
rightAmplification = amplificationSliderValue.floatValue + if (balanceSliderValue.floatValue > 0) balanceSliderValue.floatValue else 0f,
leftTone = toneSliderValue.floatValue,
@@ -216,26 +214,6 @@ fun HearingAidAdjustmentsScreen(@Suppress("unused") navController: NavController
attManager.enableNotifications(ATTHandles.HEARING_AID)
attManager.registerListener(ATTHandles.HEARING_AID, hearingAidATTListener)
- try {
- if (aacpManager != null) {
- Log.d(TAG, "Found AACPManager, reading cached EQ data")
- val aacpEQ = aacpManager.eqData
- if (aacpEQ.isNotEmpty()) {
- eq.value = aacpEQ.copyOf()
- phoneMediaEQ.value = aacpEQ.copyOf()
- phoneEQEnabled.value = aacpManager.eqOnPhone
- mediaEQEnabled.value = aacpManager.eqOnMedia
- Log.d(TAG, "Populated EQ from AACPManager: ${aacpEQ.toList()}")
- } else {
- Log.d(TAG, "AACPManager EQ data empty")
- }
- } else {
- Log.d(TAG, "No AACPManager available")
- }
- } catch (e: Exception) {
- Log.w(TAG, "Error reading EQ from AACPManager: ${e.message}")
- }
-
var parsedSettings: HearingAidSettings? = null
for (attempt in 1..3) {
initialReadAttempts.intValue = attempt
@@ -261,7 +239,8 @@ fun HearingAidAdjustmentsScreen(@Suppress("unused") navController: NavController
toneSliderValue.floatValue = parsedSettings.leftTone
ambientNoiseReductionSliderValue.floatValue = parsedSettings.leftAmbientNoiseReduction
conversationBoostEnabled.value = parsedSettings.leftConversationBoost
- eq.value = parsedSettings.leftEQ.copyOf()
+ leftEQ.value = parsedSettings.leftEQ.copyOf()
+ rightEQ.value = parsedSettings.rightEQ.copyOf()
ownVoiceAmplification.floatValue = parsedSettings.ownVoiceAmplification
initialReadSucceeded.value = true
} else {
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidScreen.kt
index 8e067c000..b956d9684 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingAidScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingProtectionScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingProtectionScreen.kt
index 432f38259..bffac6d3a 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingProtectionScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/HearingProtectionScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/Onboarding.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/Onboarding.kt
index b8365ce97..f735668cb 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/Onboarding.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/Onboarding.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/OpenSourceLicensesScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/OpenSourceLicensesScreen.kt
index 34f255b1c..3a8aa388b 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/OpenSourceLicensesScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/OpenSourceLicensesScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/PressAndHoldSettingsScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/PressAndHoldSettingsScreen.kt
index c6b2e4091..cc206478c 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/PressAndHoldSettingsScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/PressAndHoldSettingsScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalStdlibApi::class, ExperimentalEncodingApi::class)
@@ -186,7 +186,7 @@ fun LongPress(navController: NavController, name: String) {
listeningModeItems.add(
SelectItem(
name = stringResource(R.string.off),
- description = "Turns off noise management",
+ description = stringResource(R.string.listening_mode_off_description),
iconRes = R.drawable.noise_cancellation,
selected = (currentByte and 0x01) != 0,
onClick = {
@@ -212,7 +212,7 @@ fun LongPress(navController: NavController, name: String) {
listeningModeItems.addAll(listOf(
SelectItem(
name = stringResource(R.string.transparency),
- description = "Lets in external sounds",
+ description = stringResource(R.string.listening_mode_transparency_description),
iconRes = R.drawable.transparency,
selected = (currentByte and 0x04) != 0,
onClick = {
@@ -235,7 +235,7 @@ fun LongPress(navController: NavController, name: String) {
),
SelectItem(
name = stringResource(R.string.adaptive),
- description = "Dynamically adjust external noise",
+ description = stringResource(R.string.listening_mode_adaptive_description),
iconRes = R.drawable.adaptive,
selected = (currentByte and 0x08) != 0,
onClick = {
@@ -258,7 +258,7 @@ fun LongPress(navController: NavController, name: String) {
),
SelectItem(
name = stringResource(R.string.noise_cancellation),
- description = "Blocks out external sounds",
+ description = stringResource(R.string.listening_mode_noise_cancellation_description),
iconRes = R.drawable.noise_cancellation,
selected = (currentByte and 0x02) != 0,
onClick = {
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/RenameScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/RenameScreen.kt
index f58d09439..95d412eae 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/RenameScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/RenameScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/TransparencySettingsScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/TransparencySettingsScreen.kt
index bc1d48e97..356ca6b43 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/TransparencySettingsScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/TransparencySettingsScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/TroubleshootingScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/TroubleshootingScreen.kt
index e1598efd4..b797ef99e 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/TroubleshootingScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/TroubleshootingScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/UpdateHearingTestScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/UpdateHearingTestScreen.kt
index 9b1577128..89e079182 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/UpdateHearingTestScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/UpdateHearingTestScreen.kt
@@ -1,25 +1,26 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
import android.annotation.SuppressLint
import android.util.Log
+import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@@ -39,11 +40,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
@@ -62,7 +65,6 @@ import kotlinx.coroutines.delay
import me.kavishdevar.librepods.R
import me.kavishdevar.librepods.composables.StyledScaffold
import me.kavishdevar.librepods.services.ServiceManager
-import me.kavishdevar.librepods.utils.AACPManager
import me.kavishdevar.librepods.utils.ATTHandles
import me.kavishdevar.librepods.utils.HearingAidSettings
import me.kavishdevar.librepods.utils.parseHearingAidSettingsResponse
@@ -91,7 +93,6 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
return
}
- val aacpManager = remember { ServiceManager.getService()?.aacpManager }
val backdrop = rememberLayerBackdrop()
StyledScaffold(
title = stringResource(R.string.hearing_test)
@@ -105,16 +106,25 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
+ val textColor = if (isSystemInDarkTheme()) Color.White else Color.Black
+
Spacer(modifier = Modifier.height(spacerHeight))
Text(
text = stringResource(R.string.hearing_test_value_instruction),
- fontSize = 16.sp,
modifier = Modifier.fillMaxWidth(),
+ style = TextStyle(
+ fontSize = 16.sp,
+ color = textColor,
+ fontFamily = FontFamily(Font(R.font.sf_pro))
+ ),
textAlign = TextAlign.Center,
- fontFamily = FontFamily(Font(R.font.sf_pro))
)
-
+ val tone = remember { mutableFloatStateOf(0.5f) }
+ val ambientNoiseReduction = remember { mutableFloatStateOf(0.0f) }
+ val ownVoiceAmplification = remember { mutableFloatStateOf(0.5f) }
+ val leftAmplification = remember { mutableFloatStateOf(0.5f) }
+ val rightAmplification = remember { mutableFloatStateOf(0.5f) }
val conversationBoostEnabled = remember { mutableStateOf(false) }
val leftEQ = remember { mutableStateOf(FloatArray(8)) }
val rightEQ = remember { mutableStateOf(FloatArray(8)) }
@@ -128,40 +138,21 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
HearingAidSettings(
leftEQ = leftEQ.value,
rightEQ = rightEQ.value,
- leftAmplification = 0.5f,
- rightAmplification = 0.5f,
- leftTone = 0.5f,
- rightTone = 0.5f,
+ leftAmplification = leftAmplification.value,
+ rightAmplification = rightAmplification.value,
+ leftTone = tone.value,
+ rightTone = tone.value,
leftConversationBoost = conversationBoostEnabled.value,
rightConversationBoost = conversationBoostEnabled.value,
- leftAmbientNoiseReduction = 0.0f,
- rightAmbientNoiseReduction = 0.0f,
- netAmplification = 0.5f,
- balance = 0.5f,
- ownVoiceAmplification = 0.5f
+ leftAmbientNoiseReduction = ambientNoiseReduction.value,
+ rightAmbientNoiseReduction = ambientNoiseReduction.value,
+ netAmplification = leftAmplification.value + rightAmplification.value / 2,
+ balance = 0.5f + (rightAmplification.value - leftAmplification.value) / 2,
+ ownVoiceAmplification = ownVoiceAmplification.value
)
)
}
- val hearingAidEnabled = remember {
- val aidStatus = aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.HEARING_AID }
- val assistStatus = aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.HEARING_ASSIST_CONFIG }
- mutableStateOf((aidStatus?.value?.getOrNull(1) == 0x01.toByte()) && (assistStatus?.value?.getOrNull(0) == 0x01.toByte()))
- }
-
- val hearingAidListener = remember {
- object : AACPManager.ControlCommandListener {
- override fun onControlCommandReceived(controlCommand: AACPManager.ControlCommand) {
- if (controlCommand.identifier == AACPManager.Companion.ControlCommandIdentifiers.HEARING_AID.value ||
- controlCommand.identifier == AACPManager.Companion.ControlCommandIdentifiers.HEARING_ASSIST_CONFIG.value) {
- val aidStatus = aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.HEARING_AID }
- val assistStatus = aacpManager?.controlCommandStatusList?.find { it.identifier == AACPManager.Companion.ControlCommandIdentifiers.HEARING_ASSIST_CONFIG }
- hearingAidEnabled.value = (aidStatus?.value?.getOrNull(1) == 0x01.toByte()) && (assistStatus?.value?.getOrNull(0) == 0x01.toByte())
- }
- }
- }
- }
-
val hearingAidATTListener = remember {
object : (ByteArray) -> Unit {
override fun invoke(value: ByteArray) {
@@ -170,6 +161,11 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
leftEQ.value = parsed.leftEQ.copyOf()
rightEQ.value = parsed.rightEQ.copyOf()
conversationBoostEnabled.value = parsed.leftConversationBoost
+ tone.value = parsed.leftTone
+ ambientNoiseReduction.value = parsed.leftAmbientNoiseReduction
+ ownVoiceAmplification.value = parsed.ownVoiceAmplification
+ leftAmplification.value = parsed.leftAmplification
+ rightAmplification.value = parsed.rightAmplification
Log.d(TAG, "Updated hearing aid settings from notification")
} else {
Log.w(TAG, "Failed to parse hearing aid settings from notification")
@@ -178,20 +174,14 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
}
}
- LaunchedEffect(Unit) {
- aacpManager?.registerControlCommandListener(AACPManager.Companion.ControlCommandIdentifiers.HEARING_AID, hearingAidListener)
- aacpManager?.registerControlCommandListener(AACPManager.Companion.ControlCommandIdentifiers.HEARING_ASSIST_CONFIG, hearingAidListener)
- }
DisposableEffect(Unit) {
onDispose {
- aacpManager?.unregisterControlCommandListener(AACPManager.Companion.ControlCommandIdentifiers.HEARING_AID, hearingAidListener)
- aacpManager?.unregisterControlCommandListener(AACPManager.Companion.ControlCommandIdentifiers.HEARING_ASSIST_CONFIG, hearingAidListener)
attManager.unregisterListener(ATTHandles.HEARING_AID, hearingAidATTListener)
}
}
- LaunchedEffect(leftEQ.value, rightEQ.value, conversationBoostEnabled.value, initialLoadComplete.value, initialReadSucceeded.value) {
+ LaunchedEffect(leftEQ.value, rightEQ.value, conversationBoostEnabled.value, initialLoadComplete.value, initialReadSucceeded.value, leftAmplification.value, rightAmplification.value, tone.value, ambientNoiseReduction.value, ownVoiceAmplification.value) {
if (!initialLoadComplete.value) {
Log.d(TAG, "Initial device load not complete - skipping send")
return@LaunchedEffect
@@ -205,17 +195,17 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
hearingAidSettings.value = HearingAidSettings(
leftEQ = leftEQ.value,
rightEQ = rightEQ.value,
- leftAmplification = 0.5f,
- rightAmplification = 0.5f,
- leftTone = 0.5f,
- rightTone = 0.5f,
+ leftAmplification = leftAmplification.value,
+ rightAmplification = rightAmplification.value,
+ leftTone = tone.value,
+ rightTone = tone.value,
leftConversationBoost = conversationBoostEnabled.value,
rightConversationBoost = conversationBoostEnabled.value,
- leftAmbientNoiseReduction = 0.0f,
- rightAmbientNoiseReduction = 0.0f,
- netAmplification = 0.5f,
- balance = 0.5f,
- ownVoiceAmplification = 0.5f
+ leftAmbientNoiseReduction = ambientNoiseReduction.value,
+ rightAmbientNoiseReduction = ambientNoiseReduction.value,
+ netAmplification = leftAmplification.value + rightAmplification.value / 2,
+ balance = 0.5f + (rightAmplification.value - leftAmplification.value) / 2,
+ ownVoiceAmplification = ownVoiceAmplification.value
)
Log.d(TAG, "Updated settings: ${hearingAidSettings.value}")
sendHearingAidSettings(attManager, hearingAidSettings.value, debounceJob)
@@ -227,24 +217,6 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
attManager.enableNotifications(ATTHandles.HEARING_AID)
attManager.registerListener(ATTHandles.HEARING_AID, hearingAidATTListener)
- try {
- if (aacpManager != null) {
- Log.d(TAG, "Found AACPManager, reading cached EQ data")
- val aacpEQ = aacpManager.eqData
- if (aacpEQ.isNotEmpty()) {
- leftEQ.value = aacpEQ.copyOf()
- rightEQ.value = aacpEQ.copyOf()
- Log.d(TAG, "Populated EQ from AACPManager: ${aacpEQ.toList()}")
- } else {
- Log.d(TAG, "AACPManager EQ data empty")
- }
- } else {
- Log.d(TAG, "No AACPManager available")
- }
- } catch (e: Exception) {
- Log.w(TAG, "Error reading EQ from AACPManager: ${e.message}")
- }
-
var parsedSettings: HearingAidSettings? = null
for (attempt in 1..3) {
initialReadAttempts.intValue = attempt
@@ -268,6 +240,11 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
leftEQ.value = parsedSettings.leftEQ.copyOf()
rightEQ.value = parsedSettings.rightEQ.copyOf()
conversationBoostEnabled.value = parsedSettings.leftConversationBoost
+ tone.value = parsedSettings.leftTone
+ ambientNoiseReduction.value = parsedSettings.leftAmbientNoiseReduction
+ ownVoiceAmplification.value = parsedSettings.ownVoiceAmplification
+ leftAmplification.value = parsedSettings.leftAmplification
+ rightAmplification.value = parsedSettings.rightAmplification
initialReadSucceeded.value = true
} else {
Log.d(TAG, "Failed to read/parse initial hearing aid settings after ${initialReadAttempts.intValue} attempts")
@@ -288,17 +265,23 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
Spacer(modifier = Modifier.width(60.dp))
Text(
text = stringResource(R.string.left),
- fontSize = 18.sp,
modifier = Modifier.weight(1f),
textAlign = TextAlign.Center,
- fontFamily = FontFamily(Font(R.font.sf_pro))
+ style = TextStyle(
+ fontSize = 18.sp,
+ fontFamily = FontFamily(Font(R.font.sf_pro)),
+ color = textColor
+ )
)
Text(
text = stringResource(R.string.right),
- fontSize = 18.sp,
modifier = Modifier.weight(1f),
textAlign = TextAlign.Center,
- fontFamily = FontFamily(Font(R.font.sf_pro))
+ style = TextStyle(
+ fontSize = 18.sp,
+ fontFamily = FontFamily(Font(R.font.sf_pro)),
+ color = textColor
+ )
)
}
@@ -313,8 +296,11 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
.width(60.dp)
.align(Alignment.CenterVertically),
textAlign = TextAlign.End,
- fontSize = 16.sp,
- fontFamily = FontFamily(Font(R.font.sf_pro)),
+ style = TextStyle(
+ color = textColor,
+ fontSize = 16.sp,
+ fontFamily = FontFamily(Font(R.font.sf_pro))
+ ),
)
OutlinedTextField(
value = leftEQ.value[index].toString(),
@@ -324,10 +310,11 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
val newArray = leftEQ.value.copyOf()
newArray[index] = parsed
leftEQ.value = newArray
+ Log.d(TAG, "Left EQ updated at index $index to $parsed")
}
},
// label = { Text("Value", fontSize = 14.sp, fontFamily = FontFamily(Font(R.font.sf_pro))) },
- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
textStyle = TextStyle(
fontFamily = FontFamily(Font(R.font.sf_pro)),
fontSize = 14.sp
@@ -342,10 +329,11 @@ fun UpdateHearingTestScreen(@Suppress("unused") navController: NavController) {
val newArray = rightEQ.value.copyOf()
newArray[index] = parsed
rightEQ.value = newArray
+ Log.d(TAG, "Right EQ updated at index $index to $parsed")
}
},
// label = { Text("Value", fontSize = 14.sp, fontFamily = FontFamily(Font(R.font.sf_pro))) },
- keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
+ keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
textStyle = TextStyle(
fontFamily = FontFamily(Font(R.font.sf_pro)),
fontSize = 14.sp
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/screens/VersionInfoScreen.kt b/android/app/src/main/java/me/kavishdevar/librepods/screens/VersionInfoScreen.kt
index 73f7fa6cd..a0ea75e18 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/screens/VersionInfoScreen.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/screens/VersionInfoScreen.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.screens
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsQSService.kt b/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsQSService.kt
index efddf8ad6..fb8499827 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsQSService.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsQSService.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt b/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt
index d8d16d3b5..d890e88f2 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/services/AirPodsService.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
@file:Suppress("DEPRECATION")
@@ -93,8 +93,8 @@ import me.kavishdevar.librepods.utils.AirPodsInstance
import me.kavishdevar.librepods.utils.AirPodsModels
import me.kavishdevar.librepods.utils.BLEManager
import me.kavishdevar.librepods.utils.BluetoothConnectionManager
-import me.kavishdevar.librepods.utils.CrossDevice
-import me.kavishdevar.librepods.utils.CrossDevicePackets
+//import me.kavishdevar.librepods.utils.CrossDevice
+//import me.kavishdevar.librepods.utils.CrossDevicePackets
import me.kavishdevar.librepods.utils.GestureDetector
import me.kavishdevar.librepods.utils.HeadTracking
import me.kavishdevar.librepods.utils.IslandType
@@ -167,7 +167,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
var headGestures: Boolean = true,
var disconnectWhenNotWearing: Boolean = false,
var conversationalAwarenessVolume: Int = 43,
- var textColor: Long = -1L,
var qsClickBehavior: String = "cycle",
var bleOnlyMode: Boolean = false,
@@ -193,7 +192,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
var leftLongPressAction: StemAction = StemAction.defaultActions[StemPressType.LONG_PRESS]!!,
var rightLongPressAction: StemAction = StemAction.defaultActions[StemPressType.LONG_PRESS]!!,
- var cameraAction: AACPManager.Companion.StemPressType? = null,
+ var cameraAction: StemPressType? = null,
// AirPods device information
var airpodsName: String = "",
@@ -207,6 +206,9 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
var airpodsVersion3: String = "",
var airpodsHardwareRevision: String = "",
var airpodsUpdaterIdentifier: String = "",
+
+ // phone's mac, needed for tipi
+ var selfMacAddress: String = ""
)
private lateinit var config: ServiceConfig
@@ -368,9 +370,29 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
- val process = Runtime.getRuntime().exec(arrayOf("su", "-c", "settings", "get", "secure", "bluetooth_address"))
- val output = process.inputStream.bufferedReader().use { it.readLine() }
- localMac = output.trim()
+ localMac = config.selfMacAddress
+ if (localMac.isEmpty()) {
+ localMac = try {
+ val process = Runtime.getRuntime().exec(
+ arrayOf("su", "-c", "settings get secure bluetooth_address")
+ )
+
+ val exitCode = process.waitFor()
+
+ if (exitCode == 0) {
+ process.inputStream.bufferedReader().use { it.readLine()?.trim().orEmpty() }
+ } else {
+ ""
+ }
+ } catch (e: Exception) {
+ Log.e(TAG, "Error retrieving local MAC address: ${e.message}. We probably aren't rooted.")
+ ""
+ }
+ config.selfMacAddress = localMac
+ sharedPreferences.edit {
+ putString("self_mac_address", localMac)
+ }
+ }
ServiceManager.setService(this)
startForegroundNotification()
@@ -453,8 +475,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
43
)
- if (!contains("textColor")) putLong("textColor", -1L)
-
if (!contains("qs_click_behavior")) putString("qs_click_behavior", "cycle")
if (!contains("name")) putString("name", "AirPods")
@@ -556,11 +576,11 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
MODE_PRIVATE
)
)
- Log.d(TAG, "Initializing CrossDevice")
- CoroutineScope(Dispatchers.IO).launch {
- CrossDevice.init(this@AirPodsService)
- Log.d(TAG, "CrossDevice initialized")
- }
+// Log.d(TAG, "Initializing CrossDevice")
+// CoroutineScope(Dispatchers.IO).launch {
+// CrossDevice.init(this@AirPodsService)
+// Log.d(TAG, "CrossDevice initialized")
+// }
sharedPreferences = getSharedPreferences("settings", MODE_PRIVATE)
macAddress = sharedPreferences.getString("mac_address", "") ?: ""
@@ -573,7 +593,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
when (state) {
TelephonyManager.CALL_STATE_RINGING -> {
val leAvailableForAudio = bleManager.getMostRecentStatus()?.isLeftInEar == true || bleManager.getMostRecentStatus()?.isRightInEar == true
- if ((CrossDevice.isAvailable && !isConnectedLocally && earDetectionNotification.status.contains(0x00)) || leAvailableForAudio) CoroutineScope(Dispatchers.IO).launch {
+// if ((CrossDevice.isAvailable && !isConnectedLocally && earDetectionNotification.status.contains(0x00)) || leAvailableForAudio) CoroutineScope(Dispatchers.IO).launch {
+ if (leAvailableForAudio) runBlocking {
takeOver("call")
}
if (config.headGestures) {
@@ -583,7 +604,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
}
TelephonyManager.CALL_STATE_OFFHOOK -> {
val leAvailableForAudio = bleManager.getMostRecentStatus()?.isLeftInEar == true || bleManager.getMostRecentStatus()?.isRightInEar == true
- if ((CrossDevice.isAvailable && !isConnectedLocally && earDetectionNotification.status.contains(0x00)) || leAvailableForAudio) CoroutineScope(
+// if ((CrossDevice.isAvailable && !isConnectedLocally && earDetectionNotification.status.contains(0x00)) || leAvailableForAudio) CoroutineScope(
+ if (leAvailableForAudio) CoroutineScope(
Dispatchers.IO).launch {
takeOver("call")
}
@@ -641,8 +663,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
sharedPreferences.edit { putString("name", config.deviceName) }
}
- Log.d("AirPodsCrossDevice", CrossDevice.isAvailable.toString())
- if (!CrossDevice.isAvailable) {
+// Log.d("AirPodsCrossDevice", CrossDevice.isAvailable.toString())
+// if (!CrossDevice.isAvailable) {
Log.d(TAG, "${config.deviceName} connected")
CoroutineScope(Dispatchers.IO).launch {
connectToSocket(device!!)
@@ -654,7 +676,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
sharedPreferences.edit {
putString("mac_address", macAddress)
}
- }
+// }
+
} else if (intent?.action == AirPodsNotifications.AIRPODS_DISCONNECTED) {
device = null
isConnectedLocally = false
@@ -719,7 +742,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
if (profile == BluetoothProfile.A2DP) {
val connectedDevices = proxy.connectedDevices
if (connectedDevices.isNotEmpty()) {
- if (!CrossDevice.isAvailable) {
+// if (!CrossDevice.isAvailable) {
CoroutineScope(Dispatchers.IO).launch {
connectToSocket(device)
}
@@ -728,7 +751,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
sharedPreferences.edit {
putString("mac_address", macAddress)
}
- }
+// }
this@AirPodsService.sendBroadcast(
Intent(AirPodsNotifications.AIRPODS_CONNECTED)
)
@@ -745,9 +768,9 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
}
}
- if (!isConnectedLocally && !CrossDevice.isAvailable) {
- clearPacketLogs()
- }
+// if (!isConnectedLocally && !CrossDevice.isAvailable) {
+// clearPacketLogs()
+// }
CoroutineScope(Dispatchers.IO).launch {
bleManager.startScanning()
@@ -819,8 +842,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
.getString("name", device?.name),
batteryNotification.getBattery()
)
- CrossDevice.sendRemotePacket(batteryInfo)
- CrossDevice.batteryBytes = batteryInfo
+// CrossDevice.sendRemotePacket(batteryInfo)
+// CrossDevice.batteryBytes = batteryInfo
for (battery in batteryNotification.getBattery()) {
Log.d(
@@ -1203,7 +1226,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
headGestures = sharedPreferences.getBoolean("head_gestures", true),
disconnectWhenNotWearing = sharedPreferences.getBoolean("disconnect_when_not_wearing", false),
conversationalAwarenessVolume = sharedPreferences.getInt("conversational_awareness_volume", 43),
- textColor = sharedPreferences.getLong("textColor", -1L),
qsClickBehavior = sharedPreferences.getString("qs_click_behavior", "cycle") ?: "cycle",
// AirPods state-based takeover
@@ -1229,7 +1251,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
leftLongPressAction = StemAction.fromString(sharedPreferences.getString("left_long_press_action", "CYCLE_NOISE_CONTROL_MODES") ?: "CYCLE_NOISE_CONTROL_MODES")!!,
rightLongPressAction = StemAction.fromString(sharedPreferences.getString("right_long_press_action", "DIGITAL_ASSISTANT") ?: "DIGITAL_ASSISTANT")!!,
- cameraAction = sharedPreferences.getString("camera_action", null)?.let { AACPManager.Companion.StemPressType.valueOf(it) },
+ cameraAction = sharedPreferences.getString("camera_action", null)?.let { StemPressType.valueOf(it) },
// AirPods device information
airpodsName = sharedPreferences.getString("airpods_name", "") ?: "",
@@ -1243,6 +1265,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
airpodsVersion3 = sharedPreferences.getString("airpods_version3", "") ?: "",
airpodsHardwareRevision = sharedPreferences.getString("airpods_hardware_revision", "") ?: "",
airpodsUpdaterIdentifier = sharedPreferences.getString("airpods_updater_identifier", "") ?: "",
+
+ selfMacAddress = sharedPreferences.getString("self_mac_address", "") ?: ""
)
}
@@ -1251,6 +1275,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
when(key) {
"name" -> config.deviceName = preferences.getString(key, "AirPods") ?: "AirPods"
+ "mac_address" -> macAddress = preferences.getString(key, "") ?: ""
"automatic_ear_detection" -> config.earDetectionEnabled = preferences.getBoolean(key, true)
"conversational_awareness_pause_music" -> config.conversationalAwarenessPauseMusic = preferences.getBoolean(key, false)
"show_phone_battery_in_widget" -> {
@@ -1262,7 +1287,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
"head_gestures" -> config.headGestures = preferences.getBoolean(key, true)
"disconnect_when_not_wearing" -> config.disconnectWhenNotWearing = preferences.getBoolean(key, false)
"conversational_awareness_volume" -> config.conversationalAwarenessVolume = preferences.getInt(key, 43)
- "textColor" -> config.textColor = preferences.getLong(key, -1L)
"qs_click_behavior" -> config.qsClickBehavior = preferences.getString(key, "cycle") ?: "cycle"
// AirPods state-based takeover
@@ -1323,7 +1347,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
)!!
setupStemActions()
}
- "camera_action" -> config.cameraAction = preferences.getString(key, null)?.let { AACPManager.Companion.StemPressType.valueOf(it) }
+ "camera_action" -> config.cameraAction = preferences.getString(key, null)?.let { StemPressType.valueOf(it) }
// AirPods device information
"airpods_name" -> config.airpodsName = preferences.getString(key, "") ?: ""
@@ -1337,10 +1361,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
"airpods_version3" -> config.airpodsVersion3 = preferences.getString(key, "") ?: ""
"airpods_hardware_revision" -> config.airpodsHardwareRevision = preferences.getString(key, "") ?: ""
"airpods_updater_identifier" -> config.airpodsUpdaterIdentifier = preferences.getString(key, "") ?: ""
- }
- if (key == "mac_address") {
- macAddress = preferences.getString(key, "") ?: ""
+ "self_mac_address" -> config.selfMacAddress = preferences.getString(key, "") ?: ""
}
}
@@ -2096,7 +2118,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
SystemApisUtils.setMetadata(
device,
device.METADATA_COMPANION_APP,
- "me.kavisdevar.librepods".toByteArray()
+ "me.kavishdevar.librepods".toByteArray()
) &&
SystemApisUtils.setMetadata(
device,
@@ -2139,11 +2161,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
?.getString("name", bluetoothDevice?.name)
if (bluetoothDevice != null && action != null && !action.isEmpty()) {
Log.d(TAG, "Received bluetooth connection broadcast: action=$action")
- if (ServiceManager.getService()?.isConnectedLocally == true) {
- Log.d(TAG, "Device is already connected locally, checking if we should keep audio connected")
- if (ServiceManager.getService()?.socket?.isConnected == true) ServiceManager.getService()?.manuallyCheckForAudioSource() else Log.d(TAG, "We're not connected, ignoring")
- return
- }
if (BluetoothDevice.ACTION_ACL_CONNECTED == action) {
val uuid = ParcelUuid.fromString("74ec2172-0bad-4d01-8f77-997b2be0722a")
bluetoothDevice.fetchUuidsWithSdp()
@@ -2178,19 +2195,6 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
return START_STICKY
}
- fun manuallyCheckForAudioSource() {
- val shouldResume = MediaController.getMusicActive() // todo: for some reason we lose this info after disconnecting, probably android dispatches some event. haven't investigated yet.
- if (airpodsInstance == null) return
- Log.d(TAG, "disconnectedBecauseReversed: $disconnectedBecauseReversed, otherDeviceTookOver: $otherDeviceTookOver")
- if ((earDetectionNotification.status[0] != 0.toByte() && earDetectionNotification.status[1] != 0.toByte()) || disconnectedBecauseReversed || otherDeviceTookOver) {
- Log.d(
- TAG,
- "For some reason, Android connected to the audio profile itself even after disconnecting. Disconnecting audio profile again! I will resume: $shouldResume"
- )
- disconnectAudio(this, device, shouldResume = shouldResume)
- }
- }
-
@RequiresApi(Build.VERSION_CODES.R)
@SuppressLint("MissingPermission", "HardwareIds")
fun takeOver(takingOverFor: String, manualTakeOverAfterReversed: Boolean = false, startHeadTrackingAgain: Boolean = false) {
@@ -2266,14 +2270,19 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
return
}
- if (CrossDevice.isAvailable) {
- Log.d(TAG, "CrossDevice is available, continuing")
- }
- else if (bleManager.getMostRecentStatus()?.isLeftInEar == true || bleManager.getMostRecentStatus()?.isRightInEar == true) {
- Log.d(TAG, "At least one AirPod is in ear, continuing")
- }
- else {
- Log.d(TAG, "CrossDevice not available and AirPods not in ear, skipping")
+// if (CrossDevice.isAvailable) {
+// Log.d(TAG, "CrossDevice is available, continuing")
+// }
+// else if (bleManager.getMostRecentStatus()?.isLeftInEar == true || bleManager.getMostRecentStatus()?.isRightInEar == true) {
+// Log.d(TAG, "At least one AirPod is in ear, continuing")
+// }
+// else {
+// Log.d(TAG, "CrossDevice not available and AirPods not in ear, skipping")
+// return
+// }
+
+ if (bleManager.getMostRecentStatus()?.isLeftInEar == false && bleManager.getMostRecentStatus()?.isRightInEar == false) {
+ Log.d(TAG, "Both AirPods are out of ear, not taking over audio")
return
}
@@ -2312,10 +2321,10 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
}
Log.d(TAG, "Taking over audio")
- CrossDevice.sendRemotePacket(CrossDevicePackets.REQUEST_DISCONNECT.packet)
+// CrossDevice.sendRemotePacket(CrossDevicePackets.REQUEST_DISCONNECT.packet)
Log.d(TAG, macAddress)
- sharedPreferences.edit { putBoolean("CrossDeviceIsAvailable", false) }
+// sharedPreferences.edit { putBoolean("CrossDeviceIsAvailable", false) }
device = getSystemService(BluetoothManager::class.java).adapter.bondedDevices.find {
it.address == macAddress
}
@@ -2340,7 +2349,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
showIsland(this, batteryNotification.getBattery().find { it.component == BatteryComponent.LEFT}?.level!!.coerceAtMost(batteryNotification.getBattery().find { it.component == BatteryComponent.RIGHT}?.level!!),
IslandType.TAKING_OVER)
- CrossDevice.isAvailable = false
+// CrossDevice.isAvailable = false
}
private fun createBluetoothSocket(device: BluetoothDevice, uuid: ParcelUuid): BluetoothSocket {
@@ -2385,7 +2394,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
Log.d(TAG, " Connecting to socket")
HiddenApiBypass.addHiddenApiExemptions("Landroid/bluetooth/BluetoothSocket;")
val uuid: ParcelUuid = ParcelUuid.fromString("74ec2172-0bad-4d01-8f77-997b2be0722a")
- if (!isConnectedLocally && !CrossDevice.isAvailable) {
+ if (!isConnectedLocally) {
socket = try {
createBluetoothSocket(device, uuid)
} catch (e: Exception) {
@@ -2503,7 +2512,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
})
val bytes = buffer.copyOfRange(0, bytesRead)
val formattedHex = bytes.joinToString(" ") { "%02X".format(it) }
- CrossDevice.sendReceivedPacket(bytes)
+// CrossDevice.sendReceivedPacket(bytes)
updateNotificationContent(
true,
sharedPreferences.getString("name", device.name),
@@ -2541,6 +2550,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
this@AirPodsService.device = device
updateNotificationContent(false)
}
+ } else {
+ Log.d(TAG, "Already connected locally, skipping socket connection (isConnectedLocally = $isConnectedLocally, socket.isConnected = ${this::socket.isInitialized && socket.isConnected})")
}
}
@@ -2566,7 +2577,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
override fun onServiceDisconnected(profile: Int) {}
}, BluetoothProfile.A2DP)
isConnectedLocally = false
- CrossDevice.isAvailable = true
+// CrossDevice.isAvailable = true
}
fun disconnectAirPods() {
@@ -2611,20 +2622,20 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
}
fun getBattery(): List {
- if (!isConnectedLocally && CrossDevice.isAvailable) {
- batteryNotification.setBattery(CrossDevice.batteryBytes)
- }
+// if (!isConnectedLocally && CrossDevice.isAvailable) {
+// batteryNotification.setBattery(CrossDevice.batteryBytes)
+// }
return batteryNotification.getBattery()
}
fun getANC(): Int {
- if (!isConnectedLocally && CrossDevice.isAvailable) {
- ancNotification.setStatus(CrossDevice.ancBytes)
- }
+// if (!isConnectedLocally && CrossDevice.isAvailable) {
+// ancNotification.setStatus(CrossDevice.ancBytes)
+// }
return ancNotification.status
}
- fun disconnectAudio(context: Context, device: BluetoothDevice?, shouldResume: Boolean = false) {
+ fun disconnectAudio(context: Context, device: BluetoothDevice?) {
val bluetoothAdapter = context.getSystemService(BluetoothManager::class.java).adapter
bluetoothAdapter?.getProfileProxy(context, object : BluetoothProfile.ServiceListener {
override fun onServiceConnected(profile: Int, proxy: BluetoothProfile) {
@@ -2635,13 +2646,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
return
}
val method =
- proxy.javaClass.getMethod("disconnect", BluetoothDevice::class.java)
- method.invoke(proxy, device)
- if (shouldResume) {
- Handler(Looper.getMainLooper()).postDelayed({
- MediaController.sendPlay()
- }, 150)
- }
+ proxy.javaClass.getMethod("setConnectionPolicy", BluetoothDevice::class.java, Int::class.java)
+ method.invoke(proxy, device, 0)
} catch (e: Exception) {
e.printStackTrace()
} finally {
@@ -2658,8 +2664,8 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
if (profile == BluetoothProfile.HEADSET) {
try {
val method =
- proxy.javaClass.getMethod("disconnect", BluetoothDevice::class.java)
- method.invoke(proxy, device)
+ proxy.javaClass.getMethod("setConnectionPolicy", BluetoothDevice::class.java, Int::class.java)
+ method.invoke(proxy, device, 0)
} catch (e: Exception) {
e.printStackTrace()
} finally {
@@ -2679,9 +2685,11 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
override fun onServiceConnected(profile: Int, proxy: BluetoothProfile) {
if (profile == BluetoothProfile.A2DP) {
try {
- val method =
+ val policyMethod = proxy.javaClass.getMethod("setConnectionPolicy", BluetoothDevice::class.java, Int::class.java)
+ policyMethod.invoke(proxy, device, 100)
+ val connectMethod =
proxy.javaClass.getMethod("connect", BluetoothDevice::class.java)
- method.invoke(proxy, device)
+ connectMethod.invoke(proxy, device) // reduces the slight delay between allowing and actually connecting
} catch (e: Exception) {
e.printStackTrace()
} finally {
@@ -2700,9 +2708,11 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
override fun onServiceConnected(profile: Int, proxy: BluetoothProfile) {
if (profile == BluetoothProfile.HEADSET) {
try {
- val method =
+ val policyMethod = proxy.javaClass.getMethod("setConnectionPolicy", BluetoothDevice::class.java, Int::class.java)
+ policyMethod.invoke(proxy, device, 100)
+ val connectMethod =
proxy.javaClass.getMethod("connect", BluetoothDevice::class.java)
- method.invoke(proxy, device)
+ connectMethod.invoke(proxy, device)
} catch (e: Exception) {
e.printStackTrace()
} finally {
@@ -2761,7 +2771,7 @@ class AirPodsService : Service(), SharedPreferences.OnSharedPreferenceChangeList
}
telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE)
isConnectedLocally = false
- CrossDevice.isAvailable = true
+// CrossDevice.isAvailable = true
super.onDestroy()
}
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/services/AppListenerService.kt b/android/app/src/main/java/me/kavishdevar/librepods/services/AppListenerService.kt
index a7ad97760..83e5b062a 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/services/AppListenerService.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/services/AppListenerService.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Color.kt b/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Color.kt
index 662186ed7..808d951eb 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Color.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Color.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.ui.theme
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Theme.kt b/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Theme.kt
index 31e4f12b3..56531235b 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Theme.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Theme.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.ui.theme
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Type.kt b/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Type.kt
index 79a52189c..80a67aa83 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Type.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/ui/theme/Type.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.ui.theme
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt
index cd5392ddc..f3afe9f56 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/AACPManager.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
@@ -596,7 +596,7 @@ class AACPManager {
eqData = FloatArray(8) { i -> eq1.get(i) }
Log.d(TAG, "EQ Data set to: ${eqData.toList()}, eqOnPhone: $eqOnPhone, eqOnMedia: $eqOnMedia")
}
-
+
Opcodes.INFORMATION -> {
Log.e(TAG, "Parsing Information Packet")
val information = parseInformationPacket(packet)
@@ -1201,7 +1201,8 @@ class AACPManager {
var offset = 9
for (i in 0 until deviceCount) {
if (offset + 8 > data.size) {
- throw IllegalArgumentException("Data array too short to parse all connected devices")
+ Log.w(TAG, "Data array too short to parse all connected devices, returning what we have")
+ break
}
val macBytes = data.sliceArray(offset until offset + 6)
val mac = macBytes.joinToString(":") { "%02X".format(it) }
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/ATTManager.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/ATTManager.kt
index 41c6116f8..af95ec989 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/ATTManager.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/ATTManager.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
/* This is a very basic ATT (Attribute Protocol) implementation. I have only implemented
* what is necessary for LibrePods to function, i.e. reading and writing characteristics,
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/AirPods.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/AirPods.kt
index a43a5ee17..e41898f4a 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/AirPods.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/AirPods.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
@@ -149,7 +149,8 @@ class AirPodsPro2Lightning: AirPodsBase(
Capability.HEARING_AID,
Capability.ADAPTIVE_AUDIO,
Capability.ADAPTIVE_VOLUME,
- Capability.SWIPE_FOR_VOLUME
+ Capability.SWIPE_FOR_VOLUME,
+ Capability.HEAD_GESTURES
)
)
@@ -171,7 +172,8 @@ class AirPodsPro2USBC: AirPodsBase(
Capability.HEARING_AID,
Capability.ADAPTIVE_AUDIO,
Capability.ADAPTIVE_VOLUME,
- Capability.SWIPE_FOR_VOLUME
+ Capability.SWIPE_FOR_VOLUME,
+ Capability.HEAD_GESTURES
)
)
@@ -230,4 +232,4 @@ object AirPodsModels {
fun getModelByModelNumber(modelNumber: String): AirPodsBase? {
return models.find { modelNumber in it.modelNumber }
}
-}
\ No newline at end of file
+}
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/BLEManager.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/BLEManager.kt
index 5553e217c..73600ee51 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/BLEManager.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/BLEManager.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple's ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothConnectionManager.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothConnectionManager.kt
index 5655793e6..249cd2d41 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothConnectionManager.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothConnectionManager.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple's ecosystem
- *
- * Copyright (C) 2025 LibrePods Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothCryptography.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothCryptography.kt
index 633ee4665..80d3a456c 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothCryptography.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/BluetoothCryptography.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/CrossDevice.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/CrossDevice.kt
index 3e91c2838..026d0a387 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/CrossDevice.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/CrossDevice.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/DragUtils.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/DragUtils.kt
index 55b1eef23..e10ea20d5 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/DragUtils.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/DragUtils.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureDetector.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureDetector.kt
index 804d4cb61..9892096bc 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureDetector.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureDetector.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureFeedback.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureFeedback.kt
index b7d406842..88ab8cf5f 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureFeedback.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/GestureFeedback.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:Suppress("PrivatePropertyName")
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/HeadOrientation.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/HeadOrientation.kt
index ad2d41841..ebdf91490 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/HeadOrientation.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/HeadOrientation.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/HearingAidEnums.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/HearingAidEnums.kt
index b405f8432..94d182012 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/HearingAidEnums.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/HearingAidEnums.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/IslandWindow.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/IslandWindow.kt
index 0d143a7e6..09279beb3 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/IslandWindow.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/IslandWindow.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/LogCollector.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/LogCollector.kt
index d03ca48c6..246fd785a 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/LogCollector.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/LogCollector.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/MediaController.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/MediaController.kt
index 778a09783..ac7e190a5 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/MediaController.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/MediaController.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/PopupWindow.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/PopupWindow.kt
index 1d54aa951..a60e2ef42 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/PopupWindow.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/PopupWindow.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/RadareOffsetFinder.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/RadareOffsetFinder.kt
index 50ede42eb..e5a1e7bdc 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/RadareOffsetFinder.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/RadareOffsetFinder.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
@@ -40,7 +40,7 @@ import kotlin.io.encoding.ExperimentalEncodingApi
class RadareOffsetFinder(context: Context) {
companion object {
private const val TAG = "RadareOffsetFinder"
- private const val RADARE2_URL = "https://hc-cdn.hel1.your-objectstorage.com/s/v3/c9898243c42c0d3d1387de9a37d57ce9df77f9c9_radare2-5.9.9-android-aarch64.tar.gz"
+ private const val RADARE2_URL = "https://github.com/devnoname120/radare2/releases/download/5.9.8-android-aln/radare2-5.9.9-android-aarch64-aln.tar.gz"
private const val HOOK_OFFSET_PROP = "persist.librepods.hook_offset"
private const val CFG_REQ_OFFSET_PROP = "persist.librepods.cfg_req_offset"
private const val CSM_CONFIG_OFFSET_PROP = "persist.librepods.csm_config_offset"
@@ -115,6 +115,11 @@ class RadareOffsetFinder(context: Context) {
}
fun isSdpOffsetAvailable(): Boolean {
+ val sharedPreferences = ServiceManager.getService()?.applicationContext?.getSharedPreferences("settings", Context.MODE_PRIVATE) // ik not good practice- too lazy
+ if (sharedPreferences?.getBoolean("skip_setup", false) == true) {
+ Log.d(TAG, "Setup skipped, returning true for SDP offset.")
+ return true
+ }
try {
val process = Runtime.getRuntime().exec(arrayOf("/system/bin/getprop", SDP_OFFSET_PROP))
val reader = BufferedReader(InputStreamReader(process.inputStream))
@@ -462,7 +467,7 @@ class RadareOffsetFinder(context: Context) {
// findAndSaveL2cuProcessCfgReqOffset(libraryPath, envSetup)
// findAndSaveL2cCsmConfigOffset(libraryPath, envSetup)
// findAndSaveL2cuSendPeerInfoReqOffset(libraryPath, envSetup)
-
+
// findAndSaveSdpOffset(libraryPath, envSetup) Should not be run by default, only when user asks for it.
} catch (e: Exception) {
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/utils/TransparencyUtils.kt b/android/app/src/main/java/me/kavishdevar/librepods/utils/TransparencyUtils.kt
index 0ceaa9ea6..f085b9b16 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/utils/TransparencyUtils.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/utils/TransparencyUtils.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
package me.kavishdevar.librepods.utils
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/widgets/BatteryWidget.kt b/android/app/src/main/java/me/kavishdevar/librepods/widgets/BatteryWidget.kt
index f67588b14..a926e791c 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/widgets/BatteryWidget.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/widgets/BatteryWidget.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/java/me/kavishdevar/librepods/widgets/NoiseControlWidget.kt b/android/app/src/main/java/me/kavishdevar/librepods/widgets/NoiseControlWidget.kt
index 3f5af9d1c..9d32f167b 100644
--- a/android/app/src/main/java/me/kavishdevar/librepods/widgets/NoiseControlWidget.kt
+++ b/android/app/src/main/java/me/kavishdevar/librepods/widgets/NoiseControlWidget.kt
@@ -1,20 +1,20 @@
/*
- * LibrePods - AirPods liberated from Apple’s ecosystem
- *
- * Copyright (C) 2025 LibrePods contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
+ LibrePods - AirPods liberated from Apple’s ecosystem
+ Copyright (C) 2025 LibrePods contributors
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
@file:OptIn(ExperimentalEncodingApi::class)
diff --git a/android/app/src/main/res/resources.properties b/android/app/src/main/res/resources.properties
new file mode 100644
index 000000000..92481bb0b
--- /dev/null
+++ b/android/app/src/main/res/resources.properties
@@ -0,0 +1 @@
+unqualifiedResLocale=en
diff --git a/android/app/src/main/res/value-it/strings.xml b/android/app/src/main/res/value-it/strings.xml
new file mode 100644
index 000000000..cf02b8e5f
--- /dev/null
+++ b/android/app/src/main/res/value-it/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ Libera i tuoi AirPods dall'ecosistema Apple.
+ Visualizza lo stato della batteria dei tuoi AirPods direttamente dalla schermata principale!
+ Accessibilità
+ Volume Tono
+ Regola il volume del tono degli effetti sonori riprodotti dagli AirPods.
+ Audio
+ Audio Adattivo
+ Personalizza Audio Adattivo
+ L'audio adattivo risponde dinamicamente al tuo ambiente e cancella o permette i rumori esterni. Puoi personalizzare l'Audio Adattivo per permettere più o meno rumore.
+ Auricolari
+ Custodia
+ Test
+ Nome
+ Modalità di Ascolto
+ Spento
+ Trasparenza
+ Adattivo
+ Cancellazione del Rumore
+ Premi e Tieni Premuto sugli AirPods
+ Premi e tieni premuto sullo stelo per alternare tra le modalità di ascolto selezionate.
+ Gesti della Testa
+ Sinistra
+ Destra
+ Consapevolezza Conversazionale
+ Abbassa il volume dei contenuti multimediali e riduce il rumore di fondo quando inizi a parlare con altre persone.
+ Volume Personalizzato
+ Regola il volume dei contenuti multimediali in risposta al tuo ambiente.
+ Cancellazione del Rumore con un Solo AirPod
+ Consenti agli AirPods di essere messi in modalità di cancellazione del rumore quando è presente un solo AirPod nell'orecchio.
+ Controllo Volume
+ Regola il volume scorrendo verso l'alto o verso il basso sul sensore situato sullo stelo degli AirPods Pro.
+ AirPods non connessi
+ Si prega di connettere i tuoi AirPods per accedere alle impostazioni.
+ Indietro
+ Personalizzazioni
+ Volume relativo
+ Riduce a una percentuale del volume corrente invece del volume massimo.
+ Metti in Pausa la Musica
+ Quando inizi a parlare, la musica verrà messa in pausa.
+ ESEMPIO
+ Aggiungi widget
+ Controlla la Modalità di Controllo del Rumore direttamente dalla tua Schermata Principale.
+ Connesso
+ Connesso a Linux
+ Connesso
+ Spostato su Linux
+ Spostato su %1$s
+ Riconnetti dalla notifica
+ Tracciamento della Testa
+ Annuisci per rispondere alle chiamate e scuoti la testa per rifiutarle.
+ Generale
+ Azione del Tile Impostazioni Rapide
+ Mostra la finestra di dialogo per il controllo del rumore al tocco.
+ Alterna tra le modalità al tocco.
+ Sviluppatore
+ Apri le Impostazioni degli AirPods
+ Gestisci le funzionalità e le preferenze degli AirPods
+ Rilevamento Automatico dell'Orecchio
+ Riproduzione Automatica
+ Pausa Automatica
+ Risoluzione dei Problemi
+ Raccogli i log per diagnosticare i problemi con la connessione degli AirPods
+ Raccogli Log
+ Log Salvati
+ Nessun log salvato trovato
+ Preferenze di Connessione Automatica
+ Connetti ai tuoi AirPods quando il loro stato è:
+ Disconnesso
+ Gli AirPods non sono connessi a un dispositivo
+ Inattivo
+ Un dispositivo è connesso ai tuoi AirPods, ma non riproduce contenuti multimediali né è in chiamata
+ Riproduzione di contenuti multimediali
+ Un dispositivo sta riproducendo contenuti multimediali sui tuoi AirPods
+ In chiamata
+ Un dispositivo è in chiamata con i tuoi AirPods
+ Connetti agli AirPods quando il tuo telefono è:
+ Ricezione di una chiamata
+ Il tuo telefono inizia a squillare
+ Avvio della riproduzione di contenuti multimediali
+ Il tuo telefono inizia a riprodurre contenuti multimediali
+ Annulla
+ Puoi personalizzare la modalità Trasparenza per i tuoi AirPods Pro per aiutarti a sentire ciò che ti circonda.
+ La Riduzione dei Suoni Forti può ridurre attivamente la tua esposizione ai forti rumori ambientali quando in modalità Trasparenza e Adattiva. La Riduzione dei Suoni Forti non è attiva in modalità Spento.
+ Riduzione dei Suoni Forti
+ Controlli Chiamata
+ Connetti automaticamente a questo dispositivo
+ Quando abilitato, gli AirPods tenteranno di connettersi automaticamente a questo dispositivo. Altrimenti, tenteranno di connettersi automaticamente solo se sono stati connessi in precedenza.
+ Metti in pausa i contenuti multimediali quando ti addormenti
+ Modalità Ascolto Disattivata
+ Quando questa opzione è attiva, le modalità di ascolto degli AirPods includeranno un'opzione "Spento". I livelli di suono forti non vengono ridotti quando la modalità di ascolto è impostata su "Spento".
+ Microfono
+ Modalità Microfono
+ Automatico
+ Sempre Destro
+ Sempre Sinistro
+ Rispondi alla chiamata
+ Silenzia/Riattiva
+ Riaggancia
+ Premi una Volta
+ Premi Due Volte
+ Apparecchio Acustico
+ Regolazioni
+ Scorri per controllare l'amplificazione
+ Quando sei in modalità Trasparenza e nessun contenuto multimediale è in riproduzione, scorri verso l'alto e verso il basso sui controlli Touch dei tuoi AirPods Pro per aumentare o diminuire l'amplificazione dei suoni ambientali.
+ Modalità Trasparenza
+ Personalizza la Modalità Trasparenza
+ Velocità di Pressione
+ Regola la velocità richiesta per premere due o tre volte sui tuoi AirPods.
+ Durata della Pressione Prolungata
+ Regola la durata richiesta per premere e tenere premuto sui tuoi AirPods.
+ Velocità di Scorrimento del Volume
+ Per evitare regolazioni involontarie del volume, seleziona il tempo di attesa preferito tra gli scorrimenti.
+ Equalizzatore
+ Applica EQ a
+ Telefono
+ Media
+ Banda %d
+ Predefinito
+ Più lento
+ Il più lento
+ Più lungo
+ Il più lungo
+ Più scuro
+ Più luminoso
+ Meno
+ Di più
+ Amplificazione
+ Bilanciamento
+ Tono
+ Riduzione del Rumore Ambientale
+ Potenziamento Conversazione
+ Potenziamento Conversazione concentra i tuoi AirPods Pro sulla persona che parla di fronte a te, rendendo più facile sentire in una conversazione faccia a faccia.
+ Gli AirPods possono utilizzare i risultati di un test dell'udito per apportare modifiche che migliorano la chiarezza delle voci e dei suoni intorno a te.\n\nApparecchio Acustico è destinato solo a persone con perdita dell'udito da lieve a moderata.
+ Assistenza Media
+ Gli AirPods Pro possono utilizzare i risultati di un test dell'udito per apportare modifiche che migliorano la chiarezza di musica, video e chiamate.
+ Regola Musica e Video
+ Regola Chiamate
+ Widget
+ Mostra la batteria del telefono nel widget
+ Visualizza il livello della batteria del tuo telefono nel widget accanto alla batteria degli AirPods
+ Volume Consapevolezza Conversazionale
+ Tile Impostazioni Rapide
+ Apri finestra di dialogo per il controllo
+ Se disabilitato, cliccando sul QS si scorrerà tra le modalità. Se abilitato, verrà mostrata una finestra di dialogo per controllare la modalità di controllo del rumore e la consapevolezza conversazionale.
+ Disconnetti AirPods quando non indossati
+ Sarai ancora in grado di controllarli con l'app - questo disconnette solo l'audio.
+ Opzioni Avanzate
+ Imposta Chiave di Risoluzione Identità (IRK)
+ Imposta manualmente il valore IRK utilizzato per risolvere gli indirizzi casuali BLE
+ Imposta Chiave di Crittografia
+ Imposta manualmente il valore ENC_KEY utilizzato per decrittografare le pubblicità BLE
+ Utilizza pacchetti alternativi di tracciamento della testa
+ Abilita questo se il tracciamento della testa non funziona per te. Questo invia dati diversi agli AirPods per richiedere/interrompere i dati di tracciamento della testa.
+ Comportati come un dispositivo Apple
+ Abilita la connettività multi-dispositivo e le funzionalità di Accessibilità come la personalizzazione della modalità Trasparenza (amplificazione, tono, riduzione del rumore ambientale, potenziamento conversazione ed EQ)
+ Potrebbe essere instabile!! Un massimo di due dispositivi possono essere connessi ai tuoi AirPods. Se li stai usando con un dispositivo Apple come un iPad o un Mac, connetti prima quel dispositivo e poi il tuo Android.
+ Reimposta Offset Hook
+ Questo cancellerà l'offset hook corrente e richiederà di rifare la procedura di configurazione. Sei sicuro di voler continuare?
+ Reimposta
+ Offset hook è stato resettato. Reindirizzamento alla configurazione...
+ Impossibile reimpostare l'offset hook
+ IRK impostata correttamente
+ Chiave di crittografia impostata correttamente
+ Valore Esadecimale IRK
+ Valore Esadecimale ENC_KEY
+ Inserisci IRK di 16 byte come stringa esadecimale (32 caratteri):
+ Inserisci ENC_KEY di 16 byte come stringa esadecimale (32 caratteri):
+ Devono essere esattamente 32 caratteri esadecimali
+ Errore durante la conversione esadecimale:
+ Offset trovato, riavviare il processo Bluetooth
+ Assistente Digitale
+ Attivo
+ Telecomando Fotocamera
+ Controllo Fotocamera
+ Scatta una foto, avvia o interrompi la registrazione e altro utilizzando Premere una Volta o Premere e Tenere Premuto. Quando si utilizzano gli AirPods per le azioni della fotocamera, se si seleziona Premere una Volta, i gesti di controllo dei media non saranno disponibili e, se si seleziona Premere e Tenere Premuto, la modalità di ascolto e i gesti dell'Assistente Digitale non saranno disponibili.
+ Imposta un pacchetto app personalizzato per il rilevamento della fotocamera
+ Imposta Appid Fotocamera Personalizzata
+ Inserisci l'id dell'applicazione della fotocamera:
+ Appid Fotocamera Personalizzata
+ Appid fotocamera personalizzata impostata correttamente
+ Ascoltatore fotocamera
+ Servizio di ascolto per LibrePods per rilevare quando la fotocamera è attiva per attivare il controllo della fotocamera sugli AirPods.
+ Licenze Open Source
+ Aggiorna Test Uditivo
+ Aggiorna Risultato Test Uditivo
+ ATT Manager è nullo, prova a riconnetterti.
+ Sono richieste le seguenti autorizzazioni per utilizzare l'app. Si prega di concederle per continuare.
+ Scuoti la testa o annuisci!
+ Accesso Root Richiesto
+ Questa app ha bisogno dell'accesso root per agganciarsi alla libreria Bluetooth
+ L'accesso root è stato negato. Si prega di concedere i permessi di root.
+ Passaggi per la Risoluzione dei Problemi
+ Si prega di inserire i valori di perdita in dbHL
+ Informazioni
+ Nome Modello
+ Numero Modello
+ Numero di Serie
+ Versione
+ Salute Uditiva
+ Protezione dell'Udito
+ Uso in Ambienti di Lavoro
+ Protezione EN 352
+ La protezione EN 352 limita il livello massimo dei media a 82 dBA e soddisfa i requisiti applicabili dello standard EN 352 per la protezione individuale dell'udito.
+ Rumore Ambientale
+ Riconnetti all'ultimo dispositivo connesso
+ Disconnetti
+ Supportami
+ Non mostrare più
+ Di recente ho perso il mio AirPod sinistro. Se hai trovato utile LibrePods, considera di supportarmi su GitHub Sponsors in modo che possa acquistare un sostituto e continuare a lavorare su questo progetto: anche una piccola somma fa molto. Grazie per il tuo supporto!
+ Supporta LibrePods
+ Disattiva la gestione del rumore
+ Lascia entrare i suoni esterni
+ Regola dinamicamente il rumore esterno
+ Blocca i suoni esterni
+
diff --git a/android/app/src/main/res/values-es/strings.xml b/android/app/src/main/res/values-es/strings.xml
new file mode 100644
index 000000000..9d621d432
--- /dev/null
+++ b/android/app/src/main/res/values-es/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ Libera tus AirPods del ecosistema de Apple.
+ ¡Ve el estado de batería de tus AirPods desde tu pantalla de inicio!
+ Accesibilidad
+ Volumen del tono
+ Ajusta el volumen de los efectos de sonido reproducidos por los AirPods.
+ Audio
+ Audio Adaptativo
+ Personalizar Audio Adaptativo
+ El audio adaptativo responde al entorno y cancela o permite ruido externo. Puedes ajustarlo para permitir más o menos ruido.
+ Auriculares
+ Estuche
+ Probar
+ Nombre
+ Modo de Escucha
+ Desactivado
+ Transparencia
+ Adaptativo
+ Cancelación de Ruido
+ Pulsar y Mantener AirPods
+ Mantén presionado para alternar entre los modos seleccionados.
+ Gestos de Cabeza
+ Izquierdo
+ Derecho
+ Detección de Conversación
+ Reduce el volumen y el ruido de fondo cuando comienzas a hablar.
+ Volumen Personalizado
+ Ajusta el volumen en función del entorno.
+ Cancelación de sonido con un solo AirPod
+ Permite activar la cancelación de sonido con un solo auricular puesto.
+ Control de Volumen
+ Ajusta el volumen deslizando arriba o abajo en el control táctil de los AirPods Pro.
+ AirPods no conectados
+ Por favor, conecta tus AirPods para acceder a los ajustes.
+ Atrás
+ Personalización
+ Volumen relativo
+ Reduce a un porcentaje del volumen actual en vez del volumen máximo.
+ Pausar música
+ La música se pausará cuando comiences a hablar.
+ EJEMPLO
+ Añadir widget
+ Controla el modo de control de ruido desde tu pantalla de inicio.
+ Conectado
+ Conectado a Linux
+ Conectado
+ Transferido a Linux
+ Transferido a %1$s
+ Reconectar desde notificación
+ Seguimiento de Cabeza
+ Asiente para contestar y niega para rechazar.
+ General
+ Acción del botón de Ajustes Rápidos
+ Mostrar diálogo de control de ruido al tocar.
+ Alternar modos al tocar.
+ Desarrollador
+ Abrir Ajustes de AirPods
+ Gestionar funciones y preferencias
+ Detección Automática de Oído
+ Reproducción automática
+ Pausa automática
+ Solución de Problemas
+ Recopila registros para diagnosticar problemas de conexión de los AirPods
+ Recopilar registros
+ Guardar registros
+ No se encontraron registros
+ Preferencias de Autoconexión
+ Conectar a tus AirPods cuando su estado sea:
+ Desconectado
+ AirPods no conectados a ningún dispositivo
+ Inactivos
+ Un dispositivo está conectado a tus AirPods, pero no está reproduciendo audio ni llamando
+ Reproduciendo
+ Un dispositivo está reproduciendo audio en tus AirPods
+ En llamada
+ Un dispositivo está en llamada con tus AirPods
+ Conectar a tus AirPods cuando el teléfono esté:
+ Llamada entrante
+ El teléfono empieza a sonar
+ Iniciando reproducción
+ El teléfono empieza a reproducir audio
+ Deshacer
+ Puedes personalizar el modo Transparencia de tus AirPods Pro para oír mejor tu entorno.
+ Reducción de Sonidos Fuertes puede reducir activamente la exposición a entornos ruidosos en modo Transparencia y Adaptativo. Reducción de Sonidos Fuertes no está activa en modo Desactivado.
+ Reducción de Sonidos Fuertes
+ Controles de Llamada
+ Conectar a este dispositivo automáticamente
+ Al activarse, los AirPods intentarán conectarse automáticamente a este dispositivo. Si no es posible, se intentarán conectar al último dispositivo utilizado.
+ Pausar audio al quedarse dormido
+ Modo de Escucha Desactivado
+ Cuando está activado, los modos de escucha de AirPods incluyen la opción Desactivado. Cuando el modo de Escucha Desactivado está activado no se reducen ruidos fuertes.
+ Micrófono
+ Modo de Micrófono
+ Automático
+ Siempre derecho
+ Siempre izquierdo
+ Responder
+ Silenciar/Desilenciar
+ Colgar
+ Pulsar una vez
+ Pulsar dos veces
+ Audífono
+ Ajustes
+ Deslizar para controlar amplificación
+ Cuando en modo Transparencia y no hay audio reproduciéndose, desliza hacia arriba y/o abajo en los controles táctiles de los AirPods Pro para ajustar la amplificación ambiental.
+ Modo Transparencia
+ Personalizar Modo Transparencia
+ Velocidad de pulsación
+ Ajusta la velocidad necesaria para pulsar dos o tres veces en tus AirPods.
+ Duración de pulsación prolongada
+ Ajusta la duración requerida para pulsación prolongada en tus AirPods.
+ Velocidad de deslizamiento
+ Selecciona el tiempo entre deslizamientos para evitar ajustes involuntarios.
+ Ecualizador (EQ)
+ Aplicar EQ a
+ Teléfono
+ Multimedia
+ Banda %d
+ Predeterminado
+ Más lento
+ Muy lento
+ Más largo
+ Muy largo
+ Más oscuro
+ Más claro
+ Menos
+ Más
+ Amplificación
+ Balance
+ Tono
+ Reducción de Ruido Ambiental
+ Refuerzo de Conversación
+ Refuerzo de Conversación enfoca tu AirPods Pro en la persona frente a ti facilitando la escucha de conversaciones cara a cara.
+ Los AirPods pueden usar resultados de pruebas auditivas para mejorar la claridad de voces y sonidos de tu alrededor.\n\nEl modo Audífono tiene como objetivo ayudar a personas con problemas auditivos leves o moderados.
+ Asistencia Multimedia
+ Los AirPods Pro pueden usar resultados de pruebas auditivas para mejorar la claridad de música, video y llamadas.
+ Ajustar Música y Video
+ Ajustar Llamadas
+ Widget
+ Mostrar batería del teléfono en Widget
+ Mostrar la batería del teléfono junto a la de los AirPods en el Widget.
+ Volumen de Detección de Conversación
+ Botón de Ajustes Rápidos
+ Abrir diálogo de controles
+ Si está desactivado, al pulsar Ajustes rápidos alterna modos. Si está activado, muestra un diálogo de controles para control de ruido y detección de conversaciones.
+ Desconectar AirPods cuando no estén puestos
+ Aún podrás controlarlos con la aplicación, este ajuste sólo desconecta el audio.
+ Opciones Avanzadas
+ Establecer Identity Resolving Key (IRK)
+ Configura manualmente valor utilizado IRK para resolver direcciones aleatorias BLE.
+ Establecer Clave de Cifrado (ENC_KEY)
+ Configurar manualmente valor ENC_KEY utilizado para descifrar BLE cifrado.
+ Utilizar paquetes head tracking alternativos
+ Activar si head tracking no funciona. Esto enviará datos distintos a AirPods para solicitar/detener datos head tracking.
+ Actuar como dispositivo Apple
+ Activa conectividad multidispositivo y funciones de Accesibilidad como modo transparencia personalizado (amplificación, tono, reducción de ruido ambiente, potenciador de conversaciones, y EQ).
+ ¡Puede ser inestable! Se puede conectar como máximo dos dispositivos a tus AirPods. Si estás utilizando un dispositivo de Apple, como un iPad o Mac, por favor conéctalo antes y posteriormente conecta tu dispositivo Android.
+ Restablecer Hook Offset
+ Esto elimina el hook offset actual y requiere volver a realizar la configuración inicial. ¿Estás seguro que quieres continuar?
+ Restablecer
+ Hook offset restablecido. Redirigiendo a configuración inicial...
+ Error al restablecer hook offset
+ IRK ha sido establecido
+ Clave de cifrado establecida
+ Valor IRK Hex
+ Valor ENC_KEY Hex
+ Introducir 16-byte IRK como formato hexadecimal (32 caracteres):
+ Introducir 16-byte ENC_KEY como formato hexadecimal (32 caracteres):
+ Debe tener exactamente 32 caracteres hexadecimales
+ Error convirtiendo hex:
+ Offset encontrado. Por favor, reinicie el proceso Bluetooth
+ Asistente Digital
+ Activado
+ Control Remoto de Cámara
+ Control de Cámara
+ Toma fotos o inicia grabación usando Pulsar una vez o Pulsación Prolongada. Los AirPods para acciones de la cámara: si selecciona Pulsar una vez, los gestos de control multimedia no estarán disponibles, y si selecciona Pulsación Prolongada, el modo de escucha y los gestos del Asistente Digital no estarán disponibles.
+ Configurar un paquete de aplicaciones personalizado para la detección de la cámara
+ Establecer Appid de cámara personalizada
+ Introduzca el ID de la aplicación de la cámara:
+ Aplicación de cámara personalizada Appid
+ Appid de cámara establecido correctamente
+ Escucha de cámara
+ Servicio de escucha para LibrePods que detecta cuándo la cámara está activa para activar el control de la cámara en los AirPods.
+ Licencias de Código Abierto
+ Actualizar Prueba Auditiva
+ Actualizar el Resultado de la Prueba Auditiva
+ ATT Manager es nulo. Intente reconectar.
+ Se requieren los siguientes permisos para utilizar la aplicación. Por favor, autorícelos para continuar.
+ ¡Mueve la cabeza o asiente!
+ Se requiere acceso root
+ Esta aplicación necesita acceso root para conectarse a la biblioteca Bluetooth
+ Se ha denegado el acceso root. Por favor, conceda permisos root.
+ Pasos para la resolución de problemas
+ Introduzca los valores de pérdida en dbHL.
+ Acerca de
+ Nombre del modelo
+ Número de modelo
+ Número de serie
+ Versión
+ Salud Auditiva
+ Protección Auditiva
+ Workspace en uso
+ Protección EN 352
+ La norma EN 352 limita el nivel máximo de los medios a 82 dBA y cumple los requisitos aplicables de la norma EN 352 para la protección auditiva personal.
+ Ruido ambiental
+ Reconectar al último dispositivo conectado
+ Desconectar
+ Apóyame
+ No volver a mostrar
+ Hace poco perdí mi AirPod izquierdo. Si LibrePods te ha resultado útil, considera apoyarme en GitHub Sponsors para que pueda comprar un reemplazo y seguir trabajando en este proyecto; incluso una pequeña donación es de gran ayuda. ¡Gracias por tu apoyo!
+ Apoya a LibrePods
+ Desactiva la gestión del ruido
+ Deja entrar los sonidos externos
+ Ajuste dinámico del ruido externo
+ Bloquea los sonidos externos
+
diff --git a/android/app/src/main/res/values-fr/strings.xml b/android/app/src/main/res/values-fr/strings.xml
new file mode 100644
index 000000000..ad62e675a
--- /dev/null
+++ b/android/app/src/main/res/values-fr/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ Libérez vos AirPods de l\'écosystème Apple.
+ Voyez l\'état de la batterie de vos AirPods directement depuis votre écran d\'accueil !
+ Accessibilité
+ Volume de la tonalité
+ Ajustez le volume des effets sonores émis sur les AirPods.
+ Audio
+ Audio Adaptatif
+ Personnaliser l\'Audio Adaptatif
+ L\'audio Adaptatif répond dynamiquement à votre environnement et annule ou laisse entrer le bruit extérieur. Vous pouvez personnaliser l\'Audio Adaptatif pour laisser entrer plus ou moins de bruit.
+ Écouteurs
+ Boîtier
+ Test
+ Nom
+ Mode d\'écoute
+ Désactivé
+ Transparence
+ Adaptatif
+ Réduction de bruit
+ Appuyer et maintenir les AirPods
+ Maintenez la tige pour passer entre les modes d\'écoute sélectionnés.
+ Gestes de la tête
+ Gauche
+ Droite
+ Détection des conversations
+ Baisse le volume des médias et réduit le bruit de fond lorsque vous commencez à parler à quelqu\'un.
+ Volume personnalisé
+ Ajuste le volume des médias en réponse à votre environnement.
+ Réduction du bruit avec un écouteur
+ Permet d\'activer la réduction de bruit même avec un seul AirPod à l\'oreille.
+ Contrôle du volume
+ Ajustez le volume en balayant vers le haut ou vers le bas sur le capteur situé sur la tige des AirPods Pro.
+ AirPods non connectés
+ Veuillez connecter vos AirPods pour accéder aux réglages.
+ Retour
+ Personnalisations
+ Volume relatif
+ Réduit à un pourcentage du volume actuel plutôt qu\'au volume maximum.
+ Mettre la musique en pause
+ Quand vous commencez à parler, la musique sera mise en pause.
+ EXEMPLE
+ Ajouter le widget
+ Contrôlez le mode de réduction de bruit directement depuis votre écran d\'accueil.
+ Connecté
+ Connecté à Linux
+ Connecté
+ Déplacé vers Linux
+ Déplacé vers %1$s
+ Reconnecté depuis la notification
+ Suivi de la tête
+ Hochez la tête pour répondre aux appels, secouez-la pour refuser.
+ Général
+ Action de la tuile dans les réglages rapides
+ Afficher le dialogue de contrôle du bruit au toucher.
+ Faire défiler les modes au toucher.
+ Développeur
+ Ouvrir les réglages des AirPods
+ Gérer les fonctionnalités et préférences des AirPods
+ Détection automatique des oreilles
+ Lecture Automatique
+ Pause Automatique
+ Dépannage
+ Collecter des journaux pour diagnostiquer les problèmes de connexion des AirPods
+ Collecter les journaux
+ Journaux enregistrés
+ Aucun journal sauvegardé trouvé
+ Préférences d\'auto-connexion
+ Se connecter aux AirPods lorsque leur état est :
+ Déconnectés
+ Les AirPods ne sont connectés à aucun appareil
+ Inactifs
+ Un appareil est connecté à vos AirPods, mais ne lit pas de média et n\'est pas en appel
+ Lecture de média
+ Un appareil lit du média via les AirPods
+ En appel
+ Un appareil est en appel via les AirPods
+ Se connecter aux AirPods lorsque votre téléphone :
+ Reçoit un appel
+ Votre téléphone commence à sonner
+ Démarre la lecture média
+ Votre téléphone commence à lire un média
+ Annuler
+ Vous pouvez personnaliser le mode Transparence de vos AirPods Pro pour vous aider à entendre ce qui vous entoure.
+ La réduction des sons forts peut réduire activement votre exposition aux bruits ambiants forts en mode Transparence et Adaptatif. La réduction des sons forts n\'est pas active en mode Désactivé.
+ Réduction des sons forts
+ Contrôle des appels
+ Se connecter automatiquement à cet appareil
+ Quand ce mode est activé, les AirPods essaieront de se connecter automatiquement à cet appareil. Sinon, ils essaieront uniquement de se connecter automatiquement au dernier appareil connecté.
+ Mettre en pause l\'écoute au moment de s\'endormir
+ Mode d\'écoute Désactivé
+ Quand ce paramètre est activé, les modes d\'écoute incluront une option Désactivé. Les sons forts ne sont pas réduits en mode Désactivé.
+ Microphone
+ Mode du microphone
+ Automatique
+ Toujours à droite
+ Toujours à gauche
+ Répondre aux appels
+ Muet / Activer le son
+ Raccrocher
+ Appuyer une fois
+ Appuyer deux fois
+ Aide auditive
+ Ajustements
+ Balayer pour contrôler l\'amplification
+ En mode Transparence et sans lecture média, balayez sur les commandes tactiles des AirPods Pro pour augmenter ou diminuer l\'amplification des sons environnants.
+ Mode Transparence
+ Personnaliser le mode Transparence
+ Vitesse d\'appui
+ Ajustez la vitesse requise pour appuyer deux ou trois fois sur vos AirPods.
+ Durée d\'appui et de maintien
+ Ajustez la durée requise pour maintenir la pression sur vos AirPods.
+ Vitesse du balayage du volume
+ Pour éviter les changements de volume involontaires, sélectionnez le délai préféré entre les balayages.
+ Égaliseur
+ Appliquer l\'EQ à
+ Téléphone
+ Média
+ Bande %d
+ Par défaut
+ Plus lent
+ Très lent
+ Plus long
+ Très long
+ Plus sombre
+ Plus clair
+ Moins
+ Plus
+ Amplification
+ Balance
+ Tonalité
+ Réduction des bruits ambiants
+ Amplificateur de conversation
+ L\'Amplificateur de conversation concentre les AirPods Pro sur la personne en face de vous, facilitant les conversations en face-à-face.
+ Les AirPods peuvent utiliser les résultats d\'un test auditif pour améliorer la clarté des voix et des sons autour de vous.\n\nL\'aide auditive est destinée aux personnes ayant une perte auditive légère à modérée.
+ Aide multimédia
+ Les AirPods Pro peuvent utiliser les résultats d\'un test auditif pour améliorer la clarté de la musique, des vidéos et des appels.
+ Ajuster la musique et les vidéos
+ Ajuster les appels
+ Widget
+ Afficher la batterie du téléphone dans le widget
+ Affiche le niveau de batterie du téléphone dans le widget avec celle des AirPods
+ Volume de détection des conversations
+ Tuile des réglages rapides
+ Ouvrir le dialogue de contrôle
+ Si désactivé, appuyer sur la tuile fera défiler les modes. Si activé, un dialogue apparaîtra pour contrôler le mode d\'écoute et la détection de conversation.
+ Déconnecter les AirPods quand ils ne sont pas portés
+ Vous pourrez toujours les contrôler depuis l\'app — cela déconnecte juste l\'audio.
+ Options avancées
+ Définir la clé d\'identité et de résolution (IRK)
+ Définir manuellement la clé IRK utilisée pour la résolution des adresses BLE aléatoires
+ Définir la clé de chiffrement
+ Définir manuellement la clé ENC_KEY utilisée pour déchiffrer les publicités BLE
+ Utiliser des paquets alternatifs pour le suivi de la tête
+ Activez ceci si le suivi de tête ne fonctionne pas. Cela envoie un autre type de données aux AirPods pour demander/arrêter le suivi de la tête.
+ Se comporter comme un appareil Apple
+ Active la connectivité multi-appareils et les fonctionnalités d\'accessibilité comme la personnalisation du mode transparence (amplification, tonalité, réduction de bruit ambiant, amplificateur de conversations, EQ)
+ Peut être instable !! Un maximum de deux appareils peut être connecté à vos AirPods. Si vous utilisez un appareil Apple comme un iPad ou un Mac, connectez-le d\'abord, puis connectez votre Android.
+ Réinitialiser l\'offset du hook
+ Cela effacera l\'offset actuel et nécessitera de refaire la configuration. Voulez-vous vraiment continuer ?
+ Réinitialiser
+ Hook offset réinitialisé. Redirection vers la configuration…
+ Impossible de réinitialiser l\'hook offset
+ Clé IRK définie avec succès
+ Clé de chiffrement définie avec succès
+ Valeur hex IRK
+ Valeur hex ENC_KEY
+ Entrez l\'IRK de 16 octets en string hexadécimal (32 caractères) :
+ Entrez l\'ENC_KEY de 16 octets en string hexadécimal (32 caractères) :
+ Doit contenir exactement 32 caractères hexadécimaux
+ Erreur lors de la conversion hexadécimale :
+ Offset trouvé. Veuillez redémarrer le processus Bluetooth.
+ Assistant numérique
+ Activé
+ Télécommande de l\'appareil photo
+ Contrôle de la caméra
+ Prenez une photo, lancez/arrêtez un enregistrement, etc., avec un appui simple ou un appui long. Si vous utilisez un appui simple, les gestes de contrôle multimédia seront indisponibles ; si vous utilisez un appui long, les gestes de mode d\'écoute et d\'assistant numérique seront indisponibles.
+ Définir un paquet d\'application de caméra personnalisé
+ Définir un appid de caméra personnalisé
+ Entrez l\'identifiant de l\'application caméra :
+ Appid caméra personnalisé
+ Appid caméra personnalisé défini avec succès
+ Service d\'écoute de la caméra
+ Service d\'écoute pour que LibrePods détecte quand la caméra est active afin d\'activer le contrôle caméra via les AirPods.
+ Licences open source
+ Mettre à jour le test d\'audition
+ Mettre à jour les résultats du test d\'audition
+ ATT Manager est null, essayez de reconnecter.
+ Les permissions suivantes sont requises pour utiliser l\'application. Veuillez les accorder pour continuer.
+ Secouez la tête ou hochez-la !
+ Accès root requis
+ Cette application nécessite l\'accès root pour s\'injecter dans la bibliothèque Bluetooth.
+ Accès root refusé. Veuillez accorder les permissions root.
+ Étapes de dépannage
+ Veuillez entrer les valeurs de perte en dBHL
+ À propos
+ Nom du modèle
+ Numéro du modèle
+ Numéro de série
+ Version
+ Santé auditive
+ Protection auditive
+ Usage en environnement de travail
+ Protection EN 352
+ La protection EN 352 limite le niveau sonore maximal à 82 dBA et répond aux exigences applicables de la norme EN 352 pour la protection auditive personnelle.
+ Bruit environnemental
+ Reconnecter au dernier appareil
+ Déconnecter
+ Soutenez-moi
+ Ne plus afficher
+ J\'ai récemment perdu mon AirPod gauche. Si LibrePods vous est utile, pensez à me soutenir sur GitHub Sponsors pour m\'aider à en racheter un et continuer ce projet — même un petit montant aide beaucoup. Merci pour votre soutien !
+ Soutenir LibrePods
+ Désactiver la gestion du bruit
+ Laisser entrer les sons extérieurs
+ Ajuster dynamiquement les sons extérieurs
+ Bloquer les sons extérieurs
+
diff --git a/android/app/src/main/res/values-pt/strings.xml b/android/app/src/main/res/values-pt/strings.xml
new file mode 100644
index 000000000..41ed556dd
--- /dev/null
+++ b/android/app/src/main/res/values-pt/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ Libere seus AirPods do ecossistema da Apple.
+ Veja o status da bateria dos seus AirPods diretamente na tela inicial!
+ Acessibilidade
+ Volume do Tom
+ Ajuste o volume do tom dos efeitos sonoros reproduzidos pelos AirPods.
+ Áudio
+ Áudio Adaptativo
+ Personalizar Áudio Adaptativo
+ O áudio adaptativo responde dinamicamente ao seu ambiente e cancela ou permite ruídos externos. Você pode personalizar o Áudio Adaptativo para permitir mais ou menos ruído.
+ Fones
+ Estojo
+ Teste
+ Nome
+ Modo de Escuta
+ Desligado
+ Transparência
+ Adaptativo
+ Cancelamento de Ruído
+ Pressionar e Segurar AirPods
+ Pressione e segure a haste para alternar entre os modos de escuta selecionados.
+ Gestos com a Cabeça
+ Esquerdo
+ Direito
+ Consciência Conversacional
+ Reduz o volume da mídia e diminui o ruído de fundo quando você começa a falar com outras pessoas.
+ Volume Personalizado
+ Ajusta o volume da mídia em resposta ao seu ambiente.
+ Cancelamento de Ruído com um AirPod
+ Permite que os AirPods sejam colocados em modo de cancelamento de ruído quando apenas um AirPod está no seu ouvido.
+ Controle de Volume
+ Ajuste o volume deslizando para cima ou para baixo no sensor localizado na haste dos AirPods Pro.
+ AirPods não conectados
+ Por favor, conecte seus AirPods para acessar as configurações.
+ Voltar
+ Personalizações
+ Volume relativo
+ Reduz para uma porcentagem do volume atual em vez do volume máximo.
+ Pausar Música
+ Quando você começar a falar, a música será pausada.
+ EXEMPLO
+ Adicionar widget
+ Controle o Modo de Controle de Ruído diretamente da sua Tela Inicial.
+ Conectado
+ Conectado ao Linux
+ Conectado
+ Movido para Linux
+ Movido para %1$s
+ Reconectar pela notificação
+ Rastreamento de Cabeça
+ Acene para atender chamadas e balance a cabeça para recusar.
+ Geral
+ Ação do Bloco de Configurações Rápidas
+ Mostrar diálogo de controle de ruído ao tocar.
+ Alternar entre modos ao tocar.
+ Desenvolvedor
+ Abrir Configurações dos AirPods
+ Gerencie recursos e preferências dos AirPods
+ Detecção Automática de Ouvido
+ Reprodução Automática
+ Pausa Automática
+ Solução de Problemas
+ Coletar logs para diagnosticar problemas com a conexão dos AirPods
+ Coletar Logs
+ Logs Salvos
+ Nenhum log salvo encontrado
+ Preferências de Auto-conexão
+ Conectar aos seus AirPods quando o status for:
+ Desconectado
+ Os AirPods não estão conectados a um dispositivo
+ Inativo
+ Um dispositivo está conectado aos seus AirPods, mas não está reproduzindo mídia ou em uma chamada
+ Reproduzindo mídia
+ Um dispositivo está reproduzindo mídia nos seus AirPods
+ Em chamada
+ Um dispositivo está em uma chamada com seus AirPods
+ Conectar aos AirPods quando seu telefone estiver:
+ Recebendo uma chamada
+ Seu telefone começa a tocar
+ Iniciando reprodução de mídia
+ Seu telefone começa a reproduzir mídia
+ Desfazer
+ Você pode personalizar o modo de Transparência para seus AirPods Pro para ajudá-lo a ouvir o que está ao seu redor.
+ A Redução de Som Alto pode reduzir ativamente sua exposição a ruídos ambientais altos quando estiver nos modos Transparência e Adaptativo. A Redução de Som Alto não está ativa no modo Desligado.
+ Redução de Som Alto
+ Controles de Chamada
+ Conectar a este dispositivo automaticamente
+ Quando habilitado, os AirPods tentarão conectar a este dispositivo automaticamente. Caso contrário, eles tentarão conectar automaticamente apenas quando conectados pela última vez.
+ Pausar mídia ao adormecer
+ Modo de Escuta Desligado
+ Quando isso estiver ativado, os modos de escuta dos AirPods incluirão uma opção Desligado. Os níveis de som alto não são reduzidos quando o modo de escuta está definido como Desligado.
+ Microfone
+ Modo do Microfone
+ Automático
+ Sempre Direito
+ Sempre Esquerdo
+ Atender chamada
+ Silenciar/Ativar Som
+ Desligar
+ Pressionar Uma Vez
+ Pressionar Duas Vezes
+ Auxiliar de Audição
+ Ajustes
+ Deslize para controlar a amplificação
+ Quando estiver no modo Transparência e nenhuma mídia estiver sendo reproduzida, deslize para cima e para baixo nos controles de toque dos seus AirPods Pro para aumentar ou diminuir a amplificação dos sons ambientais.
+ Modo Transparência
+ Personalizar Modo Transparência
+ Velocidade de Pressionamento
+ Ajuste a velocidade necessária para pressionar duas ou três vezes nos seus AirPods.
+ Duração de Pressionar e Segurar
+ Ajuste a duração necessária para pressionar e segurar nos seus AirPods.
+ Velocidade de Deslize de Volume
+ Para evitar ajustes de volume não intencionais, selecione o tempo de espera preferido entre deslizes.
+ Equalizador
+ Aplicar EQ a
+ Telefone
+ Mídia
+ Banda %d
+ Padrão
+ Mais Lento
+ Mais Lento
+ Mais Longo
+ Mais Longo
+ Mais Escuro
+ Mais Claro
+ Menos
+ Mais
+ Amplificação
+ Balanço
+ Tom
+ Redução de Ruído Ambiental
+ Amplificação de Conversa
+ A Amplificação de Conversa foca seus AirPods Pro na pessoa falando na sua frente, facilitando ouvir em uma conversa face a face.
+ Os AirPods podem usar os resultados de um teste auditivo para fazer ajustes que melhoram a clareza de vozes e sons ao seu redor.\n\nO Auxiliar de Audição é destinado apenas para pessoas com perda auditiva leve a moderada percebida.
+ Assistente de Mídia
+ Os AirPods Pro podem usar os resultados de um teste auditivo para fazer ajustes que melhoram a clareza de música, vídeo e chamadas.
+ Ajustar Música e Vídeo
+ Ajustar Chamadas
+ Widget
+ Mostrar bateria do telefone no widget
+ Exiba o nível de bateria do seu telefone no widget junto com a bateria dos AirPods
+ Volume de Consciência Conversacional
+ Bloco de Configurações Rápidas
+ Abrir diálogo para controlar
+ Se desabilitado, clicar no bloco de configurações rápidas alternará entre modos. Se habilitado, mostrará um diálogo para controlar o modo de controle de ruído e a consciência conversacional
+ Desconectar AirPods quando não estiver usando
+ Você ainda poderá controlá-los com o aplicativo - isso apenas desconecta o áudio.
+ Opções Avançadas
+ Definir Chave de Resolução de Identidade (IRK)
+ Defina manualmente o valor IRK usado para resolver endereços aleatórios BLE
+ Definir Chave de Criptografia
+ Defina manualmente o valor ENC_KEY usado para descriptografar anúncios BLE
+ Usar pacotes alternativos de rastreamento de cabeça
+ Habilite isso se o rastreamento de cabeça não funcionar para você. Isso envia dados diferentes para os AirPods para solicitar/parar dados de rastreamento de cabeça.
+ Agir como um dispositivo Apple
+ Habilita conectividade multi-dispositivo e recursos de Acessibilidade como personalização do modo de transparência (amplificação, tom, redução de ruído ambiental, amplificação de conversa e equalizador)
+ Pode ser instável!! Um máximo de dois dispositivos pode estar conectado aos seus AirPods. Se você estiver usando com um dispositivo Apple como iPad ou Mac, então conecte esse dispositivo primeiro e depois seu Android.
+ Redefinir Offset do Hook
+ Isso limpará o offset do hook atual e exigirá que você passe pelo processo de configuração novamente. Tem certeza de que deseja continuar?
+ Redefinir
+ O offset do hook foi redefinido. Redirecionando para a configuração...
+ Falha ao redefinir o offset do hook
+ IRK foi definido com sucesso
+ A chave de criptografia foi definida com sucesso
+ Valor Hexadecimal IRK
+ Valor Hexadecimal ENC_KEY
+ Digite o IRK de 16 bytes como string hexadecimal (32 caracteres):
+ Digite o ENC_KEY de 16 bytes como string hexadecimal (32 caracteres):
+ Deve ter exatamente 32 caracteres hexadecimais
+ Erro ao converter hexadecimal:
+ Offset encontrado, por favor reinicie o processo Bluetooth
+ Assistente Digital
+ Ligado
+ Controle Remoto da Câmera
+ Controle da Câmera
+ Capture uma foto, inicie ou pare a gravação e mais usando Pressionar Uma Vez ou Pressionar e Segurar. Ao usar AirPods para ações da câmera, se você selecionar Pressionar Uma Vez, os gestos de controle de mídia estarão indisponíveis, e se você selecionar Pressionar e Segurar, os gestos de modo de escuta e Assistente Digital estarão indisponíveis.
+ Defina um pacote de aplicativo personalizado para detecção de câmera
+ Definir ID do Aplicativo de Câmera Personalizado
+ Digite o ID do aplicativo da câmera:
+ ID do Aplicativo de Câmera Personalizado
+ ID do aplicativo de câmera personalizado definido com sucesso
+ Ouvinte de câmera
+ Serviço de ouvinte do LibrePods para detectar quando a câmera está ativa para ativar o controle da câmera nos AirPods.
+ Licenças de Código Aberto
+ Atualizar Teste Auditivo
+ Atualizar Resultado do Teste Auditivo
+ O gerenciador ATT está nulo, tente reconectar.
+ As seguintes permissões são necessárias para usar o aplicativo. Por favor, conceda-as para continuar.
+ Balance a cabeça ou acene!
+ Acesso Root Necessário
+ Este aplicativo precisa de acesso root para conectar-se à biblioteca Bluetooth
+ O acesso root foi negado. Por favor, conceda permissões root.
+ Etapas de Solução de Problemas
+ Por favor, digite os valores de perda em dbHL
+ Sobre
+ Nome do Modelo
+ Número do Modelo
+ Número de Série
+ Versão
+ Saúde Auditiva
+ Proteção Auditiva
+ Uso no Local de Trabalho
+ Proteção EN 352
+ A Proteção EN 352 limita o nível máximo de mídia a 82 dBA e atende aos requisitos aplicáveis do padrão EN 352 para proteção auditiva pessoal.
+ Ruído Ambiental
+ Reconectar ao último dispositivo conectado
+ Desconectar
+ Me Apoiar
+ Nunca mostrar novamente
+ Recentemente perdi meu AirPod esquerdo. Se você achou o LibrePods útil, considere me apoiar no GitHub Sponsors para que eu possa comprar uma substituição e continuar trabalhando neste projeto - mesmo uma pequena quantia faz muita diferença. Obrigado pelo seu apoio!
+ Apoiar LibrePods
+ Desativa o gerenciamento de ruído
+ Permite sons externos
+ Ajusta dinamicamente o ruído externo
+ Bloqueia sons externos
+
diff --git a/android/app/src/main/res/values-tr/strings.xml b/android/app/src/main/res/values-tr/strings.xml
new file mode 100644
index 000000000..f87544c62
--- /dev/null
+++ b/android/app/src/main/res/values-tr/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ AirPods\'unuzu Apple\'ın ekosisteminden kurtarın
+ Ana ekranınızdan doğrudan AirPods pil durumunuzu görün!
+ Erişilebilirlik
+ Ton Seviyesi
+ AirPods tarafından çalınan ses efektlerinin ton seviyesini ayarlayın.
+ Ses
+ Uyarlanabilir Ses
+ Uyarlanabilir Sesi Özelleştir
+ Uyarlanabilir ses, ortamınıza dinamik olarak tepki verir ve dış gürültüyü engeller veya geçirir. Uyarlanabilir Sesi daha fazla veya daha az gürültü geçirecek şekilde özelleştirebilirsiniz.
+ Kulaklıklar
+ Kılıf
+ Test
+ İsim
+ Dinleme Modu
+ Kapalı
+ Şeffaflık
+ Uyarlanabilir
+ Gürültü Engelleme
+ AirPods\'a Basılı Tutun
+ Seçili dinleme modları arasında geçiş yapmak için sapı basılı tutun.
+ Kafa Hareketleri
+ Sol
+ Sağ
+ Konuşma Farkındalığı
+ Başkalarıyla konuşmaya başladığınızda medya sesini düşürür ve arka plan gürültüsünü azaltır.
+ Kişiselleştirilmiş Ses
+ Ortamınıza göre medya sesini ayarlar.
+ Tek AirPod ile Gürültü Engelleme
+ Sadece bir AirPod kulağınızdayken gürültü engelleme moduna alınmasına izin verin.
+ Ses Kontrolü
+ AirPods Pro sapında bulunan sensörde yukarı veya aşağı kaydırarak sesi ayarlayın.
+ AirPods bağlı değil
+ Ayarlara erişmek için lütfen AirPods\'unuzu bağlayın.
+ Geri
+ Özelleştirmeler
+ Göreceli ses
+ Maksimum ses yerine mevcut sesin yüzdesine göre azaltır.
+ Müziği Duraklat
+ Konuşmaya başladığınızda müzik duraklatılacaktır.
+ ÖRNEK
+ Widget ekle
+ Gürültü Kontrol Modunu doğrudan Ana Ekranınızdan kontrol edin.
+ Bağlı
+ Linux\'a bağlı
+ Bağlı
+ Linux\'a taşındı
+ %1$s cihazına taşındı
+ Bildirimden yeniden bağlan
+ Kafa Takibi
+ Aramaları yanıtlamak için başınızı sallayın, reddetmek için başınızı sallayın.
+ Genel
+ Hızlı Ayarlar Döşemesi Eylemi
+ Dokunulduğunda gürültü kontrolü iletişim kutusunu göster.
+ Dokunulduğunda modlar arasında geçiş yap.
+ Geliştirici
+ AirPods Ayarlarını Aç
+ AirPods özelliklerini ve tercihlerini yönetin
+ Otomatik Kulak Algılama
+ Otomatik Oynat
+ Otomatik Duraklat
+ Sorun Giderme
+ AirPods bağlantı sorunlarını teşhis etmek için log toplayın
+ Log Topla
+ Kaydedilmiş Loglar
+ Kaydedilmiş log bulunamadı
+ Otomatik Bağlanma tercihleri
+ Durumu şu olduğunda AirPods\'unuza bağlanın:
+ Bağlantı kesildi
+ AirPods hiçbir cihaza bağlı değil
+ Boşta
+ Bir cihaz AirPods\'unuza bağlı, ancak medya oynatmıyor veya aramada değil
+ Medya oynatılıyor
+ Bir cihaz AirPods\'unuzda medya oynatıyor
+ Aramada
+ Bir cihaz AirPods\'unuzla aramada
+ Telefonunuz şu durumdayken AirPods\'a bağlanın:
+ Arama alınıyor
+ Telefonunuz çalmaya başlar
+ Medya oynatma başlıyor
+ Telefonunuz medya oynatmaya başlar
+ Geri Al
+ AirPods Pro\'nuz için Şeffaflık modunu, etrafınızdakileri duymanıza yardımcı olacak şekilde özelleştirebilirsiniz.
+ Yüksek Ses Azaltma, Şeffaflık ve Uyarlanabilir moddayken yüksek çevresel gürültülere maruz kalmanızı aktif olarak azaltabilir. Kapalı modda Yüksek Ses Azaltma aktif değildir.
+ Yüksek Ses Azaltma
+ Arama Kontrolleri
+ Bu cihaza otomatik olarak bağlan
+ Etkinleştirildiğinde, AirPods bu cihaza otomatik olarak bağlanmaya çalışacaktır. Aksi takdirde, yalnızca son bağlandığında otomatik bağlanmaya çalışacaktır.
+ Uykuya dalarken medyayı duraklat
+ Kapalı Dinleme Modu
+ Bu açıkken, AirPods dinleme modları bir Kapalı seçeneği içerecektir. Dinleme modu Kapalı olarak ayarlandığında yüksek ses seviyeleri azaltılmaz.
+ Mikrofon
+ Mikrofon Modu
+ Otomatik
+ Her Zaman Sağ
+ Her Zaman Sol
+ Aramayı yanıtla
+ Sessize Al/Aç
+ Aramayı Sonlandır
+ Bir Kez Bas
+ İki Kez Bas
+ İşitme Cihazı
+ Ayarlamalar
+ Güçlendirmeyi kontrol etmek için kaydırın
+ Şeffaflık modundayken ve medya oynatılmıyorken, çevresel seslerin güçlendirmesini artırmak veya azaltmak için AirPods Pro\'nuzun Dokunmatik kontrollerinde yukarı ve aşağı kaydırın.
+ Şeffaflık Modu
+ Şeffaflık Modunu Özelleştir
+ Basma Hızı
+ AirPods\'unuzda iki veya üç kez basmak için gereken hızı ayarlayın.
+ Basılı Tutma Süresi
+ AirPods\'unuzda basılı tutmak için gereken süreyi ayarlayın.
+ Ses Kaydırma Hızı
+ İstenmeyen ses ayarlamalarını önlemek için, kaydırmalar arasındaki tercih edilen bekleme süresini seçin.
+ Ekolayzer
+ EQ\'yu uygula
+ Telefon
+ Medya
+ Bant %d
+ Varsayılan
+ Daha Yavaş
+ En Yavaş
+ Daha Uzun
+ En Uzun
+ Daha Koyu
+ Daha Parlak
+ Daha Az
+ Daha Fazla
+ Güçlendirme
+ Denge
+ Ton
+ Ortam Gürültüsü Azaltma
+ Konuşma Güçlendirme
+ Konuşma Güçlendirme, AirPods Pro\'nuzu önünüzde konuşan kişiye odaklar, yüz yüze konuşmada duymayı kolaylaştırır.
+ AirPods, etrafınızdaki seslerin ve konuşmaların netliğini artıran ayarlamalar yapmak için bir işitme testinin sonuçlarını kullanabilir.\n\nİşitme Cihazı yalnızca hafif ila orta derecede işitme kaybı olan kişiler için tasarlanmıştır.
+ Medya Yardımı
+ AirPods Pro, müzik, video ve aramaların netliğini artıran ayarlamalar yapmak için bir işitme testinin sonuçlarını kullanabilir.
+ Müzik ve Videoyu Ayarla
+ Aramaları Ayarla
+ Widget
+ Widget\'ta telefon pilini göster
+ Widget\'ta AirPods piliyle birlikte telefonunuzun pil seviyesini göster
+ Konuşma Farkındalığı Sesi
+ Hızlı Ayarlar Döşemesi
+ Kontrol için iletişim kutusunu aç
+ Devre dışı bırakılırsa, Hızlı Ayarlar\'a tıklamak modlar arasında geçiş yapar. Etkinleştirilirse, gürültü kontrol modu ve konuşma farkındalığını kontrol etmek için bir iletişim kutusu gösterir
+ Takmadığınızda AirPods\'u bağlantıyı kes
+ Uygulama ile hala kontrol edebileceksiniz - bu sadece sesi keser.
+ Gelişmiş Seçenekler
+ Kimlik Çözümleme Anahtarı (IRK) Ayarla
+ BLE rastgele adreslerini çözmek için kullanılan IRK değerini manuel olarak ayarlayın
+ Şifreleme Anahtarı Ayarla
+ BLE duyurularını şifresini çözmek için kullanılan ENC_KEY değerini manuel olarak ayarlayın
+ Alternatif kafa takibi paketlerini kullan
+ Kafa takibi sizin için çalışmıyorsa bunu etkinleştirin. Bu, kafa takibi verilerini istemek/durdurmak için AirPods\'a farklı veriler gönderir.
+ Apple cihazı gibi davran
+ Çoklu cihaz bağlantısını ve Şeffaflık modunu özelleştirme (güçlendirme, ton, ortam gürültüsü azaltma, konuşma güçlendirme ve EQ) gibi Erişilebilirlik özelliklerini etkinleştirir
+ Kararsız olabilir!! AirPods\'unuza maksimum iki cihaz bağlanabilir. iPad veya Mac gibi bir Apple cihazıyla kullanıyorsanız, lütfen önce o cihazı, sonra Android\'inizi bağlayın.
+ Kanca Ofsetini Sıfırla
+ Bu, mevcut kanca ofsetini temizleyecek ve kurulum sürecinden tekrar geçmenizi gerektirecektir. Devam etmek istediğinizden emin misiniz?
+ Sıfırla
+ Kanca ofseti sıfırlandı. Kuruluma yönlendiriliyor...
+ Kanca ofseti sıfırlanamadı
+ IRK başarıyla ayarlandı
+ Şifreleme anahtarı başarıyla ayarlandı
+ IRK Onaltılık Değeri
+ ENC_KEY Onaltılık Değeri
+ 16 baytlık IRK\'yi onaltılık dize olarak girin (32 karakter):
+ 16 baytlık ENC_KEY\'i onaltılık dize olarak girin (32 karakter):
+ Tam olarak 32 onaltılık karakter olmalıdır
+ Onaltılık dönüştürme hatası:
+ Ofset bulundu, lütfen Bluetooth sürecini yeniden başlatın
+ Dijital Asistan
+ Açık
+ Kamera Uzaktan Kumandası
+ Kamera Kontrolü
+ Bir Kez Bas veya Basılı Tut kullanarak fotoğraf çekin, kaydı başlatın veya durdurun ve daha fazlasını yapın. Kamera işlemleri için AirPods kullanırken, Bir Kez Bas\'ı seçerseniz, medya kontrol hareketleri kullanılamaz ve Basılı Tut\'u seçerseniz, dinleme modu ve Dijital Asistan hareketleri kullanılamaz.
+ Kamera algılama için özel uygulama paketi ayarlayın
+ Özel Kamera uygulama kimliğini ayarla
+ Kamera uygulamasının uygulama kimliğini girin:
+ Özel Kamera uygulama kimliği
+ Özel kamera uygulama kimliği başarıyla ayarlandı
+ Kamera dinleyicisi
+ Kamera aktif olduğunda algılamak ve AirPods\'ta kamera kontrolünü etkinleştirmek için LibrePods dinleyici servisi.
+ Açık Kaynak Lisansları
+ İşitme Testini Güncelle
+ İşitme Testi Sonucunu Güncelle
+ ATT Yöneticisi null, yeniden bağlanmayı deneyin.
+ Uygulamayı kullanmak için aşağıdaki izinler gereklidir. Devam etmek için lütfen bunları verin.
+ Başınızı sallayın veya başınızı sallayın!
+ Root Erişimi Gerekli
+ Bu uygulama Bluetooth kütüphanesine bağlanmak için root erişimine ihtiyaç duyar
+ Root erişimi reddedildi. Lütfen root izinlerini verin.
+ Sorun Giderme Adımları
+ Lütfen kayıp değerlerini dbHL cinsinden girin
+ Hakkında
+ Model Adı
+ Model Numarası
+ Seri Numarası
+ Sürüm
+ İşitme Sağlığı
+ İşitme Koruması
+ İş Yeri Kullanımı
+ EN 352 Koruması
+ EN 352 Koruması, medyanın maksimum seviyesini 82 dBA ile sınırlar ve kişisel işitme koruması için geçerli EN 352 Standart gereksinimlerini karşılar.
+ Çevresel Gürültü
+ Son bağlanan cihaza yeniden bağlan
+ Bağlantıyı Kes
+ Beni destekle
+ Bir daha gösterme
+ Yakın zamanda sol AirPod\'umu kaybettim. LibrePods\'u faydalı bulduysanız, bir yedek satın alıp bu proje üzerinde çalışmaya devam edebilmem için GitHub Sponsors\'ta beni desteklemeyi düşünün - küçük bir miktar bile çok işe yarar. Desteğiniz için teşekkürler!
+ LibrePods\'u Destekle
+ Gürültü yönetimini kapatır
+ Dış sesleri içeri alır
+ Dış gürültüyü dinamik olarak ayarlar
+ Dış sesleri engeller
+
diff --git a/android/app/src/main/res/values-uk/strings.xml b/android/app/src/main/res/values-uk/strings.xml
new file mode 100644
index 000000000..c3ae2a0f9
--- /dev/null
+++ b/android/app/src/main/res/values-uk/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ Звільніть ваші AirPods від екосистеми Apple
+ Перегляньте статус батареї ваших AirPods прямо з головного екрана!
+ Доступність
+ Гучність Тону
+ Налаштуйте гучність тону звукових ефектів, які відтворюються на AirPods.
+ Аудіо
+ Адаптивний Звук
+ Налаштувати Адаптивний Звук
+ Адаптивний звук динамічно реагує на ваше оточення та приглушує або пропускає зовнішній шум. Ви можете налаштувати Адаптивний Звук, щоб пропускати більше або менше шуму.
+ Навушники
+ Кейс
+ Тест
+ Назва
+ Режим Прослуховування
+ Вимкнено
+ Проникність
+ Адаптування
+ Шумогасіння
+ Натисніть і утримуйте AirPods
+ Натисніть і утримуйте ніжку, щоб перемикатися між обраними режимами прослуховування.
+ Жести Головою
+ Лівий
+ Правий
+ Виявлення Розмови
+ Знижує гучність медіа та зменшує фоновий шум, коли ви починаєте говорити.
+ Персональна Гучність
+ Налаштовує гучність медіа відповідно до вашого оточення.
+ Шумогасіння з одним AirPod
+ Дозволяє вмикати режим шумогасіння на AirPods, коли лише один AirPod знаходиться у вашому вусі.
+ Налаштування Гучності
+ Налаштуйте гучність, проводячи вгору або вниз по сенсору, розташованому на ніжці AirPods Pro.
+ AirPods не підключені
+ Будь ласка, підключіть ваші AirPods, щоб отримати доступ до налаштувань.
+ Назад
+ Персоналізація
+ Відносна гучність
+ Зменшує до відсотка від поточної гучності, а не від максимальної.
+ Призупинити Музику
+ Коли ви почнете говорити, музику буде призупинено.
+ ПРИКЛАД
+ Додати віджет
+ Керуйте режимом шумоконтролю прямо з головного екрана.
+ Підключено
+ Підключено до Linux
+ Підключено
+ Переміщено до Linux
+ Переміщено до %1$s
+ Перепідключитися через повідомлення
+ Відстеження Голови
+ Кивніть, щоб відповісти на дзвінок, і похитайте головою, щоб відхилити.
+ Основне
+ Дія плитки швидких налаштувань
+ Показати діалог шумоконтролю при натисканні.
+ Перемикатися між режимами при натисканні.
+ Розробник
+ Відкрити Налаштування AirPods
+ Керуйте функціями та налаштуваннями AirPods
+ Автоматичне Розпізнавання Вуха
+ Автовідтворення
+ Автопауза
+ Усунення несправностей
+ Зібрати логи для діагностики проблем з підключенням AirPods
+ Зібрати Логи
+ Збережені Логи
+ Збережені Логи не знайдено
+ Налаштування авто-підключення
+ Підключатися до ваших AirPods, коли їхній статус:
+ Відʼєднано
+ AirPods не підключені до жодного пристрою
+ Бездіяльний
+ Пристрій підключено до ваших AirPods, але не відтворює медіа і не на дзвінку
+ Відтворення медіа
+ Пристрій відтворює медіа на ваших AirPods
+ На дзвінку
+ Пристрій на дзвінку з вашими AirPods
+ Підключатися до AirPods, коли ваш телефон:
+ Отримання дзвінка
+ Ваш телефон починає дзвонити
+ Початок відтворення медіа
+ Ваш телефон починає відтворювати медіа
+ Скасувати
+ Ви можете налаштувати режим проникності для ваших AirPods Pro, щоб допомогти чути, що відбувається навколо.
+ Зменшення гучних звуків може активно зменшити вплив гучних навколишніх шумів на вас у режимах Проникності та Адаптування. Зменшення гучних звуків не активне у вимкненому режимі.
+ Зменшення гучних звуків
+ Контроль дзвінків
+ Підключатися до цього пристрою автоматично
+ Коли ця опція ввімкнена, AirPods будуть автоматично підключатися до цього пристрою. Коли вимкнена, вони будуть автопідключатися лише до пристрою, до якого підключалися востаннє.
+ Призупинити медіа при засипанні
+ Вимкнути режим прослуховування
+ Коли це ввімкнено, режими прослуховування AirPods будуть включати опцію «Вимкнено». Гучні звуки не зменшуються, коли режим прослуховування встановлений на «Вимкнено».
+ Мікрофон
+ Режим мікрофона
+ Автоматичний
+ Завжди правий
+ Завжди лівий
+ Відповісти на дзвінок
+ Вимкнути/Увімкнути звук
+ Завершити Дзвінок
+ Натиснути один раз
+ Натиснути двічі
+ Слуховий апарат
+ Налаштування
+ Провести пальцем для керування підсиленням
+ Коли в режимі Проникності і медіа не відтворюється, проведіть пальцем вгору або вниз по сенсорних елементах керування ваших AirPods Pro, щоб збільшити або зменшити підсилення навколишніх звуків.
+ Режим Проникності
+ Налаштувати режим проникності
+ Швидкість натискання
+ Налаштуйте швидкість, необхідну для натискання два або три рази на ваших AirPods.
+ Тривалість натискання і утримування
+ Налаштуйте тривалість, необхідну для натискання і утримування на ваших AirPods.
+ Швидкість проведення пальцем для гучності
+ Щоб запобігти ненавмисним налаштуванням гучності, виберіть бажаний час очікування між проведеннями пальцем.
+ Еквалайзер
+ Застосувати EQ до
+ Телефон
+ Медіа
+ Смуга %d
+ За замовчуванням
+ Повільніше
+ Найповільніше
+ Довше
+ Найдовше
+ Темніше
+ Яскравіше
+ Менше
+ Більше
+ Підсилення
+ Баланс
+ Тон
+ Зменшення навколишнього шуму
+ Підсилення розмови
+ Підсилення розмови фокусує ваші AirPods Pro на людині, яка говорить перед вами, полегшуючи спілкування віч-на-віч.
+ AirPods можуть використовувати результати тесту слуху для налаштувань, які покращують чіткість голосів та звуків навколо вас.\n\nРежим слухового апарата призначений лише для людей із легким або помірним зниженням слуху.
+ Допомога з медіа
+ AirPods Pro можуть використовувати результати тесту слуху для налаштувань, які покращують чіткість музики, відео та дзвінків.
+ Налаштувати музику та відео
+ Налаштувати дзвінки
+ Віджет
+ Показати заряд телефону у віджеті
+ Відображати рівень заряду вашого телефону у віджеті разом із зарядом AirPods
+ Гучність Усвідомлення Розмови
+ Плитка Швидких Налаштувань
+ Відкрити діалог для керування
+ Якщо вимкнено, натискання на плитку швидких налаштувань перемикатиме між режимами. Якщо ввімкнено, вона покаже діалог для керування режимом шумоконтролю та усвідомленням розмови
+ Відʼєднати AirPods, коли ви їх не носите
+ Ви все ще зможете керувати ними через додаток — це просто відʼєднує аудіо.
+ Розширені Налаштування
+ Встановити Ключ Ідентифікації (IRK)
+ Вручну встановити значення IRK, що використовується для розпізнавання випадкових адрес BLE
+ Встановити Ключ Шифрування
+ Вручну встановити значення ENC_KEY, що використовується для розшифровки оголошень BLE
+ Використовувати альтернативні пакети відстеження голови
+ Ввімкніть це, якщо відстеження голови не працює у вас. Це надсилає різні дані до AirPods для запиту/зупинки даних відстеження голови.
+ Діяти як пристрій Apple
+ Увімкнює багатопристроєву з\'єднаність та функції доступності, такі як налаштування режиму проникності (підсилення, тон, зменшення навколишнього шуму, підсилення розмови та еквалайзер)
+ Може бути нестабільним!! Максимум два пристрої можуть бути підключені до ваших AirPods. Якщо ви використовуєте з пристроєм Apple, таким як iPad або Mac, то спочатку підключіть цей пристрій, а потім ваш Android.
+ Скинути Зміщення Хука
+ Це очистить поточне зміщення хука та потребуватиме повторного налаштування. Ви впевнені, що хочете продовжити?
+ Скинути
+ Зміщення хука було скинуто. Перенаправлення до налаштування...
+ Не вдалося скинути зміщення хука
+ IRK було успішно встановлено
+ Ключ шифрування було успішно встановлено
+ Шістнадцяткове Значення IRK
+ Шістнадцяткове Значення ENC_KEY
+ Введіть 16-байтовий IRK як шістнадцятковий рядок (32 символи):
+ Введіть 16-байтовий ENC_KEY як шістнадцятковий рядок (32 символи):
+ Має бути точно 32 шістнадцяткових символи
+ Помилка перетворення шістнадцяткового числа:
+ Знайдено зміщення, будь ласка, перезапустіть Bluetooth
+ Цифровий Асистент
+ Увімкнено
+ Дистанційне Управління Камерою
+ Управління Камерою
+ Зробіть фото, почніть або зупиніть запис та інше, натиснувши один раз або утримавши ніжку. Коли використовуєте AirPods для керування камерою, якщо ви оберете одне натискання, жести керування медіа будуть недоступні, а якщо утримання, режими прослуховування та жести Цифрового Асистента будуть недоступні.
+ Встановіть власну програму для виявлення камери
+ Встановити власний ID програми камери
+ Введіть ID програми камери:
+ Власний ID програми камери
+ Власний ID програми камери встановлено успішно
+ Слухач камери
+ Служба слухача LibrePods для виявлення, коли камера активна, щоб активувати керування камерою на AirPods.
+ Ліцензії Відкритого Коду
+ Оновити Тест Слуху
+ Оновити Результат Тесту Слуху
+ Менеджер АТТ відсутній, спробуйте перепідключитися.
+ Для використання додатку потрібні наступні дозволи. Будь ласка, надайте їх, щоб продовжити.
+ Похитайте головою або кивніть!
+ Потрібен Root-доступ
+ Цей додаток потребує root-доступу, щоб підключитися до бібліотеки Bluetooth
+ Root-доступ було відмовлено. Будь ласка, надайте root-дозволи.
+ Кроки Усунення Несправностей
+ Будь ласка, введіть значення втрат у дБНС
+ Про додаток
+ Назва Моделі
+ Номер Моделі
+ Серійний Номер
+ Версія
+ Здоров\'я Слуху
+ Захист Слуху
+ Використання На Робочому Місці
+ Захист EN 352
+ Захист EN 352 обмежує максимальний рівень медіа до 82 дБА та відповідає застосовним стандартам EN 352 для особистого захисту слуху.
+ Навколишній Шум
+ Перепідключитися до останнього підключеного пристрою
+ Відʼєднатися
+ Підтримати мене
+ Ніколи не показувати знову
+ Нещодавно я втратив свій лівий AirPod. Якщо LibrePods виявилися корисними для вас, розгляньте можливість підтримати мене на GitHub Sponsors, щоб я міг купити заміну та продовжити роботу над цим проектом — навіть невелика допомога має велике значення. Дякую за вашу підтримку!
+ Підтримати LibrePods
+ Вимикає керування шумом
+ Пропускає зовнішні звуки
+ Динамічно налаштовує зовнішній шум
+ Блокує зовнішні звуки
+
diff --git a/android/app/src/main/res/values-vi/strings.xml b/android/app/src/main/res/values-vi/strings.xml
new file mode 100644
index 000000000..044df73f8
--- /dev/null
+++ b/android/app/src/main/res/values-vi/strings.xml
@@ -0,0 +1,217 @@
+
+ LibrePods
+ Sử dụng AirPods của bạn mà không cần hệ sinh thái của Apple.
+ Xem trạng thái pin AirPods trên màn hình chính!
+ Trợ năng
+ Âm lượng âm báo
+ Điều chỉnh âm lượng của hiệu ứng âm thanh do AirPods phát ra.
+ Âm thanh
+ Âm thanh thích ứng
+ Tùy chỉnh âm thanh thích ứng
+ Âm thanh thích ứng tự động phản ứng với môi trường xung quanh và chặn hoặc cho phép tiếng ồn bên ngoài. Bạn có thể tùy chỉnh Âm thanh thích ứng để cho phép nhiều hoặc ít tiếng ồn hơn.
+ Tai nghe
+ Hộp sạc
+ Kiểm tra
+ Tên
+ Chế độ nghe
+ Tắt
+ Xuyên âm
+ Thích ứng
+ Chống ồn chủ động
+ Nhấn và giữ AirPods
+ Nhấn và giữ thân tai nghe để chuyển giữa các chế độ nghe đã chọn.
+ Cử chỉ đầu
+ Trái
+ Phải
+ Phát hiện giọng nói
+ Tự động bật chế độ xuyên âm khi bạn bắt đầu nói chuyện với người khác.
+ Âm lượng cá nhân hóa
+ Điều chỉnh âm lượng Media phù hợp với môi trường xung quanh.
+ Chống ồn với một bên tai nghe
+ Cho phép AirPods bật chế độ chống ồn ngay cả khi chỉ sử dụng một bên tai nghe.
+ Điều khiển âm lượng
+ Điều chỉnh âm lượng bằng cách vuốt lên hoặc xuống trên cảm biến nằm ở thân tai nghe.
+ AirPods chưa được kết nối
+ Vui lòng kết nối đến AirPods của bạn để truy cập cài đặt.
+ Quay lại
+ Tùy chỉnh
+ Âm lượng tương đối
+ Giảm xuống phần trăm của âm lượng hiện tại thay vì âm lượng tối đa.
+ Tạm dừng nhạc
+ Khi bạn nói, nhạc sẽ bị tạm dừng.
+ EXAMPLE
+ Thêm widget
+ Điều khiển chế độ chống ồn trực tiếp từ màn hình chính.
+ Đã kết nối
+ Đã kết nối với Linux
+ Đã kết nối
+ Đã chuyển sang Linux
+ Đã chuyển sang %1$s
+ Kết nối lại từ thông báo
+ Theo dõi chuyển động đầu
+ Gật đầu để trả lời cuộc gọi, và lắc đầu để từ chối.
+ Chung
+ Hành động ô cài đặt nhanh
+ Hiển thị hộp thoại kiểm soát tiếng ồn khi chạm.
+ Chuyển đổi qua các chế độ khi chạm.
+ Tùy chọn nhà phát triển
+ Mở cài đặt AirPods
+ Quản lý tính năng và tùy chọn AirPods
+ Tự động phát hiện đeo tai nghe
+ Tự động phát
+ Tự động tạm dừng
+ Khắc phục sự cố
+ Thu thập nhật ký để chẩn đoán sự cố kết nối AirPods
+ Thu thập nhật ký
+ Nhật ký đã lưu
+ Không tìm thấy nhật ký đã lưu
+ Tùy chọn tự động kết nối
+ Kết nối với AirPods khi trạng thái là:
+ Đã ngắt kết nối
+ AirPods không kết nối với thiết bị nào
+ Rảnh tay
+ AirPods đã kết nối tới thiết bị nhưng không phát Media hoặc đang gọi
+ Đang phát Media
+ AirPods đang phát Media
+ Đang gọi
+ AirPods được dùng với cuộc gọi
+ Kết nối với AirPods khi điện thoại:
+ Nhận cuộc gọi
+ Điện thoại bắt đầu đổ chuông
+ Bắt đầu phát Media
+ Điện thoại bắt đầu phát Media
+ Hoàn tác
+ Bạn có thể tùy chỉnh chế độ xuyên âm cho AirPods để giúp bạn nghe những gì xung quanh.
+ Giảm âm thanh lớn có thể chủ động giảm tiếp xúc với tiếng ồn môi trường lớn khi ở chế độ xuyên âm và Thích ứng. Giảm âm thanh lớn không hoạt động ở chế độ Tắt.
+ Giảm âm thanh lớn
+ Điều khiển cuộc gọi
+ Tự động kết nối với thiết bị này
+ Khi bật, AirPods sẽ cố gắng tự động kết nối với thiết bị này. Nếu không, chúng sẽ chỉ tự động kết nối khi đã kết nối lần cuối.
+ Tạm dừng Media khi ngủ
+ Chế độ nghe Tắt
+ Khi bật, các chế độ nghe của AirPods sẽ bao gồm tùy chọn Tắt. Mức âm thanh lớn không được giảm khi chế độ nghe được đặt thành Tắt.
+ Micro
+ Chế độ micro
+ Tự động
+ Micro luôn ở bên phải
+ Micro luôn ở bên trái
+ Trả lời cuộc gọi
+ Bật/tắt tiếng
+ Kết thúc cuộc gọi
+ Nhấn một lần
+ Nhấn hai lần
+ Trợ thính
+ Điều chỉnh
+ Vuốt để điều khiển âm thanh xung quanh
+ Khi ở chế độ xuyên âm và không phát Media, vuốt lên và xuống trên điều khiển cảm ứng của AirPods để tăng hoặc giảm độ âm thanh xung quanh.
+ Chế độ Xuyên âm
+ Tùy chỉnh chế độ xuyên âm
+ Tốc độ nhấn
+ Điều chỉnh tốc độ cần thiết để nhấn hai hoặc ba lần trên AirPods.
+ Thời gian nhấn và giữ
+ Để điều chỉnh thời gian cần thiết, nhấn và giữ trên AirPods.
+ Tốc độ vuốt âm lượng
+ Để tránh điều chỉnh âm lượng ngoài ý muốn, hãy chọn thời gian chờ giữa các lần vuốt.
+ Bộ chỉnh âm
+ Áp dụng EQ cho
+ Điện thoại
+ Media
+ Dải %d
+ Mặc định
+ Chậm hơn
+ Chậm nhất
+ Lâu hơn
+ Lâu nhất
+ Tối hơn
+ Sáng hơn
+ Ít hơn
+ Nhiều hơn
+ Khuếch đại
+ Cân bằng
+ Âm sắc
+ Giảm tiếng ồn xung quanh
+ Tăng cường hội thoại
+ Chế độ Tăng cường hội thoại giúp AirPods tập trung vào người đang nói trước mặt bạn, giúp dễ nghe hơn trong cuộc trò chuyện trực tiếp.
+ AirPods có thể sử dụng kết quả của bài kiểm tra thính lực để thực hiện điều chỉnh cải thiện độ rõ của giọng nói và âm thanh xung quanh.\n\nTrợ thính chỉ dành cho người bị giảm thính lực nhẹ đến trung bình.
+ Hỗ trợ Media
+ AirPods có thể sử dụng kết quả của bài kiểm tra thính lực để thực hiện điều chỉnh cải thiện độ rõ của âm nhạc, video và cuộc gọi.
+ Điều chỉnh Media
+ Điều chỉnh cuộc gọi
+ Widget
+ Hiển thị pin điện thoại trong widget
+ Hiển thị pin điện thoại trong widget cùng với pin AirPods
+ Âm lượng nhận biết hội thoại
+ Ô cài đặt nhanh
+ Mở hộp thoại để điều khiển
+ Nếu tắt, nhấp vào QS sẽ chuyển đổi qua các chế độ. Nếu bật, nó sẽ hiển thị hộp thoại để điều khiển chế độ chống ồn và nhận biết hội thoại
+ Ngắt kết nối AirPods khi không đeo
+ Bạn vẫn có thể điều khiển chúng bằng ứng dụng - điều này chỉ ngắt kết nối âm thanh.
+ Tùy chọn nâng cao
+ Đặt khóa phân giải danh tính (IRK)
+ Đặt thủ công giá trị IRK được sử dụng để phân giải địa chỉ ngẫu nhiên BLE
+ Đặt khóa mã hóa
+ Đặt thủ công giá trị ENC_KEY được sử dụng để giải mã quảng cáo BLE
+ Sử dụng gói theo dõi đầu thay thế
+ Bật tính năng này nếu theo dõi chuyển động đầu không hoạt động. Điều này gửi dữ liệu khác đến AirPods để yêu cầu/dừng dữ liệu theo dõi chuyển động đầu.
+ Hoạt động như thiết bị Apple
+ Bật kết nối đa thiết bị và các tính năng Trợ năng như tùy chỉnh chế độ xuyên âm (khuếch đại, âm sắc, giảm tiếng ồn môi trường, tăng cường hội thoại và EQ)
+ Có thể không ổn định!! Tối đa hai thiết bị có thể kết nối với AirPods của bạn. Nếu bạn đang sử dụng với thiết bị Apple như iPad hoặc Mac, vui lòng kết nối thiết bị đó trước rồi mới đến Android.
+ Đặt lại độ lệch hook
+ Thao tác này sẽ xóa độ lệch hook hiện tại và yêu cầu bạn thực hiện lại quy trình thiết lập. Bạn có chắc chắn muốn tiếp tục?
+ Đặt lại
+ Đã đặt lại độ lệch hook. Đang chuyển hướng đến thiết lập...
+ Không thể đặt lại độ lệch hook
+ Đã đặt IRK thành công
+ Đã đặt khóa mã hóa thành công
+ Giá trị Hex IRK
+ Giá trị Hex ENC_KEY
+ Nhập IRK 16 byte dưới dạng chuỗi hex (32 ký tự):
+ Nhập ENC_KEY 16 byte dưới dạng chuỗi hex (32 ký tự):
+ Phải chính xác 32 ký tự hex
+ Lỗi chuyển đổi hex:
+ Đã tìm thấy độ lệch, vui lòng khởi động lại tiến trình Bluetooth
+ Trợ lý kỹ thuật số
+ Bật
+ Điều khiển máy ảnh từ xa
+ Điều khiển máy ảnh
+ Chụp ảnh, bắt đầu hoặc dừng quay video và nhiều hơn nữa bằng cách Nhấn một lần hoặc Nhấn và giữ. Khi sử dụng AirPods cho các hành động máy ảnh, nếu bạn chọn Nhấn một lần, cử chỉ điều khiển Media sẽ không khả dụng và nếu bạn chọn Nhấn và giữ, các cử chỉ chế độ nghe và Trợ lý kỹ thuật số sẽ không khả dụng.
+ Đặt gói ứng dụng tùy chỉnh để phát hiện máy ảnh
+ Đặt ID ứng dụng máy ảnh tùy chỉnh
+ Nhập ID ứng dụng của ứng dụng máy ảnh:
+ ID ứng dụng máy ảnh tùy chỉnh
+ Đã đặt ID ứng dụng máy ảnh tùy chỉnh thành công
+ Trình lắng nghe máy ảnh
+ Dịch vụ lắng nghe để LibrePods phát hiện khi máy ảnh đang hoạt động để kích hoạt điều khiển máy ảnh trên AirPods.
+ Giấy phép mã nguồn mở
+ Cập nhật bài kiểm tra thính lực
+ Cập nhật kết quả kiểm tra thính lực
+ Trình quản lý ATT là null, thử kết nối lại.
+ Các quyền sau là cần thiết để sử dụng ứng dụng. Vui lòng cấp chúng để tiếp tục.
+ Lắc đầu hoặc gật đầu!
+ Yêu cầu quyền truy cập root
+ Ứng dụng này cần quyền truy cập root để hook vào thư viện Bluetooth
+ Quyền truy cập root đã bị từ chối. Vui lòng cấp quyền root.
+ Các bước khắc phục sự cố
+ Vui lòng nhập giá trị mất thính lực tính bằng dbHL
+ Giới thiệu
+ Tên sản phẩm
+ Số kiểu
+ Số sê-ri
+ Phiên bản
+ Sức khỏe thính giác
+ Bảo vệ thính giác
+ Sử dụng nơi làm việc
+ Bảo vệ EN 352
+ Bảo vệ EN 352 giới hạn mức tối đa của Media ở 82 dBA và đáp ứng các yêu cầu Tiêu chuẩn EN 352 hiện hành về bảo vệ thính giác cá nhân.
+ Tiếng ồn môi trường
+ Kết nối lại với thiết bị được kết nối lần cuối
+ Ngắt kết nối
+ Hỗ trợ tôi
+ Không hiển thị lại
+ Gần đây tôi bị mất tai bên trái của AirPod. Nếu bạn thấy LibrePods hữu ích, hãy cân nhắc hỗ trợ tôi trên GitHub Sponsors để tôi có thể mua cái thay thế và tiếp tục làm việc trên dự án này - ngay cả một khoản nhỏ cũng rất có ý nghĩa. Cảm ơn sự hỗ trợ của bạn!
+ Hỗ trợ LibrePods
+ Tắt quản lý tiếng ồn
+ Cho phép âm thanh bên ngoài
+ Điều chỉnh động tiếng ồn bên ngoài
+ Chặn âm thanh bên ngoài
+
diff --git a/android/app/src/main/res/values-zh-rCN/strings.xml b/android/app/src/main/res/values-zh-rCN/strings.xml
index d727f899f..3178aba70 100644
--- a/android/app/src/main/res/values-zh-rCN/strings.xml
+++ b/android/app/src/main/res/values-zh-rCN/strings.xml
@@ -194,6 +194,11 @@
Root 权限被拒绝。请授予 Root 权限。故障排除步骤请输入 dbHL 中的损失值
+ 关于
+ 型号名称
+ 型号编号
+ 序列号
+ 版本听力健康听力保护工作区使用
@@ -202,6 +207,12 @@
环境噪音重新连接到上次连接的设备断开连接
+ 支持我
+ 不再显示我最近丢了我的左耳 AirPod。如果你觉得 LibrePods 有用,请考虑在 GitHub Sponsors 上支持我,这样我就可以购买一个替换品并继续从事这个项目——即使是少量捐助也能发挥很大作用。感谢你的支持!支持 LibrePods
+ 关闭噪音管理
+ 允许外部声音进入
+ 动态调整外部噪音
+ 阻隔外部声音
\ No newline at end of file
diff --git a/android/app/src/main/res/values-zh-rTW/strings.xml b/android/app/src/main/res/values-zh-rTW/strings.xml
new file mode 100644
index 000000000..dc45f8d6f
--- /dev/null
+++ b/android/app/src/main/res/values-zh-rTW/strings.xml
@@ -0,0 +1,219 @@
+
+ LibrePods
+ 讓你的 AirPods 擺脫 Apple 生態系統的束縛。
+ 直接從主畫面查看 AirPods 電池狀態!
+ 輔助使用
+ 提示音音量
+ 調整 AirPods 播放音效的提示音音量。
+ 音訊
+ 自適應音訊
+ 自訂自適應音訊
+ 自適應音訊會動態回應你的環境,並消除或允許外部噪音。你可以自訂自適應音訊以允許更多或更少的噪音。
+ 耳機
+ 充電盒
+ 測試
+ 名稱
+ 聽覺模式
+ 關閉
+ 通透模式
+ 自適應
+ 降噪
+ 按住 AirPods
+ 按住耳機柄即可在選定的聽覺模式之間循環切換。
+ 頭部手勢
+ 左耳
+ 右耳
+ 對話感知
+ 當你開始與他人交談時,降低媒體音量並減少背景噪音。
+ 個人化音量
+ 根據你的環境調整媒體音量。
+ 使用一只 AirPod 進行降噪
+ 允許在僅配戴一只 AirPod 時進入降噪模式。
+ 音量控制
+ 透過在 AirPods Pro 耳機柄上的感測器向上或向下滑動來調整音量。
+ 未連接 AirPods
+ 請連接你的 AirPods 以存取設定。
+ 返回
+ 自訂
+ 相對音量
+ 降低至當前音量的百分比,而不是最大音量。
+ 暫停音樂
+ 當你開始說話時,音樂將會暫停。
+ 範例
+ 新增小工具
+ 直接從主畫面控制聽覺模式。
+ 已連線
+ 已連線至 Linux
+ 已連線
+ 已移至 Linux
+ 已移至 %1$s
+ 從通知重新連線
+ 頭部追蹤
+ 點頭接聽來電,搖頭拒接。
+ 一般
+ 快速設定方塊動作
+ 輕觸時顯示聽覺模式對話方塊。
+ 輕觸時循環切換模式。
+ 開發人員
+ 開啟 AirPods 設定
+ 管理 AirPods 功能與偏好設定
+ 自動耳朵偵測
+ 自動播放
+ 自動暫停
+ 疑難排解
+ 收集記錄以診斷 AirPods 連線問題
+ 收集記錄
+ 已儲存的記錄
+ 找不到已儲存的記錄
+ 自動連線偏好設定
+ 當 AirPods 處於以下狀態時連線:
+ 已中斷連線
+ AirPods 未連接至任何裝置
+ 閒置
+ 裝置已連接至你的 AirPods,但未播放媒體或通話中
+ 正在播放媒體
+ 裝置正在你的 AirPods 上播放媒體
+ 通話中
+ 裝置正在使用你的 AirPods 進行通話
+ 當你的手機處於以下狀態時連接至 AirPods:
+ 接到來電
+ 你的手機開始響鈴
+ 開始播放媒體
+ 你的手機開始播放媒體
+ 復原
+ 你可以自訂 AirPods Pro 的通透模式,以協助你聽見周圍的聲音。
+ 「降低高音量」可在通透模式和自適應模式下,主動減少你接觸到的環境高噪音。在「關閉」模式下,「降低高音量」不會作用。
+ 降低高音量
+ 通話控制
+ 自動連接此裝置
+ 啟用後,AirPods 將嘗試自動連接至此裝置。否則,它們僅會在上次連接過此裝置時嘗試自動連接。
+ 入睡時暫停媒體
+ 「關閉」聽覺模式
+ 開啟此選項後,AirPods 聽覺模式將包含「關閉」選項。當聽覺模式設為「關閉」時,不會降低高音量。
+ 麥克風
+ 麥克風模式
+ 自動
+ 總是右耳
+ 總是左耳
+ 接聽來電
+ 靜音/取消靜音
+ 掛斷
+ 按一下
+ 按兩下
+ 助聽器
+ 調整
+ 滑動以控制增強
+ 在通透模式且未播放媒體時,在 AirPods Pro 的觸控控制上向上或向下滑動,可增加或減少環境聲音的增強效果。
+ 通透模式
+ 自訂通透模式
+ 按壓速度
+ 調整在 AirPods 上按兩下或三下所需的速度。
+ 按住持續時間
+ 調整在 AirPods 上按住所須的時間。
+ 音量滑動速度
+ 為防止意外調整音量,請選擇滑動之間的偏好等待時間。
+ 等化器
+ 套用 EQ 至
+ 電話
+ 媒體
+ 頻段 %d
+ 預設
+ 較慢
+ 最慢
+ 較長
+ 最長
+ 較低沉
+ 較清亮
+ 較少
+ 較多
+ 增強
+ 平衡
+ 音色
+ 環境噪音抑制
+ 對話增強
+ 「對話增強」會將你的 AirPods Pro 聚焦於你面前說話的人,讓你在面對面交談時更容易聽清楚。
+ AirPods 可以使用聽力測試的結果進行調整,以改善你周圍的語音和聲音清晰度。
+
+助聽器功能僅適用於有輕度至中度聽力受損的人士。
+ 媒體輔助
+ AirPods Pro 可以使用聽力測試的結果進行調整,以改善音樂、影片和通話的清晰度。
+ 調整音樂與影片
+ 調整通話
+ 小工具
+ 在小工具中顯示手機電量
+ 在小工具中同時顯示手機電量與 AirPods 電量
+ 對話感知音量
+ 快速設定方塊
+ 開啟控制對話方塊
+ 若停用,點擊快速設定方塊將循環切換模式。若啟用,則會顯示用於控制聽覺模式和對話感知的對話方塊。
+ 未配戴時中斷 AirPods 連線
+ 你仍可使用應用程式控制它們,此選項僅會中斷音訊連線。
+ 進階選項
+ 設定身分解析金鑰 (IRK)
+ 手動設定用於解析 BLE 隨機位址的 IRK 值
+ 設定加密金鑰
+ 手動設定用於解密 BLE 廣播的 ENC_KEY值
+ 使用替代頭部追蹤封包
+ 如果頭部追蹤對你無效,請啟用此選項。這會傳送不同的資料給 AirPods 以請求/停止頭部追蹤資料。
+ 作為 Apple 裝置
+ 啟用多裝置連線及輔助使用功能,例如自訂通透模式(增強、音色、環境噪音抑制、對話增強及 EQ)。
+ 可能不穩定!!你的 AirPods 最多只能同時連接兩個裝置。如果你正與 iPad 或 Mac 等 Apple 裝置搭配使用,請先連接該裝置,然後再連接你的 Android。
+ 重設 Hook 偏移量
+ 這將清除目前的 Hook 偏移量,並需要你再次進行設定程序。確定要繼續嗎?
+ 重設
+ Hook 偏移量已重設。正在重新導向至設定...
+ 重設 Hook 偏移量失敗
+ IRK 已設定成功
+ 加密金鑰已設定成功
+ IRK 十六進位值
+ ENC_KEY 十六進位值
+ 輸入 16 位元組 IRK 為十六進位字串(32 個字元):
+ 輸入 16 位元組 ENC_KEY 為十六進位字串(32 個字元):
+ 必須剛好是 32 個十六進位字元
+ 轉換十六進位時發生錯誤:
+ 找到偏移量,請重新啟動藍牙程序
+ 語音助理
+ 開啟
+ 相機遙控
+ 相機控制
+ 使用「按一下」或「按住」來拍攝相片、開始或停止錄影等。當使用 AirPods 進行相機動作時,若選擇「按一下」,媒體控制手勢將無法使用;若選擇「按住」,聽覺模式和語音助理手勢將無法使用。
+ 設定用於相機偵測的自訂應用程式套件
+ 設定自訂相機應用程式 ID
+ 輸入相機應用程式的應用程式 ID:
+ 自訂相機應用程式 ID
+ 自訂相機應用程式 ID 設定成功
+ 相機監聽器
+ LibrePods 的監聽器服務,用於偵測相機何時啟用,以啟動 AirPods 上的相機控制。
+ 開放原始碼授權
+ 更新聽力測試
+ 更新聽力測試結果
+ ATT Manager 為空值,請嘗試重新連線。
+ 需要以下權限才能使用此應用程式。請授權以繼續。
+ 搖頭或點頭!
+ 需要 Root 權限
+ 此應用程式需要 Root 權限才能 Hook 藍牙程式庫
+ Root 權限被拒絕。請授權 Root 權限。
+ 疑難排解步驟
+ 請輸入 dbHL 中的損失值
+ 關於
+ 型號名稱
+ 型號號碼
+ 序號
+ 版本
+ 聽力健康
+ 聽力保護
+ 工作場所使用
+ EN 352 防護
+ EN 352 防護將媒體的最大音量限制為 82 dBA,並符合個人聽力保護的適用 EN 352 標準要求。
+ 環境噪音
+ 重新連接至上次連接的裝置
+ 中斷連線
+ 贊助我
+ 不再顯示
+ 我最近弄丟了左耳的 AirPod。如果你覺得 LibrePods 很好用,請考慮在 GitHub Sponsors 上贊助我,讓我能買個替換品並繼續開發這個專案,一點點金額也能帶來很大的幫助。感謝你的支持!
+ 贊助 LibrePods
+ 關閉噪音管理
+ 允許外部聲音
+ 動態調整外部噪音
+ 阻隔外部聲音
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 4f6b82b44..74ae083ac 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -210,4 +210,8 @@
Never show againI recently lost my left AirPod. If you\'ve found LibrePods useful, consider supporting me on GitHub Sponsors so I can buy a replacement and continue working on this project- even a little amount goes a long way. Thank you for your support!Support LibrePods
+ Turns off noise management
+ Lets in external sounds
+ Dynamically adjust external noise
+ Blocks out external sounds
diff --git a/build-magisk-module.sh b/build-magisk-module.sh
index 7f8c1950f..44543f7af 100755
--- a/build-magisk-module.sh
+++ b/build-magisk-module.sh
@@ -7,5 +7,5 @@ rm -f ../btl2capfix.zip
# COPYFILE_DISABLE env is a macOS fix to avoid parasitic files in ZIPs: https://superuser.com/a/260264
export COPYFILE_DISABLE=1
-curl -L -o ./radare2-5.9.9-android-aarch64.tar.gz "https://hc-cdn.hel1.your-objectstorage.com/s/v3/25e8dbfe13892b4c26f3e01bfa45197f170bb0e7_radare2-5.9.9-android-aarch64.tar.gz"
+curl -L -o ./radare2-5.9.9-android-aarch64.tar.gz "https://github.com/devnoname120/radare2/releases/download/5.9.8-android-aln/radare2-5.9.9-android-aarch64-aln.tar.gz"
zip -r ../btl2capfix.zip . -x \*.DS_Store \*__MACOSX \*DEBIAN ._\* .gitignore
diff --git a/head-tracking/colors.py b/head-tracking/colors.py
new file mode 100644
index 000000000..cc1ba2108
--- /dev/null
+++ b/head-tracking/colors.py
@@ -0,0 +1,29 @@
+import logging
+from logging import Formatter, LogRecord
+from typing import Dict
+
+class Colors:
+ RESET: str = "\033[0m"
+ BOLD: str = "\033[1m"
+ RED: str = "\033[91m"
+ GREEN: str = "\033[92m"
+ YELLOW: str = "\033[93m"
+ BLUE: str = "\033[94m"
+ MAGENTA: str = "\033[95m"
+ CYAN: str = "\033[96m"
+ WHITE: str = "\033[97m"
+ BG_BLACK: str = "\033[40m"
+
+class ColorFormatter(Formatter):
+ FORMATS: Dict[int, str] = {
+ logging.DEBUG: f"{Colors.BLUE}[%(levelname)s] %(message)s{Colors.RESET}",
+ logging.INFO: f"{Colors.GREEN}%(message)s{Colors.RESET}",
+ logging.WARNING: f"{Colors.YELLOW}%(message)s{Colors.RESET}",
+ logging.ERROR: f"{Colors.RED}[%(levelname)s] %(message)s{Colors.RESET}",
+ logging.CRITICAL: f"{Colors.RED}{Colors.BOLD}[%(levelname)s] %(message)s{Colors.RESET}"
+ }
+
+ def format(self, record: LogRecord) -> str:
+ log_fmt: str = self.FORMATS.get(record.levelno)
+ formatter: Formatter = Formatter(log_fmt, datefmt="%H:%M:%S")
+ return formatter.format(record)
diff --git a/head-tracking/connection_manager.py b/head-tracking/connection_manager.py
index 1e18b047d..ae92dc331 100644
--- a/head-tracking/connection_manager.py
+++ b/head-tracking/connection_manager.py
@@ -1,23 +1,25 @@
import bluetooth
import logging
+from bluetooth import BluetoothSocket
+from logging import Logger
class ConnectionManager:
- INIT_CMD = "00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00"
- START_CMD = "04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00"
- STOP_CMD = "04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00"
+ INIT_CMD: str = "00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00"
+ START_CMD: str = "04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00"
+ STOP_CMD: str = "04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00"
- def __init__(self, bt_addr="28:2D:7F:C2:05:5B", psm=0x1001, logger=None):
- self.bt_addr = bt_addr
- self.psm = psm
- self.logger = logger if logger else logging.getLogger(__name__)
- self.sock = None
- self.connected = False
- self.started = False
+ def __init__(self, bt_addr: str = "28:2D:7F:C2:05:5B", psm: int = 0x1001, logger: Logger = None) -> None:
+ self.bt_addr: str = bt_addr
+ self.psm: int = psm
+ self.logger: Logger = logger if logger else logging.getLogger(__name__)
+ self.sock: BluetoothSocket = None
+ self.connected: bool = False
+ self.started: bool = False
- def connect(self):
+ def connect(self) -> bool:
self.logger.info(f"Connecting to {self.bt_addr} on PSM {self.psm:#04x}...")
try:
- self.sock = bluetooth.BluetoothSocket(bluetooth.L2CAP)
+ self.sock = BluetoothSocket(bluetooth.L2CAP)
self.sock.connect((self.bt_addr, self.psm))
self.connected = True
self.logger.info("Connected to AirPods.")
@@ -28,7 +30,7 @@ def connect(self):
self.connected = False
return self.connected
- def send_start(self):
+ def send_start(self) -> bool:
if not self.connected:
self.logger.error("Not connected. Cannot send START command.")
return False
@@ -40,7 +42,7 @@ def send_start(self):
self.logger.info("START command has already been sent.")
return True
- def send_stop(self):
+ def send_stop(self) -> None:
if self.connected and self.started:
try:
self.sock.send(bytes.fromhex(self.STOP_CMD))
@@ -51,7 +53,7 @@ def send_stop(self):
else:
self.logger.info("Cannot send STOP; not started or not connected.")
- def disconnect(self):
+ def disconnect(self) -> None:
if self.sock:
try:
self.sock.close()
@@ -59,4 +61,4 @@ def disconnect(self):
except Exception as e:
self.logger.error(f"Error during disconnect: {e}")
self.connected = False
- self.started = False
\ No newline at end of file
+ self.started = False
diff --git a/head-tracking/gestures.py b/head-tracking/gestures.py
index 394b72a89..a598409de 100644
--- a/head-tracking/gestures.py
+++ b/head-tracking/gestures.py
@@ -1,88 +1,65 @@
-import bluetooth
-import threading
-import time
import logging
import statistics
+import time
+from bluetooth import BluetoothSocket
from collections import deque
+from colors import *
+from connection_manager import ConnectionManager
+from logging import Logger, StreamHandler
+from threading import Lock, Thread
+from typing import Any, Deque, List, Optional, Tuple
-class Colors:
- RESET = "\033[0m"
- BOLD = "\033[1m"
- RED = "\033[91m"
- GREEN = "\033[92m"
- YELLOW = "\033[93m"
- BLUE = "\033[94m"
- MAGENTA = "\033[95m"
- CYAN = "\033[96m"
- WHITE = "\033[97m"
- BG_BLACK = "\033[40m"
-
-class ColorFormatter(logging.Formatter):
- FORMATS = {
- logging.DEBUG: Colors.BLUE + "[%(levelname)s] %(message)s" + Colors.RESET,
- logging.INFO: Colors.GREEN + "%(message)s" + Colors.RESET,
- logging.WARNING: Colors.YELLOW + "%(message)s" + Colors.RESET,
- logging.ERROR: Colors.RED + "[%(levelname)s] %(message)s" + Colors.RESET,
- logging.CRITICAL: Colors.RED + Colors.BOLD + "[%(levelname)s] %(message)s" + Colors.RESET
- }
-
- def format(self, record):
- log_fmt = self.FORMATS.get(record.levelno)
- formatter = logging.Formatter(log_fmt, datefmt="%H:%M:%S")
- return formatter.format(record)
-
-handler = logging.StreamHandler()
+handler: StreamHandler = StreamHandler()
handler.setFormatter(ColorFormatter())
-log = logging.getLogger(__name__)
+log: Logger = logging.getLogger(__name__)
log.setLevel(logging.INFO)
log.addHandler(handler)
log.propagate = False
class GestureDetector:
- INIT_CMD = "00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00"
- START_CMD = "04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00"
- STOP_CMD = "04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00"
+ INIT_CMD: str = "00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00"
+ START_CMD: str = "04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00"
+ STOP_CMD: str = "04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00"
- def __init__(self, conn=None):
- self.sock = None
- self.bt_addr = "28:2D:7F:C2:05:5B"
- self.psm = 0x1001
- self.running = False
- self.data_lock = threading.Lock()
+ def __init__(self, conn: ConnectionManager = None) -> None:
+ self.sock: BluetoothSocket = None
+ self.bt_addr: str = "28:2D:7F:C2:05:5B"
+ self.psm: int = 0x1001
+ self.running: bool = False
+ self.data_lock: Lock = Lock()
- self.horiz_buffer = deque(maxlen=100)
- self.vert_buffer = deque(maxlen=100)
+ self.horiz_buffer: Deque[int] = deque(maxlen=100)
+ self.vert_buffer: Deque[int] = deque(maxlen=100)
- self.horiz_avg_buffer = deque(maxlen=5)
- self.vert_avg_buffer = deque(maxlen=5)
+ self.horiz_avg_buffer: Deque[float] = deque(maxlen=5)
+ self.vert_avg_buffer: Deque[float] = deque(maxlen=5)
- self.horiz_peaks = []
- self.horiz_troughs = []
- self.vert_peaks = []
- self.vert_troughs = []
+ self.horiz_peaks: List[int] = []
+ self.horiz_troughs: List[int] = []
+ self.vert_peaks: List[int] = []
+ self.vert_troughs: List[int] = []
- self.last_peak_time = 0
- self.peak_intervals = deque(maxlen=5)
+ self.last_peak_time: float = 0
+ self.peak_intervals: Deque[float] = deque(maxlen=5)
- self.peak_threshold = 400
- self.direction_change_threshold = 175
- self.rhythm_consistency_threshold = 0.5
+ self.peak_threshold: int = 400
+ self.direction_change_threshold: int = 175
+ self.rhythm_consistency_threshold: float = 0.5
- self.horiz_increasing = None
- self.vert_increasing = None
+ self.horiz_increasing: Optional[bool] = None
+ self.vert_increasing: Optional[bool] = None
self.required_extremes = 3
- self.detection_timeout = 15
+ self.detection_timeout: int = 15
- self.min_confidence_threshold = 0.7
+ self.min_confidence_threshold: float = 0.7
- self.conn = conn
+ self.conn: ConnectionManager = conn
- def connect(self):
+ def connect(self) -> bool:
try:
log.info(f"Connecting to AirPods at {self.bt_addr}...")
if self.conn is None:
- from connection_manager import ConnectionManager
self.conn = ConnectionManager(self.bt_addr, self.psm, logger=log)
if not self.conn.connect():
return False
@@ -97,13 +74,13 @@ def connect(self):
log.error(f"{Colors.RED}Connection failed: {e}{Colors.RESET}")
return False
- def process_data(self):
+ def process_data(self) -> None:
"""Process incoming head tracking data."""
self.conn.send_start()
log.info(f"{Colors.GREEN}✓ Head tracking activated{Colors.RESET}")
self.running = True
- start_time = time.time()
+ start_time: float = time.time()
log.info(f"{Colors.GREEN}Ready! Make a YES or NO gesture{Colors.RESET}")
log.info(f"{Colors.YELLOW}Tip: Use natural, moderate speed head movements{Colors.RESET}")
@@ -118,10 +95,10 @@ def process_data(self):
if not self.sock:
log.error("Socket not available.")
break
- data = self.sock.recv(1024)
- formatted = self.format_hex(data)
+ data: bytes = self.sock.recv(1024)
+ formatted: str = self.format_hex(data)
if self.is_valid_tracking_packet(formatted):
- raw_bytes = bytes.fromhex(formatted.replace(" ", ""))
+ raw_bytes: bytes = bytes.fromhex(formatted.replace(" ", ""))
horizontal, vertical = self.extract_orientation_values(raw_bytes)
if horizontal is not None and vertical is not None:
@@ -132,7 +109,7 @@ def process_data(self):
self.vert_buffer.append(smooth_v)
self.detect_peaks_and_troughs()
- gesture = self.detect_gestures()
+ gesture: Optional[str] = self.detect_gestures()
if gesture:
self.running = False
@@ -143,19 +120,19 @@ def process_data(self):
log.error(f"Data processing error: {e}")
break
- def disconnect(self):
+ def disconnect(self) -> None:
"""Disconnect from socket."""
self.conn.disconnect()
- def format_hex(self, data):
+ def format_hex(self, data: bytes) -> str:
"""Format binary data to readable hex string."""
- hex_str = data.hex()
+ hex_str: str = data.hex()
return ' '.join(hex_str[i:i+2] for i in range(0, len(hex_str), 2))
- def is_valid_tracking_packet(self, hex_string):
+ def is_valid_tracking_packet(self, hex_string: str) -> bool:
"""Verify packet is a valid head tracking packet."""
- standard_header = "04 00 04 00 17 00 00 00 10 00 45 00"
- alternate_header = "04 00 04 00 17 00 00 00 10 00 44 00"
+ standard_header: str = "04 00 04 00 17 00 00 00 10 00 45 00"
+ alternate_header: str = "04 00 04 00 17 00 00 00 10 00 44 00"
if not hex_string.startswith(standard_header) and not hex_string.startswith(alternate_header):
return False
@@ -164,55 +141,55 @@ def is_valid_tracking_packet(self, hex_string):
return True
- def extract_orientation_values(self, raw_bytes):
+ def extract_orientation_values(self, raw_bytes: bytes) -> Tuple[Optional[int], Optional[int]]:
"""Extract head orientation data from packet."""
try:
- horizontal = int.from_bytes(raw_bytes[51:53], byteorder='little', signed=True)
- vertical = int.from_bytes(raw_bytes[53:55], byteorder='little', signed=True)
+ horizontal: int = int.from_bytes(raw_bytes[51:53], byteorder='little', signed=True)
+ vertical: int = int.from_bytes(raw_bytes[53:55], byteorder='little', signed=True)
return horizontal, vertical
except Exception as e:
log.debug(f"Failed to extract orientation: {e}")
return None, None
- def apply_smoothing(self, horizontal, vertical):
+ def apply_smoothing(self, horizontal: int, vertical: int) -> Tuple[float, float]:
"""Apply moving average smoothing (Apple-like filtering)."""
self.horiz_avg_buffer.append(horizontal)
self.vert_avg_buffer.append(vertical)
- smooth_horiz = sum(self.horiz_avg_buffer) / len(self.horiz_avg_buffer)
- smooth_vert = sum(self.vert_avg_buffer) / len(self.vert_avg_buffer)
+ smooth_horiz: float = sum(self.horiz_avg_buffer) / len(self.horiz_avg_buffer)
+ smooth_vert: float = sum(self.vert_avg_buffer) / len(self.vert_avg_buffer)
return smooth_horiz, smooth_vert
- def detect_peaks_and_troughs(self):
+ def detect_peaks_and_troughs(self) -> None:
"""Detect motion direction changes with Apple-like refinements."""
if len(self.horiz_buffer) < 4 or len(self.vert_buffer) < 4:
return
- h_values = list(self.horiz_buffer)[-4:]
- v_values = list(self.vert_buffer)[-4:]
+ h_values: List[int] = list(self.horiz_buffer)[-4:]
+ v_values: List[int] = list(self.vert_buffer)[-4:]
- h_variance = statistics.variance(h_values) if len(h_values) > 1 else 0
- v_variance = statistics.variance(v_values) if len(v_values) > 1 else 0
+ h_variance: float = statistics.variance(h_values) if len(h_values) > 1 else 0
+ v_variance: float = statistics.variance(v_values) if len(v_values) > 1 else 0
- current = self.horiz_buffer[-1]
- prev = self.horiz_buffer[-2]
+ current: int = self.horiz_buffer[-1]
+ prev: int = self.horiz_buffer[-2]
if self.horiz_increasing is None:
self.horiz_increasing = current > prev
- dynamic_h_threshold = max(100, min(self.direction_change_threshold, h_variance / 3))
+ dynamic_h_threshold: float = max(100, min(self.direction_change_threshold, h_variance / 3))
if self.horiz_increasing and current < prev - dynamic_h_threshold:
if abs(prev) > self.peak_threshold:
self.horiz_peaks.append((len(self.horiz_buffer)-1, prev, time.time()))
- direction = "➡️ " if prev > 0 else "⬅️ "
+ direction: str = "➡️ " if prev > 0 else "⬅️ "
log.info(f"{Colors.CYAN}{direction} Horizontal max: {prev} (threshold: {dynamic_h_threshold:.1f}){Colors.RESET}")
- now = time.time()
+ now: float = time.time()
if self.last_peak_time > 0:
- interval = now - self.last_peak_time
+ interval: float = now - self.last_peak_time
self.peak_intervals.append(interval)
self.last_peak_time = now
@@ -221,34 +198,34 @@ def detect_peaks_and_troughs(self):
elif not self.horiz_increasing and current > prev + dynamic_h_threshold:
if abs(prev) > self.peak_threshold:
self.horiz_troughs.append((len(self.horiz_buffer)-1, prev, time.time()))
- direction = "➡️ " if prev > 0 else "⬅️ "
+ direction: str = "➡️ " if prev > 0 else "⬅️ "
log.info(f"{Colors.CYAN}{direction} Horizontal max: {prev} (threshold: {dynamic_h_threshold:.1f}){Colors.RESET}")
- now = time.time()
+ now: float = time.time()
if self.last_peak_time > 0:
- interval = now - self.last_peak_time
+ interval: float = now - self.last_peak_time
self.peak_intervals.append(interval)
self.last_peak_time = now
self.horiz_increasing = True
- current = self.vert_buffer[-1]
- prev = self.vert_buffer[-2]
+ current: int = self.vert_buffer[-1]
+ prev: int = self.vert_buffer[-2]
if self.vert_increasing is None:
self.vert_increasing = current > prev
- dynamic_v_threshold = max(100, min(self.direction_change_threshold, v_variance / 3))
+ dynamic_v_threshold: float = max(100, min(self.direction_change_threshold, v_variance / 3))
if self.vert_increasing and current < prev - dynamic_v_threshold:
if abs(prev) > self.peak_threshold:
self.vert_peaks.append((len(self.vert_buffer)-1, prev, time.time()))
- direction = "⬆️ " if prev > 0 else "⬇️ "
+ direction: str = "⬆️ " if prev > 0 else "⬇️ "
log.info(f"{Colors.MAGENTA}{direction} Vertical max: {prev} (threshold: {dynamic_v_threshold:.1f}){Colors.RESET}")
- now = time.time()
+ now: float = time.time()
if self.last_peak_time > 0:
- interval = now - self.last_peak_time
+ interval: float = now - self.last_peak_time
self.peak_intervals.append(interval)
self.last_peak_time = now
@@ -257,60 +234,60 @@ def detect_peaks_and_troughs(self):
elif not self.vert_increasing and current > prev + dynamic_v_threshold:
if abs(prev) > self.peak_threshold:
self.vert_troughs.append((len(self.vert_buffer)-1, prev, time.time()))
- direction = "⬆️ " if prev > 0 else "⬇️ "
+ direction: str = "⬆️ " if prev > 0 else "⬇️ "
log.info(f"{Colors.MAGENTA}{direction} Vertical max: {prev} (threshold: {dynamic_v_threshold:.1f}){Colors.RESET}")
- now = time.time()
+ now: float = time.time()
if self.last_peak_time > 0:
- interval = now - self.last_peak_time
+ interval: float = now - self.last_peak_time
self.peak_intervals.append(interval)
self.last_peak_time = now
self.vert_increasing = True
- def calculate_rhythm_consistency(self):
+ def calculate_rhythm_consistency(self) -> float:
"""Calculate how consistent the timing between peaks is (Apple-like)."""
if len(self.peak_intervals) < 2:
return 0
- mean_interval = statistics.mean(self.peak_intervals)
+ mean_interval: float = statistics.mean(self.peak_intervals)
if mean_interval == 0:
return 0
- variances = [(i/mean_interval - 1.0) ** 2 for i in self.peak_intervals]
- consistency = 1.0 - min(1.0, statistics.mean(variances) / self.rhythm_consistency_threshold)
+ variances: List[float] = [(i/mean_interval - 1.0) ** 2 for i in self.peak_intervals]
+ consistency: float = 1.0 - min(1.0, statistics.mean(variances) / self.rhythm_consistency_threshold)
return max(0, consistency)
- def calculate_confidence_score(self, extremes, is_vertical=True):
+ def calculate_confidence_score(self, extremes: List[Tuple[int, int, float]], is_vertical: bool = True) -> float:
"""Calculate confidence score for gesture detection (Apple-like)."""
if len(extremes) < self.required_extremes:
return 0.0
- sorted_extremes = sorted(extremes, key=lambda x: x[0])
+ sorted_extremes: List[Tuple[int, int, float]] = sorted(extremes, key=lambda x: x[0])
- recent = sorted_extremes[-self.required_extremes:]
+ recent: List[Tuple[int, int, float]] = sorted_extremes[-self.required_extremes:]
- avg_amplitude = sum(abs(val) for _, val, _ in recent) / len(recent)
- amplitude_factor = min(1.0, avg_amplitude / 600)
+ avg_amplitude: float = sum(abs(val) for _, val, _ in recent) / len(recent)
+ amplitude_factor: float = min(1.0, avg_amplitude / 600)
- rhythm_factor = self.calculate_rhythm_consistency()
+ rhythm_factor: float = self.calculate_rhythm_consistency()
- signs = [1 if val > 0 else -1 for _, val, _ in recent]
- alternating = all(signs[i] != signs[i-1] for i in range(1, len(signs)))
- alternation_factor = 1.0 if alternating else 0.5
+ signs: List[int] = [1 if val > 0 else -1 for _, val, _ in recent]
+ alternating: bool = all(signs[i] != signs[i-1] for i in range(1, len(signs)))
+ alternation_factor: float = 1.0 if alternating else 0.5
if is_vertical:
- vert_amp = sum(abs(val) for _, val, _ in recent) / len(recent)
- horiz_vals = list(self.horiz_buffer)[-len(recent)*2:]
- horiz_amp = sum(abs(val) for val in horiz_vals) / len(horiz_vals) if horiz_vals else 0
- isolation_factor = min(1.0, vert_amp / (horiz_amp + 0.1) * 1.2)
+ vert_amp: float = sum(abs(val) for _, val, _ in recent) / len(recent)
+ horiz_vals: List[int] = list(self.horiz_buffer)[-len(recent)*2:]
+ horiz_amp: float = sum(abs(val) for val in horiz_vals) / len(horiz_vals) if horiz_vals else 0
+ isolation_factor: float = min(1.0, vert_amp / (horiz_amp + 0.1) * 1.2)
else:
- horiz_amp = sum(abs(val) for _, val, _ in recent)
- vert_vals = list(self.vert_buffer)[-len(recent)*2:]
- vert_amp = sum(abs(val) for val in vert_vals) / len(vert_vals) if vert_vals else 0
- isolation_factor = min(1.0, horiz_amp / (vert_amp + 0.1) * 1.2)
+ horiz_amp: float = sum(abs(val) for _, val, _ in recent)
+ vert_vals: List[int] = list(self.vert_buffer)[-len(recent)*2:]
+ vert_amp: float = sum(abs(val) for val in vert_vals) / len(vert_vals) if vert_vals else 0
+ isolation_factor: float = min(1.0, horiz_amp / (vert_amp + 0.1) * 1.2)
- confidence = (
+ confidence: float = (
amplitude_factor * 0.4 +
rhythm_factor * 0.2 +
alternation_factor * 0.2 +
@@ -319,12 +296,12 @@ def calculate_confidence_score(self, extremes, is_vertical=True):
return confidence
- def detect_gestures(self):
+ def detect_gestures(self) -> Optional[str]:
"""Recognize head gesture patterns with Apple-like intelligence."""
if len(self.vert_peaks) + len(self.vert_troughs) >= self.required_extremes:
- all_extremes = sorted(self.vert_peaks + self.vert_troughs, key=lambda x: x[0])
+ all_extremes: List[Tuple[int, int, float]] = sorted(self.vert_peaks + self.vert_troughs, key=lambda x: x[0])
- confidence = self.calculate_confidence_score(all_extremes, is_vertical=True)
+ confidence: float = self.calculate_confidence_score(all_extremes, is_vertical=True)
log.info(f"Vertical motion confidence: {confidence:.2f} (need {self.min_confidence_threshold:.2f})")
@@ -333,9 +310,9 @@ def detect_gestures(self):
return "YES"
if len(self.horiz_peaks) + len(self.horiz_troughs) >= self.required_extremes:
- all_extremes = sorted(self.horiz_peaks + self.horiz_troughs, key=lambda x: x[0])
+ all_extremes: List[Tuple[int, int, float]] = sorted(self.horiz_peaks + self.horiz_troughs, key=lambda x: x[0])
- confidence = self.calculate_confidence_score(all_extremes, is_vertical=False)
+ confidence: float = self.calculate_confidence_score(all_extremes, is_vertical=False)
log.info(f"Horizontal motion confidence: {confidence:.2f} (need {self.min_confidence_threshold:.2f})")
@@ -345,7 +322,7 @@ def detect_gestures(self):
return None
- def start_detection(self):
+ def start_detection(self) -> None:
"""Begin gesture detection process."""
log.info(f"{Colors.BOLD}{Colors.WHITE}Starting gesture detection...{Colors.RESET}")
@@ -353,7 +330,7 @@ def start_detection(self):
log.error(f"{Colors.RED}Failed to connect to AirPods.{Colors.RESET}")
return
- data_thread = threading.Thread(target=self.process_data)
+ data_thread: Thread = Thread(target=self.process_data)
data_thread.daemon = True
data_thread.start()
@@ -377,5 +354,5 @@ def start_detection(self):
print(f"{Colors.GREEN}• YES: {Colors.WHITE}nodding head up and down{Colors.RESET}")
print(f"{Colors.RED}• NO: {Colors.WHITE}shaking head left and right{Colors.RESET}\n")
- detector = GestureDetector()
+ detector: GestureDetector = GestureDetector()
detector.start_detection()
\ No newline at end of file
diff --git a/head-tracking/head_orientation.py b/head-tracking/head_orientation.py
index d27cb853e..1f90990e1 100644
--- a/head-tracking/head_orientation.py
+++ b/head-tracking/head_orientation.py
@@ -1,63 +1,43 @@
import math
-import drawille
import numpy as np
import logging
import os
+from colors import *
+from drawille import Canvas
+from logging import Logger, StreamHandler
+from matplotlib.animation import FuncAnimation
+from matplotlib.pyplot import Axes, Figure
+from numpy.typing import NDArray
+from os import terminal_size as TerminalSize
+from typing import Any, Dict, List, Optional, Tuple
-class Colors:
- RESET = "\033[0m"
- BOLD = "\033[1m"
- RED = "\033[91m"
- GREEN = "\033[92m"
- YELLOW = "\033[93m"
- BLUE = "\033[94m"
- MAGENTA = "\033[95m"
- CYAN = "\033[96m"
- WHITE = "\033[97m"
- BG_BLACK = "\033[40m"
-
-class ColorFormatter(logging.Formatter):
- FORMATS = {
- logging.DEBUG: Colors.BLUE + "[%(levelname)s] %(message)s" + Colors.RESET,
- logging.INFO: Colors.GREEN + "%(message)s" + Colors.RESET,
- logging.WARNING: Colors.YELLOW + "%(message)s" + Colors.RESET,
- logging.ERROR: Colors.RED + "[%(levelname)s] %(message)s" + Colors.RESET,
- logging.CRITICAL: Colors.RED + Colors.BOLD + "[%(levelname)s] %(message)s" + Colors.RESET
- }
-
- def format(self, record):
- log_fmt = self.FORMATS.get(record.levelno)
- formatter = logging.Formatter(log_fmt, datefmt="%H:%M:%S")
- return formatter.format(record)
-
-handler = logging.StreamHandler()
+handler: StreamHandler = StreamHandler()
handler.setFormatter(ColorFormatter())
-log = logging.getLogger(__name__)
+log: Logger = logging.getLogger(__name__)
log.setLevel(logging.INFO)
log.addHandler(handler)
log.propagate = False
-
class HeadOrientation:
- def __init__(self, use_terminal=False):
- self.orientation_offset = 5500
- self.o1_neutral = 19000
- self.o2_neutral = 0
- self.o3_neutral = 0
- self.calibration_samples = []
- self.calibration_complete = False
- self.calibration_sample_count = 10
- self.fig = None
- self.ax = None
- self.arrow = None
- self.animation = None
- self.use_terminal = use_terminal
+ def __init__(self, use_terminal: bool = False) -> None:
+ self.orientation_offset: int = 5500
+ self.o1_neutral: int = 19000
+ self.o2_neutral: int = 0
+ self.o3_neutral: int = 0
+ self.calibration_samples: List[List[int]] = []
+ self.calibration_complete: bool = False
+ self.calibration_sample_count: int = 10
+ self.fig: Optional[Figure] = None
+ self.ax: Optional[Axes] = None
+ self.arrow: Any = None
+ self.animation: Optional[FuncAnimation] = None
+ self.use_terminal: bool = use_terminal
- def reset_calibration(self):
+ def reset_calibration(self) -> None:
self.calibration_samples = []
self.calibration_complete = False
- def add_calibration_sample(self, orientation_values):
+ def add_calibration_sample(self, orientation_values: List[int]) -> bool:
if len(self.calibration_samples) < self.calibration_sample_count:
self.calibration_samples.append(orientation_values)
return False
@@ -66,57 +46,58 @@ def add_calibration_sample(self, orientation_values):
return True
return True
- def _calculate_calibration(self):
+ def _calculate_calibration(self) -> None:
if len(self.calibration_samples) < 3:
log.warning("Not enough calibration samples")
return
- samples = np.array(self.calibration_samples)
- self.o1_neutral = np.mean(samples[:, 0])
- avg_o2 = np.mean(samples[:, 1])
- avg_o3 = np.mean(samples[:, 2])
- self.o2_neutral = avg_o2
- self.o3_neutral = avg_o3
+ samples: NDArray[[List[int]]] = np.array(self.calibration_samples)
+ self.o1_neutral: float = np.mean(samples[:, 0])
+ avg_o2: float = np.mean(samples[:, 1])
+ avg_o3: float = np.mean(samples[:, 2])
+ self.o2_neutral: float = avg_o2
+ self.o3_neutral: float = avg_o3
log.info("Calibration complete: o1_neutral=%.2f, o2_neutral=%.2f, o3_neutral=%.2f",
self.o1_neutral, self.o2_neutral, self.o3_neutral)
self.calibration_complete = True
- def calculate_orientation(self, o1, o2, o3):
+ def calculate_orientation(self, o1: float, o2: float, o3: float) -> Dict[str, float]:
if not self.calibration_complete:
return {'pitch': 0, 'yaw': 0}
- o1_norm = o1 - self.o1_neutral
- o2_norm = o2 - self.o2_neutral
- o3_norm = o3 - self.o3_neutral
- pitch = (o2_norm + o3_norm) / 2 / 32000 * 180
- yaw = (o2_norm - o3_norm) / 2 / 32000 * 180
+ o1_norm: float = o1 - self.o1_neutral
+ o2_norm: float = o2 - self.o2_neutral
+ o3_norm: float = o3 - self.o3_neutral
+ pitch: float = (o2_norm + o3_norm) / 2 / 32000 * 180
+ yaw: float = (o2_norm - o3_norm) / 2 / 32000 * 180
return {'pitch': pitch, 'yaw': yaw}
- def create_face_art(self, pitch, yaw):
+ def create_face_art(self, pitch: float, yaw: float) -> str:
if self.use_terminal:
try:
- ts = os.get_terminal_size()
+ ts: TerminalSize = os.get_terminal_size()
width, height = ts.columns, ts.lines * 2
except Exception:
width, height = 80, 40
else:
width, height = 80, 40
center_x, center_y = width // 2, height // 2
- radius = (min(width, height) // 2 - 2) // 2
- pitch_rad = math.radians(pitch)
- yaw_rad = math.radians(yaw)
- canvas = drawille.Canvas()
- def rotate_point(x, y, z, pitch_r, yaw_r):
+ radius: int = (min(width, height) // 2 - 2) // 2
+ pitch_rad: float = math.radians(pitch)
+ yaw_rad: float = math.radians(yaw)
+ canvas: Canvas = Canvas()
+
+ def rotate_point(x: float, y: float, z: float, pitch_r: float, yaw_r: float) -> Tuple[int, int]:
cos_y, sin_y = math.cos(yaw_r), math.sin(yaw_r)
cos_p, sin_p = math.cos(pitch_r), math.sin(pitch_r)
- x1 = x * cos_y - z * sin_y
- z1 = x * sin_y + z * cos_y
- y1 = y * cos_p - z1 * sin_p
- z2 = y * sin_p + z1 * cos_p
- scale = 1 + (z2 / width)
+ x1: float = x * cos_y - z * sin_y
+ z1: float = x * sin_y + z * cos_y
+ y1: float = y * cos_p - z1 * sin_p
+ z2: float = y * sin_p + z1 * cos_p
+ scale: float = 1 + (z2 / width)
return int(center_x + x1 * scale), int(center_y + y1 * scale)
for angle in range(0, 360, 2):
- rad = math.radians(angle)
- x = radius * math.cos(rad)
- y = radius * math.sin(rad)
+ rad: float = math.radians(angle)
+ x: float = radius * math.cos(rad)
+ y: float = radius * math.sin(rad)
x1, y1 = rotate_point(x, y, 0, pitch_rad, yaw_rad)
canvas.set(x1, y1)
for eye in [(-radius//2, -radius//3, 2), (radius//2, -radius//3, 2)]:
@@ -129,14 +110,14 @@ def rotate_point(x, y, z, pitch_r, yaw_r):
for dx in [-1, 0, 1]:
for dy in [-1, 0, 1]:
canvas.set(nx + dx, ny + dy)
- smile_depth = radius // 8
- mouth_local_y = radius // 4
- mouth_length = radius
+ smile_depth: int = radius // 8
+ mouth_local_y: int = radius // 4
+ mouth_length: int = radius
for x_offset in range(-mouth_length // 2, mouth_length // 2 + 1):
- norm = abs(x_offset) / (mouth_length / 2)
- y_offset = int((1 - norm ** 2) * smile_depth)
- local_x = x_offset
- local_y = mouth_local_y + y_offset
+ norm: float = abs(x_offset) / (mouth_length / 2)
+ y_offset: int = int((1 - norm ** 2) * smile_depth)
+ local_x: int = x_offset
+ local_y: int = mouth_local_y + y_offset
mx, my = rotate_point(local_x, local_y, 0, pitch_rad, yaw_rad)
canvas.set(mx, my)
return canvas.frame()
diff --git a/head-tracking/plot.py b/head-tracking/plot.py
index 38ccea186..b1ad79bc3 100644
--- a/head-tracking/plot.py
+++ b/head-tracking/plot.py
@@ -1,61 +1,41 @@
+import asciichartpy as acp
+import logging
+import matplotlib.pyplot as plt
+import numpy as np
+import os
import struct
-import bluetooth
-import threading
import time
-from datetime import datetime
-import numpy as np
-import matplotlib.pyplot as plt
+from bluetooth import BluetoothSocket
+from colors import *
+from connection_manager import ConnectionManager
+from datetime import datetime as DateTime
+from drawille import Canvas
+from head_orientation import HeadOrientation
+from logging import Logger, StreamHandler
from matplotlib.animation import FuncAnimation
-import os
-import asciichartpy as acp
+from matplotlib.legend import Legend
+from matplotlib.pyplot import Axes, Figure
+from numpy.typing import NDArray
from rich.live import Live
from rich.layout import Layout
from rich.panel import Panel
from rich.console import Console
-import drawille
-from head_orientation import HeadOrientation
-import logging
-from connection_manager import ConnectionManager
+from threading import Lock, Thread
+from typing import Any, Dict, List, Optional, TextIO, Tuple, Union
-class Colors:
- RESET = "\033[0m"
- BOLD = "\033[1m"
- RED = "\033[91m"
- GREEN = "\033[92m"
- YELLOW = "\033[93m"
- BLUE = "\033[94m"
- MAGENTA = "\033[95m"
- CYAN = "\033[96m"
- WHITE = "\033[97m"
- BG_BLACK = "\033[40m"
-
-class ColorFormatter(logging.Formatter):
- FORMATS = {
- logging.DEBUG: Colors.BLUE + "[%(levelname)s] %(message)s" + Colors.RESET,
- logging.INFO: Colors.GREEN + "%(message)s" + Colors.RESET,
- logging.WARNING: Colors.YELLOW + "%(message)s" + Colors.RESET,
- logging.ERROR: Colors.RED + "[%(levelname)s] %(message)s" + Colors.RESET,
- logging.CRITICAL: Colors.RED + Colors.BOLD + "[%(levelname)s] %(message)s" + Colors.RESET
- }
-
- def format(self, record):
- log_fmt = self.FORMATS.get(record.levelno)
- formatter = logging.Formatter(log_fmt, datefmt="%H:%M:%S")
- return formatter.format(record)
-
-handler = logging.StreamHandler()
+handler: StreamHandler = StreamHandler()
handler.setFormatter(ColorFormatter())
-logger = logging.getLogger("airpods-head-tracking")
+logger: Logger = logging.getLogger("airpods-head-tracking")
logger.setLevel(logging.INFO)
logger.addHandler(handler)
logger.propagate = True
-INIT_CMD = "00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00"
-NOTIF_CMD = "04 00 04 00 0F 00 FF FF FE FF"
-START_CMD = "04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00"
-STOP_CMD = "04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00"
+INIT_CMD: str = "00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00"
+NOTIF_CMD: str = "04 00 04 00 0F 00 FF FF FE FF"
+START_CMD: str = "04 00 04 00 17 00 00 00 10 00 10 00 08 A1 02 42 0B 08 0E 10 02 1A 05 01 40 9C 00 00"
+STOP_CMD: str = "04 00 04 00 17 00 00 00 10 00 11 00 08 7E 10 02 42 0B 08 4E 10 02 1A 05 01 00 00 00 00"
-KEY_FIELDS = {
+KEY_FIELDS: Dict[str, Tuple[int, int]] = {
"orientation 1": (43, 2),
"orientation 2": (45, 2),
"orientation 3": (47, 2),
@@ -68,28 +48,28 @@ def format(self, record):
}
class AirPodsTracker:
- def __init__(self):
- self.sock = None
- self.recording = False
- self.log_file = None
- self.listener_thread = None
- self.bt_addr = "28:2D:7F:C2:05:5B"
- self.psm = 0x1001
- self.raw_packets = []
- self.parsed_packets = []
- self.live_data = []
- self.live_plotting = False
- self.animation = None
- self.fig = None
- self.axes = None
- self.lines = {}
- self.selected_fields = []
- self.data_lock = threading.Lock()
- self.orientation_offset = 5500
- self.use_terminal = True # '--terminal' in sys.argv
- self.orientation_visualizer = HeadOrientation(use_terminal=self.use_terminal)
-
- self.conn = None
+ def __init__(self) -> None:
+ self.sock: BluetoothSocket = None
+ self.recording: bool = False
+ self.log_file: Optional[TextIO] = None
+ self.listener_thread: Optional[Thread] = None
+ self.bt_addr: str = "28:2D:7F:C2:05:5B"
+ self.psm: int = 0x1001
+ self.raw_packets: List[bytes] = []
+ self.parsed_packets: List[bytes] = []
+ self.live_data: List[bytes] = []
+ self.live_plotting: bool = False
+ self.animation: FuncAnimation = None
+ self.fig: Optional[Figure] = None
+ self.axes: Optional[Axes] = None
+ self.lines: Dict[str, Any] = {}
+ self.selected_fields: List[str] = []
+ self.data_lock: Lock = Lock()
+ self.orientation_offset: int = 5500
+ self.use_terminal: bool = True # '--terminal' in sys.argv
+ self.orientation_visualizer: HeadOrientation = HeadOrientation(use_terminal=self.use_terminal)
+
+ self.conn: Optional[ConnectionManager] = None
def connect(self):
try:
@@ -102,35 +82,35 @@ def connect(self):
self.sock.send(bytes.fromhex(NOTIF_CMD))
logger.info("Sent initialization command.")
- self.listener_thread = threading.Thread(target=self.listen, daemon=True)
+ self.listener_thread = Thread(target=self.listen, daemon=True)
self.listener_thread.start()
return True
except Exception as e:
logger.error("Connection error: %s", e)
return False
- def start_tracking(self, duration=None):
+ def start_tracking(self, duration: Optional[float] = None) -> None:
if not self.recording:
self.conn.send_start()
- filename = "head_tracking_" + datetime.now().strftime("%Y%m%d_%H%M%S") + ".log"
+ filename: str = f"head_tracking_{DateTime.now().strftime('%Y%m%d_%H%M%S')}.log"
self.log_file = open(filename, "w")
self.recording = True
logger.info("Recording started. Saving data to %s", filename)
if duration is not None and duration > 0:
- def auto_stop():
+ def auto_stop() -> None:
time.sleep(duration)
if self.recording:
self.stop_tracking()
logger.info("Recording automatically stopped after %s seconds.", duration)
- timer_thread = threading.Thread(target=auto_stop, daemon=True)
+ timer_thread = Thread(target=auto_stop, daemon=True)
timer_thread.start()
logger.info("Will automatically stop recording after %s seconds.", duration)
else:
logger.info("Already recording.")
- def stop_tracking(self):
+ def stop_tracking(self) -> None:
if self.recording:
self.conn.send_stop()
self.recording = False
@@ -141,39 +121,41 @@ def stop_tracking(self):
else:
logger.info("Not currently recording.")
- def format_hex(self, data):
- hex_str = data.hex()
+ def format_hex(self, data: bytes) -> str:
+ hex_str: str = data.hex()
return ' '.join(hex_str[i:i + 2] for i in range(0, len(hex_str), 2))
- def parse_raw_packet(self, hex_string):
+ def parse_raw_packet(self, hex_string: str) -> bytes:
return bytes.fromhex(hex_string.replace(" ", ""))
- def interpret_bytes(self, raw_bytes, start, length, data_type="signed_short"):
+ def interpret_bytes(self, raw_bytes: bytes, start: int, length: int, data_type: str = "signed_short") -> Optional[Union[int, float]]:
if start + length > len(raw_bytes):
return None
- if data_type == "signed_short":
- return int.from_bytes(raw_bytes[start:start + 2], byteorder='little', signed=True)
- elif data_type == "unsigned_short":
- return int.from_bytes(raw_bytes[start:start + 2], byteorder='little', signed=False)
- elif data_type == "signed_short_be":
- return int.from_bytes(raw_bytes[start:start + 2], byteorder='big', signed=True)
- elif data_type == "float_le":
- if start + 4 <= len(raw_bytes):
- return struct.unpack('f', raw_bytes[start:start + 4])[0]
- return None
-
- def normalize_orientation(self, value, field_name):
+ match data_type:
+ case "signed_short":
+ return int.from_bytes(raw_bytes[start:start + 2], byteorder='little', signed=True)
+ case "unsigned_short":
+ return int.from_bytes(raw_bytes[start:start + 2], byteorder='little', signed=False)
+ case "signed_short_be":
+ return int.from_bytes(raw_bytes[start:start + 2], byteorder='big', signed=True)
+ case "float_le":
+ if start + 4 <= len(raw_bytes):
+ return struct.unpack('f', raw_bytes[start:start + 4])[0]
+ case _:
+ return None
+
+ def normalize_orientation(self, value: Optional[Union[int, float]], field_name: str) -> Optional[Union[int, float]]:
if 'orientation' in field_name.lower():
return value + self.orientation_offset
return value
- def parse_packet_all_fields(self, raw_bytes):
- packet = {}
+ def parse_packet_all_fields(self, raw_bytes: bytes) -> Dict[str, Union[int, float]]:
+ packet: Dict[str, Union[int, float]] = {}
packet["seq_num"] = int.from_bytes(raw_bytes[12:14], byteorder='little')
@@ -186,14 +168,14 @@ def parse_packet_all_fields(self, raw_bytes):
packet[field_name] = self.normalize_orientation(raw_value, field_name)
for i in range(30, min(90, len(raw_bytes) - 1), 2):
- field_name = f"byte_{i:02d}"
- raw_value = self.interpret_bytes(raw_bytes, i, 2, "signed_short")
+ field_name: str = f"byte_{i:02d}"
+ raw_value: Optional[Union[int, float]] = self.interpret_bytes(raw_bytes, i, 2, "signed_short")
if raw_value is not None:
packet[field_name] = self.normalize_orientation(raw_value, field_name)
return packet
- def apply_dark_theme(self, fig, axes):
+ def apply_dark_theme(self, fig: Figure, axes: List[Axes]) -> None:
fig.patch.set_facecolor('#1e1e1e')
for ax in axes:
ax.set_facecolor('#2d2d2d')
@@ -210,21 +192,21 @@ def apply_dark_theme(self, fig, axes):
for spine in ax.spines.values():
spine.set_color('#555555')
- legend = ax.get_legend()
+ legend: Optional[Legend] = ax.get_legend()
if (legend):
legend.get_frame().set_facecolor('#2d2d2d')
legend.get_frame().set_alpha(0.7)
for text in legend.get_texts():
text.set_color('white')
- def listen(self):
+ def listen(self) -> None:
while True:
try:
- data = self.sock.recv(1024)
- formatted = self.format_hex(data)
- timestamp = datetime.now().isoformat()
+ data: bytes = self.sock.recv(1024)
+ formatted: str = self.format_hex(data)
+ timestamp: str = DateTime.now().isoformat()
- is_valid = self.is_valid_tracking_packet(formatted)
+ is_valid: bool = self.is_valid_tracking_packet(formatted)
if not self.live_plotting:
if is_valid:
@@ -238,8 +220,8 @@ def listen(self):
self.log_file.flush()
try:
- raw_bytes = self.parse_raw_packet(formatted)
- packet = self.parse_packet_all_fields(raw_bytes)
+ raw_bytes: bytes = self.parse_raw_packet(formatted)
+ packet: Dict[str, Union[int, float]] = self.parse_packet_all_fields(raw_bytes)
with self.data_lock:
self.live_data.append(packet)
@@ -253,7 +235,7 @@ def listen(self):
logger.error("Error receiving data: %s", e)
break
- def load_log_file(self, filepath):
+ def load_log_file(self, filepath: str) -> bool:
self.raw_packets = []
self.parsed_packets = []
try:
@@ -262,11 +244,11 @@ def load_log_file(self, filepath):
line = line.strip()
if line:
try:
- raw_bytes = self.parse_raw_packet(line)
+ raw_bytes: bytes = self.parse_raw_packet(line)
self.raw_packets.append(raw_bytes)
- packet = self.parse_packet_all_fields(raw_bytes)
+ packet: Dict[str, Union[int, float]] = self.parse_packet_all_fields(raw_bytes)
- min_seq_num = min(
+ min_seq_num: int = min(
[parsed_packet["seq_num"] for parsed_packet in self.parsed_packets], default=0
)
@@ -282,26 +264,26 @@ def load_log_file(self, filepath):
logger.error(f"Error loading log file: {e}")
return False
- def extract_field_values(self, field_name, data_source='loaded'):
+ def extract_field_values(self, field_name: str, data_source: str = 'loaded') -> List[Union[int, float]]:
if data_source == 'loaded':
- data = self.parsed_packets
+ data: List[Dict[str, Union[int, float]]] = self.parsed_packets
else:
with self.data_lock:
- data = self.live_data.copy()
+ data: List[Dict[str, Union[int, float]]] = self.live_data.copy()
- values = [packet.get(field_name, 0) for packet in data if field_name in packet]
+ values: List[Union[int, float]] = [packet.get(field_name, 0) for packet in data if field_name in packet]
if data_source == 'live' and len(values) > 5:
try:
- values = np.array(values, dtype=float)
+ values: NDArray[Any] = np.array(values, dtype=float)
values = np.convolve(values, np.ones(5) / 5, mode='valid')
except Exception as e:
logger.warning(f"Smoothing error (non-critical): {e}")
return values
- def is_valid_tracking_packet(self, hex_string):
- standard_header = "04 00 04 00 17 00 00 00 10 00"
+ def is_valid_tracking_packet(self, hex_string: str) -> bool:
+ standard_header: str = "04 00 04 00 17 00 00 00 10 00"
if not hex_string.startswith(standard_header):
if self.live_plotting:
@@ -316,13 +298,13 @@ def is_valid_tracking_packet(self, hex_string):
return True
- def plot_fields(self, field_names=None):
+ def plot_fields(self, field_names: Optional[List[str]] = None) -> None:
if not self.parsed_packets:
logger.error("No data to plot. Load a log file first.")
return
if field_names is None:
- field_names = list(KEY_FIELDS.keys())
+ field_names: List[str] = list(KEY_FIELDS.keys())
if not self.orientation_visualizer.calibration_complete:
if len(self.parsed_packets) < self.orientation_visualizer.calibration_sample_count:
@@ -339,16 +321,16 @@ def plot_fields(self, field_names=None):
self._plot_fields_terminal(field_names)
else:
- acceleration_fields = [f for f in field_names if 'acceleration' in f.lower()]
- orientation_fields = [f for f in field_names if 'orientation' in f.lower()]
- other_fields = [f for f in field_names if f not in acceleration_fields + orientation_fields]
+ acceleration_fields: List[str] = [f for f in field_names if 'acceleration' in f.lower()]
+ orientation_fields: List[str] = [f for f in field_names if 'orientation' in f.lower()]
+ other_fields: List[str] = [f for f in field_names if f not in acceleration_fields + orientation_fields]
fig, axes = plt.subplots(3, 1, figsize=(14, 12), sharex=True)
self.apply_dark_theme(fig, axes)
- acceleration_colors = ['#FFFF00', '#00FFFF']
- orientation_colors = ['#FF00FF', '#00FF00', '#FFA500']
- other_colors = ['#52b788', '#f4a261', '#e76f51', '#2a9d8f']
+ acceleration_colors: List[str] = ['#FFFF00', '#00FFFF']
+ orientation_colors: List[str] = ['#FF00FF', '#00FF00', '#FFA500']
+ other_colors: List[str] = ['#52b788', '#f4a261', '#e76f51', '#2a9d8f']
if acceleration_fields:
for i, field in enumerate(acceleration_fields):
@@ -375,17 +357,17 @@ def plot_fields(self, field_names=None):
plt.tight_layout()
plt.show()
- def _plot_fields_terminal(self, field_names):
+ def _plot_fields_terminal(self, field_names: List[str]) -> None:
"""Internal method for terminal-based plotting"""
- terminal_width = os.get_terminal_size().columns
- plot_width = min(terminal_width - 10, 120)
- plot_height = 15
+ terminal_width: int = os.get_terminal_size().columns
+ plot_width: int = min(terminal_width - 10, 120)
+ plot_height: int = 15
- acceleration_fields = [f for f in field_names if 'acceleration' in f.lower()]
- orientation_fields = [f for f in field_names if 'orientation' in f.lower()]
- other_fields = [f for f in field_names if f not in acceleration_fields + orientation_fields]
+ acceleration_fields: List[str] = [f for f in field_names if 'acceleration' in f.lower()]
+ orientation_fields: List[str] = [f for f in field_names if 'orientation' in f.lower()]
+ other_fields: List[str] = [f for f in field_names if f not in acceleration_fields + orientation_fields]
- def plot_group(fields, title):
+ def plot_group(fields: List[str], title: str) -> None:
if not fields:
return
@@ -393,40 +375,39 @@ def plot_group(fields, title):
print("=" * len(title))
for field in fields:
- values = self.extract_field_values(field)
+ values: List[float] = self.extract_field_values(field)
if len(values) > plot_width:
values = values[-plot_width:]
if title == "Acceleration Data":
- chart = acp.plot(values, {'height': plot_height})
+ chart: str = acp.plot(values, {'height': plot_height})
print(chart)
else:
- chart = acp.plot(values, {'height': plot_height})
+ chart: str = acp.plot(values, {'height': plot_height})
print(chart)
- print(f"Min: {min(values):.2f}, Max: {max(values):.2f}, " +
- f"Mean: {np.mean(values):.2f}")
+ print(f"Min: {min(values):.2f}, Max: {max(values):.2f}, " + f"Mean: {np.mean(values):.2f}")
print()
plot_group(acceleration_fields, "Acceleration Data")
plot_group(orientation_fields, "Orientation Data")
plot_group(other_fields, "Other Fields")
- def create_braille_plot(self, values, width=80, height=20, y_label=True, fixed_y_min=None, fixed_y_max=None):
- canvas = drawille.Canvas()
+ def create_braille_plot(self, values: List[float], width: int = 80, height: int = 20, y_label: bool = True, fixed_y_min: Optional[float] = None, fixed_y_max: Optional[float] = None) -> str:
+ canvas: Canvas = Canvas()
if fixed_y_min is None or fixed_y_max is None:
local_min, local_max = min(values), max(values)
else:
local_min, local_max = fixed_y_min, fixed_y_max
- y_range = local_max - local_min or 1
- x_step = max(1, len(values) // width)
+ y_range: float = local_max - local_min or 1
+ x_step: int = max(1, len(values) // width)
for i, v in enumerate(values[::x_step]):
- y = int(((v - local_min) / y_range) * (height * 2 - 1))
+ y: int = int(((v - local_min) / y_range) * (height * 2 - 1))
canvas.set(i, y)
- frame = canvas.frame()
+ frame: str = canvas.frame()
if y_label:
- lines = frame.split('\n')
- labeled_lines = []
+ lines: List[str] = frame.split('\n')
+ labeled_lines: List[str] = []
for idx, line in enumerate(lines):
if idx == 0:
labeled_lines.append(f"{local_max:6.0f} {line}")
@@ -437,17 +418,17 @@ def create_braille_plot(self, values, width=80, height=20, y_label=True, fixed_y
frame = "\n".join(labeled_lines)
return frame
- def _start_live_plotting_terminal(self, record_data=False, duration=None):
+ def _start_live_plotting_terminal(self, record_data: bool = False, duration: Optional[float] = None) -> None:
import sys, select, tty, termios
old_settings = termios.tcgetattr(sys.stdin)
tty.setcbreak(sys.stdin.fileno())
- console = Console()
- term_width = console.width
- plot_width = round(min(term_width / 2 - 15, 120))
- ori_height = 10
+ console: Console = Console()
+ term_width: int = console.width
+ plot_width: int = round(min(term_width / 2 - 15, 120))
+ ori_height: int = 10
- def make_compact_layout():
- layout = Layout()
+ def make_compact_layout() -> Layout:
+ layout: Layout = Layout()
layout.split_column(
Layout(name="header", size=3),
Layout(name="main", ratio=1),
@@ -466,7 +447,7 @@ def make_compact_layout():
)
return layout
- layout = make_compact_layout()
+ layout: Layout = make_compact_layout()
try:
import time
@@ -479,76 +460,76 @@ def make_compact_layout():
logger.info("Paused" if self.paused else "Resumed")
if self.paused:
time.sleep(0.1)
- rec_str = " [red][REC][/red]" if record_data else ""
- left = "AirPods Head Tracking - v1.0.0"
- right = "Ctrl+C - Close | p - Pause" + rec_str
- status = "[bold red]Paused[/bold red]"
- header = list(" " * term_width)
+ rec_str: str = " [red][REC][/red]" if record_data else ""
+ left: str = "AirPods Head Tracking - v1.0.0"
+ right: str = "Ctrl+C - Close | p - Pause" + rec_str
+ status: str = "[bold red]Paused[/bold red]"
+ header: List[str] = list(" " * term_width)
header[0:len(left)] = list(left)
header[term_width - len(right):] = list(right)
- start = (term_width - len(status)) // 2
+ start: int = (term_width - len(status)) // 2
header[start:start+len(status)] = list(status)
- header_text = "".join(header)
+ header_text: str = "".join(header)
layout["header"].update(Panel(header_text, style="bold white on black"))
continue
with self.data_lock:
if len(self.live_data) < 1:
continue
- latest = self.live_data[-1]
- data = self.live_data[-plot_width:]
+ latest: Dict[str, float] = self.live_data[-1]
+ data: List[Dict[str, float]] = self.live_data[-plot_width:]
if not self.orientation_visualizer.calibration_complete:
- sample = [
+ sample: List[float] = [
latest.get('orientation 1', 0),
latest.get('orientation 2', 0),
latest.get('orientation 3', 0)
]
self.orientation_visualizer.add_calibration_sample(sample)
time.sleep(0.05)
- rec_str = " [red][REC][/red]" if record_data else ""
+ rec_str: str = " [red][REC][/red]" if record_data else ""
- left = "AirPods Head Tracking - v1.0.0"
- status = "[bold yellow]Calibrating...[/bold yellow]"
- right = "Ctrl+C - Close | p - Pause"
- remaining = max(term_width - len(left) - len(right), 0)
- header_text = f"{left}{status.center(remaining)}{right}{rec_str}"
+ left: str = "AirPods Head Tracking - v1.0.0"
+ status: str = "[bold yellow]Calibrating...[/bold yellow]"
+ right: str = "Ctrl+C - Close | p - Pause"
+ remaining: int = max(term_width - len(left) - len(right), 0)
+ header_text: str = f"{left}{status.center(remaining)}{right}{rec_str}"
layout["header"].update(Panel(header_text, style="bold white on black"))
live.refresh()
continue
- o1 = latest.get('orientation 1', 0)
- o2 = latest.get('orientation 2', 0)
- o3 = latest.get('orientation 3', 0)
- orientation = self.orientation_visualizer.calculate_orientation(o1, o2, o3)
- pitch = orientation['pitch']
- yaw = orientation['yaw']
+ o1: float = latest.get('orientation 1', 0)
+ o2: float = latest.get('orientation 2', 0)
+ o3: float = latest.get('orientation 3', 0)
+ orientation: Dict[str, float] = self.orientation_visualizer.calculate_orientation(o1, o2, o3)
+ pitch: float = orientation['pitch']
+ yaw: float = orientation['yaw']
- h_accel = [p.get('Horizontal Acceleration', 0) for p in data]
- v_accel = [p.get('Vertical Acceleration', 0) for p in data]
+ h_accel: List[float] = [p.get('Horizontal Acceleration', 0) for p in data]
+ v_accel: List[float] = [p.get('Vertical Acceleration', 0) for p in data]
if len(h_accel) > plot_width:
h_accel = h_accel[-plot_width:]
if len(v_accel) > plot_width:
v_accel = v_accel[-plot_width:]
- global_min = min(min(v_accel), min(h_accel))
- global_max = max(max(v_accel), max(h_accel))
- config_acc = {'height': 20, 'min': global_min, 'max': global_max}
- vert_plot = acp.plot(v_accel, config_acc)
- horiz_plot = acp.plot(h_accel, config_acc)
+ global_min: float = min(min(v_accel), min(h_accel))
+ global_max: float = max(max(v_accel), max(h_accel))
+ config_acc: Dict[str, float] = {'height': 20, 'min': global_min, 'max': global_max}
+ vert_plot: str = acp.plot(v_accel, config_acc)
+ horiz_plot: str = acp.plot(h_accel, config_acc)
- rec_str = " [red][REC][/red]" if record_data else ""
- left = "AirPods Head Tracking - v1.0.0"
- right = "Ctrl+C - Close | p - Pause" + rec_str
- status = "[bold green]Live[/bold green]"
- header = list(" " * term_width)
+ rec_str: str = " [red][REC][/red]" if record_data else ""
+ left: str = "AirPods Head Tracking - v1.0.0"
+ right: str = "Ctrl+C - Close | p - Pause" + rec_str
+ status: str = "[bold green]Live[/bold green]"
+ header: List[str] = list(" " * term_width)
header[0:len(left)] = list(left)
header[term_width - len(right):] = list(right)
- start = (term_width - len(status)) // 2
+ start: int = (term_width - len(status)) // 2
header[start:start+len(status)] = list(status)
- header_text = "".join(header)
+ header_text: str = "".join(header)
layout["header"].update(Panel(header_text, style="bold white on black"))
- face_art = self.orientation_visualizer.create_face_art(pitch, yaw)
+ face_art: str = self.orientation_visualizer.create_face_art(pitch, yaw)
layout["accelerations"]["vertical"].update(Panel(
"[bold yellow]Vertical Acceleration[/]\n" +
vert_plot + "\n" +
@@ -563,15 +544,15 @@ def make_compact_layout():
))
layout["orientations"]["face"].update(Panel(face_art, title="[green]Orientation - Visualization[/]", style="green"))
- o2_values = [p.get('orientation 2', 0) for p in data[-plot_width:]]
- o3_values = [p.get('orientation 3', 0) for p in data[-plot_width:]]
- o2_values = o2_values[:plot_width]
- o3_values = o3_values[:plot_width]
- common_min = min(min(o2_values), min(o3_values))
- common_max = max(max(o2_values), max(o3_values))
- config_ori = {'height': ori_height, 'min': common_min, 'max': common_max, 'format': "{:6.0f}"}
- chart_o2 = acp.plot(o2_values, config_ori)
- chart_o3 = acp.plot(o3_values, config_ori)
+ o2_values: List[float] = [p.get('orientation 2', 0) for p in data[-plot_width:]]
+ o3_values: List[float] = [p.get('orientation 3', 0) for p in data[-plot_width:]]
+ o2_values: List[float] = o2_values[:plot_width]
+ o3_values: List[float] = o3_values[:plot_width]
+ common_min: float = min(min(o2_values), min(o3_values))
+ common_max: float = max(max(o2_values), max(o3_values))
+ config_ori: Dict[str, float] = {'height': ori_height, 'min': common_min, 'max': common_max, 'format': "{:6.0f}"}
+ chart_o2: str = acp.plot(o2_values, config_ori)
+ chart_o3: str = acp.plot(o3_values, config_ori)
layout["orientations"]["raw"].update(Panel(
"[bold yellow]Orientation 1:[/]\n" + chart_o2 + "\n" +
f"Cur: {o2_values[-1]:6.1f} | Min: {min(o2_values):6.1f} | Max: {max(o2_values):6.1f}\n\n" +
@@ -591,10 +572,10 @@ def make_compact_layout():
finally:
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_settings)
- def _start_live_plotting(self, record_data=False, duration=None):
- terminal_width = os.get_terminal_size().columns
- plot_width = min(terminal_width - 10, 80)
- plot_height = 10
+ def _start_live_plotting(self, record_data: bool = False, duration: Optional[float] = None) -> None:
+ terminal_width: int = os.get_terminal_size().columns
+ plot_width: int = min(terminal_width - 10, 80)
+ plot_height: int = 10
try:
while True:
@@ -605,13 +586,13 @@ def _start_live_plotting(self, record_data=False, duration=None):
time.sleep(0.1)
continue
- data = self.live_data[-plot_width:]
+ data: List[Dict[str, float]] = self.live_data[-plot_width:]
- acceleration_fields = [f for f in KEY_FIELDS.keys() if 'acceleration' in f.lower()]
- orientation_fields = [f for f in KEY_FIELDS.keys() if 'orientation' in f.lower()]
- other_fields = [f for f in KEY_FIELDS.keys() if f not in acceleration_fields + orientation_fields]
+ acceleration_fields: List[str] = [f for f in KEY_FIELDS.keys() if 'acceleration' in f.lower()]
+ orientation_fields: List[str] = [f for f in KEY_FIELDS.keys() if 'orientation' in f.lower()]
+ other_fields: List[str] = [f for f in KEY_FIELDS.keys() if f not in acceleration_fields + orientation_fields]
- def plot_group(fields, title):
+ def plot_group(fields: List[str], title: str) -> None:
if not fields:
return
@@ -619,9 +600,9 @@ def plot_group(fields, title):
print("=" * len(title))
for field in fields:
- values = [packet.get(field, 0) for packet in data if field in packet]
+ values: List[float] = [packet.get(field, 0) for packet in data if field in packet]
if len(values) > 0:
- chart = acp.plot(values, {'height': plot_height})
+ chart: str = acp.plot(values, {'height': plot_height})
print(chart)
print(f"Current: {values[-1]:.2f}, " +
f"Min: {min(values):.2f}, Max: {max(values):.2f}")
@@ -641,7 +622,7 @@ def plot_group(fields, title):
self.stop_tracking()
self.live_plotting = False
- def start_live_plotting(self, record_data=False, duration=None):
+ def start_live_plotting(self, record_data: bool = False, duration: Optional[float] = None) -> None:
if self.sock is None:
if not self.connect():
logger.error("Could not connect to AirPods. Live plotting aborted.")
@@ -660,12 +641,12 @@ def start_live_plotting(self, record_data=False, duration=None):
self._start_live_plotting_terminal(record_data, duration)
else:
from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec
- fig = plt.figure(figsize=(14, 6))
- gs = GridSpec(1, 2, width_ratios=[1, 1])
- ax_accel = fig.add_subplot(gs[0])
- subgs = GridSpecFromSubplotSpec(2, 1, subplot_spec=gs[1], height_ratios=[2, 1])
- ax_head_top = fig.add_subplot(subgs[0], projection='3d')
- ax_ori = fig.add_subplot(subgs[1])
+ fig: Figure = plt.figure(figsize=(14, 6))
+ gs: GridSpec = GridSpec(1, 2, width_ratios=[1, 1])
+ ax_accel: Axes = fig.add_subplot(gs[0])
+ subgs: GridSpecFromSubplotSpec = GridSpecFromSubplotSpec(2, 1, subplot_spec=gs[1], height_ratios=[2, 1])
+ ax_head_top: Axes = fig.add_subplot(subgs[0], projection='3d')
+ ax_ori: Axes = fig.add_subplot(subgs[1])
ax_accel.set_title("Acceleration Data")
ax_accel.set_xlabel("Packet Index")
@@ -676,16 +657,16 @@ def start_live_plotting(self, record_data=False, duration=None):
self.apply_dark_theme(fig, [ax_accel, ax_head_top, ax_ori])
plt.ion()
- def update_plot(_):
+ def update_plot(_: int) -> None:
with self.data_lock:
- data = self.live_data.copy()
+ data: List[Dict[str, float]] = self.live_data.copy()
if len(data) == 0:
return
- latest = data[-1]
+ latest: Dict[str, float] = data[-1]
if not self.orientation_visualizer.calibration_complete:
- sample = [
+ sample: List[float] = [
latest.get('orientation 1', 0),
latest.get('orientation 2', 0),
latest.get('orientation 3', 0)
@@ -696,9 +677,9 @@ def update_plot(_):
fig.canvas.draw_idle()
return
- h_accel = [p.get('Horizontal Acceleration', 0) for p in data]
- v_accel = [p.get('Vertical Acceleration', 0) for p in data]
- x_vals = list(range(len(h_accel)))
+ h_accel: List[float] = [p.get('Horizontal Acceleration', 0) for p in data]
+ v_accel: List[float] = [p.get('Vertical Acceleration', 0) for p in data]
+ x_vals: List[int] = list(range(len(h_accel)))
ax_accel.cla()
ax_accel.plot(x_vals, v_accel, label='Vertical Acceleration', color='#FFFF00', linewidth=2)
ax_accel.plot(x_vals, h_accel, label='Horizontal Acceleration', color='#00FFFF', linewidth=2)
@@ -711,13 +692,13 @@ def update_plot(_):
ax_accel.xaxis.label.set_color('white')
ax_accel.yaxis.label.set_color('white')
- latest = data[-1]
- o1 = latest.get('orientation 1', 0)
- o2 = latest.get('orientation 2', 0)
- o3 = latest.get('orientation 3', 0)
- orientation = self.orientation_visualizer.calculate_orientation(o1, o2, o3)
- pitch = orientation['pitch']
- yaw = orientation['yaw']
+ latest: Dict[str, float] = data[-1]
+ o1: float = latest.get('orientation 1', 0)
+ o2: float = latest.get('orientation 2', 0)
+ o3: float = latest.get('orientation 3', 0)
+ orientation: Dict[str, float] = self.orientation_visualizer.calculate_orientation(o1, o2, o3)
+ pitch: float = orientation['pitch']
+ yaw: float = orientation['yaw']
ax_head_top.cla()
ax_head_top.set_title("Head Orientation")
@@ -727,25 +708,25 @@ def update_plot(_):
ax_head_top.set_facecolor('#2d2d2d')
pitch_rad = np.radians(pitch)
yaw_rad = np.radians(yaw)
- Rz = np.array([
+ Rz: NDArray[Any] = np.array([
[np.cos(yaw_rad), np.sin(yaw_rad), 0],
[-np.sin(yaw_rad), np.cos(yaw_rad), 0],
[0, 0, 1]
])
- Ry = np.array([
+ Ry: NDArray[Any] = np.array([
[np.cos(pitch_rad), 0, np.sin(pitch_rad)],
[0, 1, 0],
[-np.sin(pitch_rad), 0, np.cos(pitch_rad)]
])
- R = Rz @ Ry
- dir_vec = R @ np.array([1, 0, 0])
+ R: NDArray[Any] = Rz @ Ry
+ dir_vec: NDArray[Any] = R @ np.array([1, 0, 0])
ax_head_top.quiver(0, 0, 0, dir_vec[0], dir_vec[1], dir_vec[2],
color='r', length=0.8, linewidth=3)
ax_ori.cla()
- o2_values = [p.get('orientation 2', 0) for p in data]
- o3_values = [p.get('orientation 3', 0) for p in data]
- x_range = list(range(len(o2_values)))
+ o2_values: List[float] = [p.get('orientation 2', 0) for p in data]
+ o3_values: List[float] = [p.get('orientation 3', 0) for p in data]
+ x_range: List[int] = list(range(len(o2_values)))
ax_ori.plot(x_range, o2_values, label='Orientation 1', color='red', linewidth=2)
ax_ori.plot(x_range, o3_values, label='Orientation 2', color='green', linewidth=2)
ax_ori.set_facecolor('#2d2d2d')
@@ -775,9 +756,9 @@ def update_plot(_):
self.animation = None
plt.ioff()
- def interactive_mode(self):
+ def interactive_mode(self) -> None:
from prompt_toolkit import PromptSession
- session = PromptSession("> ")
+ session: PromptSession = PromptSession("> ")
logger.info("\nAirPods Head Tracking Analyzer")
print("------------------------------")
logger.info("Commands:")
@@ -793,59 +774,61 @@ def interactive_mode(self):
while True:
try:
- cmd_input = session.prompt("> ")
- cmd_parts = cmd_input.strip().split()
+ cmd_input: str = session.prompt("> ")
+ cmd_parts: List[str] = cmd_input.strip().split()
if not cmd_parts:
continue
cmd = cmd_parts[0].lower()
- if cmd == "connect":
- self.connect()
- elif cmd == "start":
- duration = float(cmd_parts[1]) if len(cmd_parts) > 1 else None
- self.start_tracking(duration)
- elif cmd == "stop":
- self.stop_tracking()
- elif cmd == "load" and len(cmd_parts) > 1:
- self.load_log_file(cmd_parts[1])
- elif cmd == "plot":
- self.plot_fields()
- elif cmd == "live":
- duration = float(cmd_parts[1]) if len(cmd_parts) > 1 else None
- logger.info("Starting live plotting mode (without recording)%s.",
- f" for {duration} seconds" if duration else "")
- self.start_live_plotting(record_data=False, duration=duration)
- elif cmd == "liver":
- duration = float(cmd_parts[1]) if len(cmd_parts) > 1 else None
- logger.info("Starting live plotting mode WITH recording%s.",
- f" for {duration} seconds" if duration else "")
- self.start_live_plotting(record_data=True, duration=duration)
- elif cmd == "gestures":
- from gestures import GestureDetector
- if self.conn is not None:
- detector = GestureDetector(conn=self.conn)
- else:
- detector = GestureDetector()
- detector.start_detection()
- elif cmd == "quit":
- logger.info("Exiting.")
- if self.conn != None:
- self.conn.disconnect()
- break
- elif cmd == "help":
- logger.info("\nAirPods Head Tracking Analyzer")
- logger.info("------------------------------")
- logger.info("Commands:")
- logger.info(" connect - connect to your AirPods")
- logger.info(" start [seconds] - start recording head tracking data, optionally for specified duration")
- logger.info(" stop - stop recording")
- logger.info(" load - load and parse a log file")
- logger.info(" plot - plot all sensor data fields")
- logger.info(" live [seconds] - start live plotting (without recording), optionally stop recording after seconds")
- logger.info(" liver [seconds] - start live plotting with recording, optionally stop recording after seconds")
- logger.info(" gestures - start gesture detection")
- logger.info(" quit - exit the program")
- else:
- logger.info("Unknown command. Type 'help' to see available commands.")
+ match cmd:
+ case "connect":
+ self.connect()
+ case "start":
+ duration = float(cmd_parts[1]) if len(cmd_parts) > 1 else None
+ self.start_tracking(duration)
+ case "stop":
+ self.stop_tracking()
+ case "load":
+ if len(cmd_parts) > 1:
+ self.load_log_file(cmd_parts[1])
+ case "plot":
+ self.plot_fields()
+ case "live":
+ duration = float(cmd_parts[1]) if len(cmd_parts) > 1 else None
+ logger.info("Starting live plotting mode (without recording)%s.",
+ f" for {duration} seconds" if duration else "")
+ self.start_live_plotting(record_data=False, duration=duration)
+ case "liver":
+ duration = float(cmd_parts[1]) if len(cmd_parts) > 1 else None
+ logger.info("Starting live plotting mode WITH recording%s.",
+ f" for {duration} seconds" if duration else "")
+ self.start_live_plotting(record_data=True, duration=duration)
+ case "gestures":
+ from gestures import GestureDetector
+ if self.conn is not None:
+ detector: GestureDetector = GestureDetector(conn=self.conn)
+ else:
+ detector: GestureDetector = GestureDetector()
+ detector.start_detection()
+ case "quit":
+ logger.info("Exiting.")
+ if self.conn != None:
+ self.conn.disconnect()
+ break
+ case "help":
+ logger.info("\nAirPods Head Tracking Analyzer")
+ logger.info("------------------------------")
+ logger.info("Commands:")
+ logger.info(" connect - connect to your AirPods")
+ logger.info(" start [seconds] - start recording head tracking data, optionally for specified duration")
+ logger.info(" stop - stop recording")
+ logger.info(" load - load and parse a log file")
+ logger.info(" plot - plot all sensor data fields")
+ logger.info(" live [seconds] - start live plotting (without recording), optionally stop recording after seconds")
+ logger.info(" liver [seconds] - start live plotting with recording, optionally stop recording after seconds")
+ logger.info(" gestures - start gesture detection")
+ logger.info(" quit - exit the program")
+ case _:
+ logger.info("Unknown command. Type 'help' to see available commands.")
except KeyboardInterrupt:
logger.info("Use 'quit' to exit.")
except EOFError:
@@ -856,5 +839,5 @@ def interactive_mode(self):
if __name__ == "__main__":
import sys
- tracker = AirPodsTracker()
- tracker.interactive_mode()
\ No newline at end of file
+ tracker: AirPodsTracker = AirPodsTracker()
+ tracker.interactive_mode()
diff --git a/linux-rust/src/bluetooth/aacp.rs b/linux-rust/src/bluetooth/aacp.rs
index 11f9e4f5e..770797092 100644
--- a/linux-rust/src/bluetooth/aacp.rs
+++ b/linux-rust/src/bluetooth/aacp.rs
@@ -287,6 +287,44 @@ pub struct BatteryInfo {
pub status: BatteryStatus,
}
+fn is_valid_battery_level(level: u8) -> bool {
+ level <= 100
+}
+
+fn merge_battery_info(previous: &[BatteryInfo], incoming: Vec) -> Vec {
+ let mut merged = previous.to_vec();
+
+ for mut update in incoming {
+ if (!is_valid_battery_level(update.level)
+ || (update.status == BatteryStatus::Disconnected && update.level == 0))
+ && let Some(previous_level) = previous
+ .iter()
+ .find(|battery| {
+ battery.component == update.component
+ && is_valid_battery_level(battery.level)
+ && (battery.level > 0 || battery.status != BatteryStatus::Disconnected)
+ })
+ .map(|battery| battery.level)
+ {
+ update.level = previous_level;
+ } else if !is_valid_battery_level(update.level) {
+ update.level = 0;
+ update.status = BatteryStatus::Disconnected;
+ }
+
+ if let Some(existing) = merged
+ .iter_mut()
+ .find(|battery| battery.component == update.component)
+ {
+ *existing = update;
+ } else {
+ merged.push(update);
+ }
+ }
+
+ merged
+}
+
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConnectedDevice {
pub mac: String,
@@ -551,9 +589,10 @@ impl AACPManager {
});
}
let mut state = self.state.lock().await;
- state.battery_info = batteries.clone();
+ let merged_batteries = merge_battery_info(&state.battery_info, batteries);
+ state.battery_info = merged_batteries.clone();
if let Some(ref tx) = state.event_tx {
- let _ = tx.send(AACPEvent::BatteryInfo(batteries));
+ let _ = tx.send(AACPEvent::BatteryInfo(merged_batteries));
}
info!("Received Battery Info: {:?}", state.battery_info);
}
@@ -1241,3 +1280,73 @@ async fn send_thread(mut rx: mpsc::Receiver>, sp: Arc) {
}
info!("Send thread finished.");
}
+
+#[cfg(test)]
+mod tests {
+ use super::{BatteryComponent, BatteryInfo, BatteryStatus, merge_battery_info};
+
+ #[test]
+ fn preserves_last_known_level_for_disconnected_components() {
+ let previous = vec![BatteryInfo {
+ component: BatteryComponent::Case,
+ level: 86,
+ status: BatteryStatus::NotCharging,
+ }];
+
+ let merged = merge_battery_info(
+ &previous,
+ vec![BatteryInfo {
+ component: BatteryComponent::Case,
+ level: 255,
+ status: BatteryStatus::Disconnected,
+ }],
+ );
+
+ assert_eq!(merged.len(), 1);
+ assert_eq!(merged[0].level, 86);
+ assert_eq!(merged[0].status, BatteryStatus::Disconnected);
+ }
+
+ #[test]
+ fn keeps_previous_components_when_update_is_partial() {
+ let previous = vec![
+ BatteryInfo {
+ component: BatteryComponent::Left,
+ level: 78,
+ status: BatteryStatus::NotCharging,
+ },
+ BatteryInfo {
+ component: BatteryComponent::Case,
+ level: 86,
+ status: BatteryStatus::NotCharging,
+ },
+ ];
+
+ let merged = merge_battery_info(
+ &previous,
+ vec![BatteryInfo {
+ component: BatteryComponent::Left,
+ level: 75,
+ status: BatteryStatus::NotCharging,
+ }],
+ );
+
+ assert_eq!(merged.len(), 2);
+ assert_eq!(
+ merged
+ .iter()
+ .find(|battery| battery.component == BatteryComponent::Left)
+ .unwrap()
+ .level,
+ 75
+ );
+ assert_eq!(
+ merged
+ .iter()
+ .find(|battery| battery.component == BatteryComponent::Case)
+ .unwrap()
+ .level,
+ 86
+ );
+ }
+}
diff --git a/linux-rust/src/devices/airpods.rs b/linux-rust/src/devices/airpods.rs
index f8af09555..82731f924 100644
--- a/linux-rust/src/devices/airpods.rs
+++ b/linux-rust/src/devices/airpods.rs
@@ -150,10 +150,12 @@ impl AirPodsDevice {
let tray_handle_clone = tray_handle.clone();
tokio::spawn(async move {
while let Some(value) = listening_mode_rx.recv().await {
- if let Some(handle) = &tray_handle_clone {
+ if let Some(mode) = value.first().copied().filter(|mode| (0x01..=0x04).contains(mode))
+ && let Some(handle) = &tray_handle_clone
+ {
handle
.update(|tray: &mut MyTray| {
- tray.listening_mode = Some(value[0]);
+ tray.listening_mode = Some(mode);
})
.await;
}
diff --git a/linux-rust/src/devices/enums.rs b/linux-rust/src/devices/enums.rs
index 5768d1802..b44784963 100644
--- a/linux-rust/src/devices/enums.rs
+++ b/linux-rust/src/devices/enums.rs
@@ -53,14 +53,13 @@ impl Display for DeviceState {
pub struct AirPodsState {
pub device_name: String,
pub noise_control_mode: AirPodsNoiseControlMode,
- pub noise_control_state: combo_box::State,
pub conversation_awareness_enabled: bool,
pub personalized_volume_enabled: bool,
pub allow_off_mode: bool,
pub battery: Vec,
}
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, PartialEq, Eq)]
pub enum AirPodsNoiseControlMode {
Off,
NoiseCancellation,
@@ -80,13 +79,13 @@ impl Display for AirPodsNoiseControlMode {
}
impl AirPodsNoiseControlMode {
- pub fn from_byte(value: &u8) -> Self {
+ pub fn from_byte(value: u8) -> Option {
match value {
- 0x01 => AirPodsNoiseControlMode::Off,
- 0x02 => AirPodsNoiseControlMode::NoiseCancellation,
- 0x03 => AirPodsNoiseControlMode::Transparency,
- 0x04 => AirPodsNoiseControlMode::Adaptive,
- _ => AirPodsNoiseControlMode::Off,
+ 0x01 => Some(AirPodsNoiseControlMode::Off),
+ 0x02 => Some(AirPodsNoiseControlMode::NoiseCancellation),
+ 0x03 => Some(AirPodsNoiseControlMode::Transparency),
+ 0x04 => Some(AirPodsNoiseControlMode::Adaptive),
+ _ => None,
}
}
pub fn to_byte(&self) -> u8 {
diff --git a/linux-rust/src/main.rs b/linux-rust/src/main.rs
index c4e9eeedd..a64d5c69e 100644
--- a/linux-rust/src/main.rs
+++ b/linux-rust/src/main.rs
@@ -19,7 +19,7 @@ use dbus::blocking::stdintf::org_freedesktop_dbus::Properties;
use dbus::message::MatchRule;
use devices::airpods::AirPodsDevice;
use ksni::TrayMethods;
-use log::{info, warn};
+use log::{error, info, warn};
use std::collections::HashMap;
use std::env;
use std::sync::atomic::{AtomicBool};
@@ -162,8 +162,17 @@ async fn async_main(
command_tx: None,
ui_tx: Some(ui_tx.clone()),
};
- let handle = tray.spawn().await.unwrap();
- Some(handle)
+ match tray.spawn().await {
+ Ok(handle) => Some(handle),
+ Err(err) => {
+ let message = "LibrePods could not start a system tray icon because no StatusNotifier/AppIndicator tray is available. The app will continue without a tray icon. Add a tray to your desktop environment or launch with --no-tray to suppress this warning.".to_string();
+ error!("{} ksni error: {}", message, err);
+ if let Err(send_err) = ui_tx.send(BluetoothUIMessage::TrayUnavailable(message)) {
+ warn!("Failed to send tray-unavailable UI message: {:?}", send_err);
+ }
+ None
+ }
+ }
};
let session = bluer::Session::new().await?;
diff --git a/linux-rust/src/ui/airpods.rs b/linux-rust/src/ui/airpods.rs
index 9335b5e05..cda44317d 100644
--- a/linux-rust/src/ui/airpods.rs
+++ b/linux-rust/src/ui/airpods.rs
@@ -1,11 +1,10 @@
use crate::bluetooth::aacp::{AACPManager, ControlCommandIdentifiers};
use iced::Alignment::End;
use iced::border::Radius;
-use iced::overlay::menu;
use iced::widget::button::Style;
use iced::widget::rule::FillMode;
use iced::widget::{
- Space, button, column, combo_box, container, row, rule, text, text_input, toggler,
+ Space, button, column, container, pick_list, row, rule, text, text_input, toggler,
};
use iced::{Background, Border, Center, Color, Length, Padding, Theme};
use log::error;
@@ -103,43 +102,53 @@ pub fn airpods_view<'a>(
{
let state_clone = state.clone();
let mac = mac.clone();
- // this combo_box doesn't go really well with the design, but I am not writing my own dropdown menu for this
- combo_box(
- &state.noise_control_state,
- "Select Listening Mode",
- Some(&state.noise_control_mode.clone()),
- {
+ let listening_mode_options = if state.allow_off_mode {
+ vec![
+ crate::devices::enums::AirPodsNoiseControlMode::Off,
+ crate::devices::enums::AirPodsNoiseControlMode::NoiseCancellation,
+ crate::devices::enums::AirPodsNoiseControlMode::Transparency,
+ crate::devices::enums::AirPodsNoiseControlMode::Adaptive,
+ ]
+ } else {
+ vec![
+ crate::devices::enums::AirPodsNoiseControlMode::NoiseCancellation,
+ crate::devices::enums::AirPodsNoiseControlMode::Transparency,
+ crate::devices::enums::AirPodsNoiseControlMode::Adaptive,
+ ]
+ };
+ let selected_mode = listening_mode_options
+ .iter()
+ .find(|mode| **mode == state.noise_control_mode)
+ .cloned();
+ container(pick_list(listening_mode_options, selected_mode, {
+ let aacp_manager = aacp_manager.clone();
+ move |selected_mode| {
let aacp_manager = aacp_manager.clone();
- move |selected_mode| {
- let aacp_manager = aacp_manager.clone();
- let selected_mode_c = selected_mode.clone();
- run_async_in_thread(async move {
- aacp_manager
- .send_control_command(
- ControlCommandIdentifiers::ListeningMode,
- &[selected_mode_c.to_byte()],
- )
- .await
- .expect("Failed to send Noise Control Mode command");
- });
- let mut state = state_clone.clone();
- state.noise_control_mode = selected_mode.clone();
- Message::StateChanged(mac.to_string(), DeviceState::AirPods(state))
- }
- },
- )
+ let selected_mode_c = selected_mode.clone();
+ run_async_in_thread(async move {
+ aacp_manager
+ .send_control_command(
+ ControlCommandIdentifiers::ListeningMode,
+ &[selected_mode_c.to_byte()],
+ )
+ .await
+ .expect("Failed to send Noise Control Mode command");
+ });
+ let mut state = state_clone.clone();
+ state.noise_control_mode = selected_mode.clone();
+ Message::StateChanged(mac.to_string(), DeviceState::AirPods(state))
+ }
+ }))
.width(Length::from(200))
- .input_style(|theme: &Theme, _status| text_input::Style {
- background: Background::Color(theme.palette().primary.scale_alpha(0.2)),
- border: Border {
+ .style(|theme: &Theme| {
+ let mut style = container::Style::default();
+ style.background = Some(Background::Color(theme.palette().primary.scale_alpha(0.2)));
+ style.border = Border {
width: 1.0,
color: theme.palette().text.scale_alpha(0.3),
radius: Radius::from(4.0),
- },
- icon: Default::default(),
- placeholder: theme.palette().text,
- value: theme.palette().text,
- selection: Default::default(),
+ };
+ style
})
.padding(Padding {
top: 5.0,
@@ -147,20 +156,6 @@ pub fn airpods_view<'a>(
left: 10.0,
right: 10.0,
})
- .menu_style(|theme: &Theme| menu::Style {
- background: Background::Color(theme.palette().background),
- border: Border {
- width: 1.0,
- color: theme.palette().text,
- radius: Radius::from(4.0),
- },
- text_color: theme.palette().text,
- selected_text_color: theme.palette().text,
- selected_background: Background::Color(
- theme.palette().primary.scale_alpha(0.3),
- ),
- shadow: Default::default()
- })
}
]
.align_y(Center),
diff --git a/linux-rust/src/ui/messages.rs b/linux-rust/src/ui/messages.rs
index c72aeb9c6..a2e5661d6 100644
--- a/linux-rust/src/ui/messages.rs
+++ b/linux-rust/src/ui/messages.rs
@@ -3,6 +3,7 @@ use crate::bluetooth::aacp::AACPEvent;
#[derive(Debug, Clone)]
pub enum BluetoothUIMessage {
OpenWindow,
+ TrayUnavailable(String),
DeviceConnected(String), // mac
DeviceDisconnected(String), // mac
AACPUIEvent(String, AACPEvent), // mac, event
diff --git a/linux-rust/src/ui/tray.rs b/linux-rust/src/ui/tray.rs
index b3adbc53a..2eedec238 100644
--- a/linux-rust/src/ui/tray.rs
+++ b/linux-rust/src/ui/tray.rs
@@ -81,17 +81,14 @@ impl ksni::Tray for MyTray {
fn tool_tip(&self) -> ToolTip {
let format_component =
|label: &str, level: Option, status: Option| -> String {
- match status {
- Some(BatteryStatus::Disconnected) => format!("{}: -", label),
- _ => {
- let pct = level.map(|b| format!("{}%", b)).unwrap_or("?".to_string());
- let suffix = if status == Some(BatteryStatus::Charging) {
- "⚡"
- } else {
- ""
- };
- format!("{}: {}{}", label, pct, suffix)
+ match (level, status) {
+ (Some(0), Some(BatteryStatus::Disconnected)) | (None, _) => {
+ format!("{}: -", label)
}
+ (Some(level), Some(BatteryStatus::Charging)) => {
+ format!("{}: {}%⚡", label, level)
+ }
+ (Some(level), _) => format!("{}: {}%", label, level),
}
};
diff --git a/linux-rust/src/ui/window.rs b/linux-rust/src/ui/window.rs
index 879f6f763..247afb400 100644
--- a/linux-rust/src/ui/window.rs
+++ b/linux-rust/src/ui/window.rs
@@ -61,6 +61,7 @@ pub fn start_ui(
pub struct App {
window: Option,
+ startup_warning: Option,
panes: pane_grid::State,
selected_tab: Tab,
theme_state: combo_box::State,
@@ -174,6 +175,7 @@ impl App {
(
Self {
window,
+ startup_warning: None,
panes,
selected_tab: Tab::Device("none".to_string()),
theme_state: combo_box::State::new(vec![
@@ -279,6 +281,22 @@ impl App {
Task::batch(vec![open_task.map(Message::WindowOpened), wait_task])
}
}
+ BluetoothUIMessage::TrayUnavailable(message) => {
+ let ui_rx = Arc::clone(&self.ui_rx);
+ let wait_task = Task::perform(wait_for_message(ui_rx), |msg| msg);
+ self.startup_warning = Some(message);
+
+ if let Some(window_id) = self.window {
+ Task::batch(vec![window::gain_focus(window_id), wait_task])
+ } else {
+ let mut settings = window::Settings::default();
+ settings.min_size = Some(Size::new(400.0, 300.0));
+ settings.icon = window::icon::from_file("../../assets/icon.png").ok();
+ let (new_window_task, open_task) = window::open(settings);
+ self.window = Some(new_window_task);
+ Task::batch(vec![open_task.map(Message::WindowOpened), wait_task])
+ }
+ }
BluetoothUIMessage::DeviceConnected(mac) => {
let ui_rx = Arc::clone(&self.ui_rx);
let wait_task = Task::perform(wait_for_message(ui_rx), |msg| msg);
@@ -343,27 +361,14 @@ impl App {
battery: state.battery_info.clone(),
noise_control_mode: state.control_command_status_list.iter().find_map(|status| {
if status.identifier == ControlCommandIdentifiers::ListeningMode {
- status.value.first().map(AirPodsNoiseControlMode::from_byte)
+ status
+ .value
+ .first()
+ .and_then(|value| AirPodsNoiseControlMode::from_byte(*value))
} else {
None
}
}).unwrap_or(AirPodsNoiseControlMode::Transparency),
- noise_control_state: combo_box::State::new(
- {
- let mut modes = vec![
- AirPodsNoiseControlMode::Transparency,
- AirPodsNoiseControlMode::NoiseCancellation,
- AirPodsNoiseControlMode::Adaptive
- ];
- if state.control_command_status_list.iter().any(|status| {
- status.identifier == ControlCommandIdentifiers::AllowOffOption &&
- matches!(status.value.as_slice(), [0x01])
- }) {
- modes.insert(0, AirPodsNoiseControlMode::Off);
- }
- modes
- }
- ),
conversation_awareness_enabled: state.control_command_status_list.iter().any(|status| {
status.identifier == ControlCommandIdentifiers::ConversationDetectConfig &&
matches!(status.value.as_slice(), [0x01])
@@ -414,15 +419,18 @@ impl App {
match event {
AACPEvent::ControlCommand(status) => match status.identifier {
ControlCommandIdentifiers::ListeningMode => {
- let mode = status
+ if let Some(mode) = status
.value
.first()
- .map(AirPodsNoiseControlMode::from_byte)
- .unwrap_or(AirPodsNoiseControlMode::Transparency);
- if let Some(DeviceState::AirPods(state)) =
- self.device_states.get_mut(&mac)
+ .and_then(|value| AirPodsNoiseControlMode::from_byte(*value))
{
- state.noise_control_mode = mode;
+ if let Some(DeviceState::AirPods(state)) =
+ self.device_states.get_mut(&mac)
+ {
+ state.noise_control_mode = mode;
+ }
+ } else {
+ error!("Unknown Listening Mode value: {:?}", status.value);
}
}
ControlCommandIdentifiers::ConversationDetectConfig => {
@@ -477,17 +485,6 @@ impl App {
self.device_states.get_mut(&mac)
{
state.allow_off_mode = is_enabled;
- state.noise_control_state = combo_box::State::new({
- let mut modes = vec![
- AirPodsNoiseControlMode::Transparency,
- AirPodsNoiseControlMode::NoiseCancellation,
- AirPodsNoiseControlMode::Adaptive,
- ];
- if is_enabled {
- modes.insert(0, AirPodsNoiseControlMode::Off);
- }
- modes
- });
}
}
_ => {
@@ -577,36 +574,7 @@ impl App {
Task::none()
}
Message::StateChanged(mac, state) => {
- self.device_states.insert(mac.clone(), state);
- // if airpods, update the noise control state combo box based on allow off mode
- let type_ = {
- let devices_json =
- std::fs::read_to_string(get_devices_path()).unwrap_or_else(|e| {
- error!("Failed to read devices file: {}", e);
- "{}".to_string()
- });
- let devices_list: HashMap =
- serde_json::from_str(&devices_json).unwrap_or_else(|e| {
- error!("Deserialization failed: {}", e);
- HashMap::new()
- });
- devices_list.get(&mac).map(|d| d.type_.clone())
- };
- if let Some(DeviceType::AirPods) = type_
- && let Some(DeviceState::AirPods(state)) = self.device_states.get_mut(&mac)
- {
- state.noise_control_state = combo_box::State::new({
- let mut modes = vec![
- AirPodsNoiseControlMode::Transparency,
- AirPodsNoiseControlMode::NoiseCancellation,
- AirPodsNoiseControlMode::Adaptive,
- ];
- if state.allow_off_mode {
- modes.insert(0, AirPodsNoiseControlMode::Off);
- }
- modes
- });
- }
+ self.device_states.insert(mac, state);
Task::none()
}
Message::TrayTextModeChanged(is_enabled) => {
@@ -673,7 +641,15 @@ impl App {
Some(DeviceState::AirPods(state)) => {
let b = &state.battery;
let headphone = b.iter().find(|x| x.component == BatteryComponent::Headphone)
+ .filter(|x| !(x.status == BatteryStatus::Disconnected && x.level == 0))
.map(|x| x.level);
+ let format_battery = |battery: Option<&crate::bluetooth::aacp::BatteryInfo>| {
+ match battery {
+ Some(info) if info.status == BatteryStatus::Disconnected && info.level == 0 => "-".to_string(),
+ Some(info) => format!("{}%", info.level),
+ None => "-".to_string(),
+ }
+ };
// if headphones is not None, use only that
if let Some(level) = headphone {
let charging = b.iter().find(|x| x.component == BatteryComponent::Headphone)
@@ -683,20 +659,20 @@ impl App {
level, if charging {"\u{1002E6}"} else {""}
)
} else {
- let left = b.iter().find(|x| x.component == BatteryComponent::Left)
- .map(|x| x.level).unwrap_or_default();
- let right = b.iter().find(|x| x.component == BatteryComponent::Right)
- .map(|x| x.level).unwrap_or_default();
- let case = b.iter().find(|x| x.component == BatteryComponent::Case)
- .map(|x| x.level).unwrap_or_default();
- let left_charging = b.iter().find(|x| x.component == BatteryComponent::Left)
+ let left_info = b.iter().find(|x| x.component == BatteryComponent::Left);
+ let right_info = b.iter().find(|x| x.component == BatteryComponent::Right);
+ let case_info = b.iter().find(|x| x.component == BatteryComponent::Case);
+ let left = format_battery(left_info);
+ let right = format_battery(right_info);
+ let case = format_battery(case_info);
+ let left_charging = left_info
.map(|x| x.status == BatteryStatus::Charging).unwrap_or(false);
- let right_charging = b.iter().find(|x| x.component == BatteryComponent::Right)
+ let right_charging = right_info
.map(|x| x.status == BatteryStatus::Charging).unwrap_or(false);
- let case_charging = b.iter().find(|x| x.component == BatteryComponent::Case)
+ let case_charging = case_info
.map(|x| x.status == BatteryStatus::Charging).unwrap_or(false);
format!(
- "\u{1018E5} {}%{} \u{1018E8} {}%{} \u{100E6C} {}%{}",
+ "\u{1018E5} {}{} \u{1018E8} {}{} \u{100E6C} {}{}",
left, if left_charging {"\u{1002E6}"} else {""}, right, if right_charging {"\u{1002E6}"} else {""}, case, if case_charging {"\u{1002E6}"} else {""}
)
}
@@ -1278,7 +1254,43 @@ impl App {
.height(Length::Fill)
.on_resize(20, Message::Resized);
- container(pane_grid).into()
+ let content: Element<'_, Message> = if let Some(warning) = &self.startup_warning {
+ column![
+ container(
+ row![
+ text("Tray unavailable").size(16),
+ Space::new().width(Length::from(12)),
+ text(warning).size(13).width(Length::Fill)
+ ]
+ .align_y(Center)
+ )
+ .padding(Padding {
+ top: 12.0,
+ bottom: 12.0,
+ left: 16.0,
+ right: 16.0,
+ })
+ .style(|theme: &Theme| {
+ let mut style = container::Style::default();
+ style.background =
+ Some(Background::Color(theme.palette().danger.scale_alpha(0.15)));
+ style.text_color = Some(theme.palette().text);
+ style.border = Border {
+ width: 1.0,
+ color: theme.palette().danger.scale_alpha(0.5),
+ radius: Radius::from(12.0),
+ };
+ style
+ }),
+ pane_grid
+ ]
+ .spacing(12)
+ .into()
+ } else {
+ pane_grid.into()
+ };
+
+ container(content).into()
}
fn theme(&self, _id: window::Id) -> Theme {
diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt
index 4f73b8dc2..43051ce69 100644
--- a/linux/CMakeLists.txt
+++ b/linux/CMakeLists.txt
@@ -4,13 +4,18 @@ project(linux VERSION 0.1 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-find_package(Qt6 REQUIRED COMPONENTS Quick Widgets Bluetooth DBus)
+find_package(Qt6 REQUIRED COMPONENTS Quick Widgets Bluetooth DBus LinguistTools)
find_package(OpenSSL REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PULSEAUDIO REQUIRED libpulse)
qt_standard_project_setup()
+# Translation files
+set(TS_FILES
+ translations/librepods_tr.ts
+)
+
qt_add_executable(librepods
main.cpp
logger.h
@@ -73,6 +78,16 @@ target_link_libraries(librepods
PRIVATE Qt6::Quick Qt6::Widgets Qt6::Bluetooth Qt6::DBus OpenSSL::SSL OpenSSL::Crypto ${PULSEAUDIO_LIBRARIES}
)
+qt_add_executable(librepods-ctl
+ librepods-ctl.cpp
+)
+target_link_libraries(librepods-ctl
+ PRIVATE Qt6::Core Qt6::Network
+)
+install(TARGETS librepods-ctl
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
+
target_include_directories(librepods PRIVATE ${PULSEAUDIO_INCLUDE_DIRS})
include(GNUInstallDirs)
@@ -83,3 +98,15 @@ install(TARGETS librepods
)
install(FILES assets/me.kavishdevar.librepods.desktop
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
+install(FILES assets/librepods.svg
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps")
+
+# Translation support
+qt_add_translations(librepods
+ TS_FILES ${TS_FILES}
+ QM_FILES_OUTPUT_VARIABLE QM_FILES
+)
+
+# Install translation files
+install(FILES ${QM_FILES}
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/librepods/translations")
diff --git a/linux/Main.qml b/linux/Main.qml
index 983a2a5a5..c7b235c33 100644
--- a/linux/Main.qml
+++ b/linux/Main.qml
@@ -81,7 +81,7 @@ ApplicationWindow {
Label {
anchors.centerIn: parent
- text: airPodsTrayApp.airpodsConnected ? "Connected" : "Disconnected"
+ text: airPodsTrayApp.airpodsConnected ? qsTr("Connected") : qsTr("Disconnected")
color: "white"
font.pixelSize: 12
font.weight: Font.Medium
@@ -118,11 +118,19 @@ ApplicationWindow {
batteryLevel: airPodsTrayApp.deviceInfo.battery.caseLevel
isCharging: airPodsTrayApp.deviceInfo.battery.caseCharging
}
+
+ PodColumn {
+ visible: airPodsTrayApp.deviceInfo.battery.headsetAvailable
+ inEar: true
+ iconSource: "qrc:/icons/assets/" + airPodsTrayApp.deviceInfo.podIcon
+ batteryLevel: airPodsTrayApp.deviceInfo.battery.headsetLevel
+ isCharging: airPodsTrayApp.deviceInfo.battery.headsetCharging
+ }
}
SegmentedControl {
anchors.horizontalCenter: parent.horizontalCenter
- model: ["Off", "Noise Cancellation", "Transparency", "Adaptive"]
+ model: [qsTr("Off"), qsTr("Noise Cancellation"), qsTr("Transparency"), qsTr("Adaptive")]
currentIndex: airPodsTrayApp.deviceInfo.noiseControlMode
onCurrentIndexChanged: airPodsTrayApp.setNoiseControlModeInt(currentIndex)
visible: airPodsTrayApp.airpodsConnected
@@ -145,21 +153,21 @@ ApplicationWindow {
onValueChanged: if (pressed) debounceTimer.restart()
Label {
- text: "Adaptive Noise Level: " + parent.value
+ text: qsTr("Adaptive Noise Level: ") + parent.value
anchors.top: parent.bottom
}
}
Switch {
visible: airPodsTrayApp.airpodsConnected
- text: "Conversational Awareness"
+ text: qsTr("Conversational Awareness")
checked: airPodsTrayApp.deviceInfo.conversationalAwareness
onCheckedChanged: airPodsTrayApp.setConversationalAwareness(checked)
}
Switch {
visible: airPodsTrayApp.airpodsConnected
- text: "Hearing Aid"
+ text: qsTr("Hearing Aid")
checked: airPodsTrayApp.deviceInfo.hearingAidEnabled
onCheckedChanged: airPodsTrayApp.setHearingAidEnabled(checked)
}
@@ -181,7 +189,7 @@ ApplicationWindow {
id: settingsPage
Page {
id: settingsPageItem
- title: "Settings"
+ title: qsTr("Settings")
ScrollView {
anchors.fill: parent
@@ -192,7 +200,7 @@ ApplicationWindow {
padding: 20
Label {
- text: "Settings"
+ text: qsTr("Settings")
font.pixelSize: 24
// center the label
anchors.horizontalCenter: parent.horizontalCenter
@@ -202,19 +210,19 @@ ApplicationWindow {
spacing: 5 // Small gap between label and ComboBox
Label {
- text: "Pause Behavior When Removing AirPods:"
+ text: qsTr("Pause Behavior When Removing AirPods:")
}
ComboBox {
width: parent.width // Ensures full width
- model: ["One Removed", "Both Removed", "Never"]
+ model: [qsTr("One Removed"), qsTr("Both Removed"), qsTr("Never")]
currentIndex: airPodsTrayApp.earDetectionBehavior
onActivated: airPodsTrayApp.earDetectionBehavior = currentIndex
}
}
Switch {
- text: "Cross-Device Connectivity with Android"
+ text: qsTr("Cross-Device Connectivity with Android")
checked: airPodsTrayApp.crossDeviceEnabled
onCheckedChanged: {
airPodsTrayApp.setCrossDeviceEnabled(checked)
@@ -222,26 +230,26 @@ ApplicationWindow {
}
Switch {
- text: "Auto-Start on Login"
+ text: qsTr("Auto-Start on Login")
checked: airPodsTrayApp.autoStartManager.autoStartEnabled
onCheckedChanged: airPodsTrayApp.autoStartManager.autoStartEnabled = checked
}
Switch {
- text: "Enable System Notifications"
+ text: qsTr("Enable System Notifications")
checked: airPodsTrayApp.notificationsEnabled
onCheckedChanged: airPodsTrayApp.notificationsEnabled = checked
}
Switch {
visible: airPodsTrayApp.airpodsConnected
- text: "One Bud ANC Mode"
+ text: qsTr("One Bud ANC Mode")
checked: airPodsTrayApp.deviceInfo.oneBudANCMode
onCheckedChanged: airPodsTrayApp.deviceInfo.oneBudANCMode = checked
ToolTip {
visible: parent.hovered
- text: "Enable ANC when using one AirPod\n(More noise reduction, but uses more battery)"
+ text: qsTr("Enable ANC when using one AirPod\n(More noise reduction, but uses more battery)")
delay: 500
}
}
@@ -249,7 +257,7 @@ ApplicationWindow {
Row {
spacing: 5
Label {
- text: "Bluetooth Retry Attempts:"
+ text: qsTr("Bluetooth Retry Attempts:")
anchors.verticalCenter: parent.verticalCenter
}
SpinBox {
@@ -271,7 +279,7 @@ ApplicationWindow {
}
Button {
- text: "Rename"
+ text: qsTr("Rename")
onClicked: airPodsTrayApp.renameAirPods(newNameField.text)
}
}
@@ -287,14 +295,14 @@ ApplicationWindow {
}
Button {
- text: "Change Phone MAC"
+ text: qsTr("Change Phone MAC")
onClicked: airPodsTrayApp.setPhoneMac(newPhoneMacField.text)
}
}
Button {
- text: "Show Magic Cloud Keys QR"
+ text: qsTr("Show Magic Cloud Keys QR")
onClicked: keysQrDialog.show()
}
@@ -318,4 +326,4 @@ ApplicationWindow {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/linux/README.md b/linux/README.md
index 742d99115..b86c22aef 100644
--- a/linux/README.md
+++ b/linux/README.md
@@ -1,5 +1,7 @@
# LibrePods Linux
+
+
A native Linux application to control your AirPods, with support for:
- Noise Control modes (Off, Transparency, Adaptive, Noise Cancellation)
@@ -41,6 +43,31 @@ A native Linux application to control your AirPods, with support for:
# For Fedora
sudo dnf install openssl-devel
```
+4. Libpulse development headers
+
+ ```bash
+ # On Arch Linux / EndevaourOS, these are included in the libpulse package, so you might already have them installed.
+ sudo pacman -S libpulse
+
+ # For Debian / Ubuntu
+ sudo apt-get install libpulse-dev
+
+ # For Fedora
+ sudo dnf install pulseaudio-libs-devel
+ ```
+5. Cmake
+
+ ```bash
+ # For Arch Linux / EndeavourOS
+ sudo pacman -S cmake
+
+ # For Debian / Ubuntu
+ sudo apt-get install cmake
+
+ # For Fedora
+ sudo dnf install cmake
+ ```
+
## Setup
1. Build the application:
@@ -82,7 +109,8 @@ Then restart WirePlumber:
systemctl --user restart wireplumber
```
-**Note:** Do NOT run `mpris-proxy` with WirePlumber - it will conflict and break media controls.
+> [!WARNING]
+> Do NOT run `mpris-proxy` with WirePlumber - it will conflict and break media controls.
#### PulseAudio
@@ -101,6 +129,35 @@ systemctl --user enable --now mpris-proxy
- View battery levels
- Control playback
+
+## CLI Control
+
+`librepods-ctl` is a small command-line tool that lets you access LibrePods from the terminal or via scripts, as long as the main application is running.
+
+### Usage
+```bash
+librepods-ctl
+```
+
+### Commands
+
+| Command | Description |
+|---|---|
+| `noise:off` | Disable noise control |
+| `noise:anc` | Enable Active Noise Cancellation |
+| `noise:transparency` | Enable Transparency mode |
+| `noise:adaptive` | Enable Adaptive mode |
+
+### Example
+```bash
+# Enable ANC
+librepods-ctl noise:anc
+
+# Enable Transparency mode
+librepods-ctl noise:transparency
+```
+
+
## Hearing Aid
To use hearing aid features, you need to have an audiogram. To enable/disable hearing aid, you can use the toggle in the main app. But, to adjust the settings and set the audiogram, you need to use a different script which is located in this folder as `hearing_aid.py`. You can run it with:
@@ -131,4 +188,4 @@ It is possible that the AirPods disconnect after a short period of time and play
### Why a separate script?
-Because I discovered that QBluetooth doesn't support connecting to a socket with its PSM, only a UUID can be used. I could add a dependency on BlueZ, but then having two bluetooth interfaces seems unnecessary. So, I decided to use a separate script for hearing aid features. In the future, QBluetooth will be replaced with BlueZ native calls, and then everything will be in one application.
\ No newline at end of file
+Because I discovered that QBluetooth doesn't support connecting to a socket with its PSM, only a UUID can be used. I could add a dependency on BlueZ, but then having two bluetooth interfaces seems unnecessary. So, I decided to use a separate script for hearing aid features. In the future, QBluetooth will be replaced with BlueZ native calls, and then everything will be in one application.
diff --git a/linux/airpods_packets.h b/linux/airpods_packets.h
index 52662723f..94153a484 100644
--- a/linux/airpods_packets.h
+++ b/linux/airpods_packets.h
@@ -113,24 +113,24 @@ namespace AirPodsPackets
static const QByteArray HEADER = ControlCommand::HEADER + static_cast(0x2C);
static const QByteArray ENABLED = ControlCommand::createCommand(0x2C, 0x01, 0x01);
static const QByteArray DISABLED = ControlCommand::createCommand(0x2C, 0x02, 0x02);
-
+
inline std::optional parseState(const QByteArray &data)
{
if (!data.startsWith(HEADER) || data.size() < HEADER.size() + 2)
return std::nullopt;
-
+
QByteArray value = data.mid(HEADER.size(), 2);
if (value.size() != 2)
return std::nullopt;
-
+
char b1 = value.at(0);
char b2 = value.at(1);
-
+
if (b1 == 0x01 && b2 == 0x01)
return true;
if (b1 == 0x02 || b2 == 0x02)
return false;
-
+
return std::nullopt;
}
}
diff --git a/linux/assets/librepods.svg b/linux/assets/librepods.svg
new file mode 100644
index 000000000..d43867248
--- /dev/null
+++ b/linux/assets/librepods.svg
@@ -0,0 +1,35 @@
+
diff --git a/linux/battery.hpp b/linux/battery.hpp
index 99119e4ad..63f30e009 100644
--- a/linux/battery.hpp
+++ b/linux/battery.hpp
@@ -19,6 +19,9 @@ class Battery : public QObject
Q_PROPERTY(quint8 rightPodLevel READ getRightPodLevel NOTIFY batteryStatusChanged)
Q_PROPERTY(bool rightPodCharging READ isRightPodCharging NOTIFY batteryStatusChanged)
Q_PROPERTY(bool rightPodAvailable READ isRightPodAvailable NOTIFY batteryStatusChanged)
+ Q_PROPERTY(quint8 headsetLevel READ getHeadsetLevel NOTIFY batteryStatusChanged)
+ Q_PROPERTY(bool headsetCharging READ isHeadsetCharging NOTIFY batteryStatusChanged)
+ Q_PROPERTY(bool headsetAvailable READ isHeadsetAvailable NOTIFY batteryStatusChanged)
Q_PROPERTY(quint8 caseLevel READ getCaseLevel NOTIFY batteryStatusChanged)
Q_PROPERTY(bool caseCharging READ isCaseCharging NOTIFY batteryStatusChanged)
Q_PROPERTY(bool caseAvailable READ isCaseAvailable NOTIFY batteryStatusChanged)
@@ -32,6 +35,7 @@ class Battery : public QObject
void reset()
{
// Initialize all components to unknown state
+ states[Component::Headset] = {};
states[Component::Left] = {};
states[Component::Right] = {};
states[Component::Case] = {};
@@ -41,6 +45,7 @@ class Battery : public QObject
// Enum for AirPods components
enum class Component
{
+ Headset = 0x01, // AirPods Max
Right = 0x02,
Left = 0x04,
Case = 0x08,
@@ -105,7 +110,7 @@ class Battery : public QObject
}
// If this is a pod (Left or Right), add it to the list
- if (comp == Component::Left || comp == Component::Right)
+ if (comp == Component::Left || comp == Component::Right || comp == Component::Headset)
{
podsInPacket.append(comp);
}
@@ -117,11 +122,17 @@ class Battery : public QObject
// Set primary and secondary pods based on order
if (!podsInPacket.isEmpty())
{
- Component newPrimaryPod = podsInPacket[0]; // First pod is primary
- if (newPrimaryPod != primaryPod)
- {
- primaryPod = newPrimaryPod;
+ if (podsInPacket.count() == 1 && podsInPacket[0] == Component::Headset) {
+ // AirPods Max
+ primaryPod = podsInPacket[0];
emit primaryChanged();
+ } else {
+ Component newPrimaryPod = podsInPacket[0]; // First pod is primary
+ if (newPrimaryPod != primaryPod)
+ {
+ primaryPod = newPrimaryPod;
+ emit primaryChanged();
+ }
}
}
if (podsInPacket.size() >= 2)
@@ -132,14 +143,18 @@ class Battery : public QObject
// Emit signal to notify about battery status change
emit batteryStatusChanged();
- // Log which is left and right pod
- LOG_INFO("Primary Pod:" << primaryPod);
- LOG_INFO("Secondary Pod:" << secondaryPod);
+ if (primaryPod == Component::Headset) {
+ LOG_INFO("Primary Pod:" << primaryPod);
+ } else {
+ // Log which is left and right pod
+ LOG_INFO("Primary Pod:" << primaryPod);
+ LOG_INFO("Secondary Pod:" << secondaryPod);
+ }
return true;
}
- bool parseEncryptedPacket(const QByteArray &packet, bool isLeftPodPrimary, bool podInCase)
+ bool parseEncryptedPacket(const QByteArray &packet, bool isLeftPodPrimary, bool podInCase, bool isHeadset)
{
// Validate packet size (expect 16 bytes based on provided payloads)
if (packet.size() != 16)
@@ -160,30 +175,42 @@ class Battery : public QObject
auto [isLeftCharging, rawLeftBattery] = formatBattery(rawLeftBatteryByte);
auto [isRightCharging, rawRightBattery] = formatBattery(rawRightBatteryByte);
auto [isCaseCharging, rawCaseBattery] = formatBattery(rawCaseBatteryByte);
+ if (isHeadset) {
+ int batteries[] = {rawLeftBattery, rawRightBattery, rawCaseBattery};
+ bool statuses[] = {isLeftCharging, isRightCharging, isCaseCharging};
+ // Find the first battery that isn't CHAR_MAX
+ auto it = std::find_if(std::begin(batteries), std::end(batteries), [](int i) { return i != CHAR_MAX; });
+ if (it != std::end(batteries)) {
+ std::size_t idx = it - std::begin(batteries);
+ int battery = *it;
+ primaryPod = Component::Headset;
+ states[Component::Headset] = {static_cast(battery), statuses[idx] ? BatteryStatus::Charging : BatteryStatus::Discharging};
+ }
+ } else {
+ if (rawLeftBattery == CHAR_MAX) {
+ rawLeftBattery = states.value(Component::Left).level; // Use last valid level
+ isLeftCharging = states.value(Component::Left).status == BatteryStatus::Charging;
+ }
- if (rawLeftBattery == CHAR_MAX) {
- rawLeftBattery = states.value(Component::Left).level; // Use last valid level
- isLeftCharging = states.value(Component::Left).status == BatteryStatus::Charging;
- }
-
- if (rawRightBattery == CHAR_MAX) {
- rawRightBattery = states.value(Component::Right).level; // Use last valid level
- isRightCharging = states.value(Component::Right).status == BatteryStatus::Charging;
- }
+ if (rawRightBattery == CHAR_MAX) {
+ rawRightBattery = states.value(Component::Right).level; // Use last valid level
+ isRightCharging = states.value(Component::Right).status == BatteryStatus::Charging;
+ }
- if (rawCaseBattery == CHAR_MAX) {
- rawCaseBattery = states.value(Component::Case).level; // Use last valid level
- isCaseCharging = states.value(Component::Case).status == BatteryStatus::Charging;
- }
+ if (rawCaseBattery == CHAR_MAX) {
+ rawCaseBattery = states.value(Component::Case).level; // Use last valid level
+ isCaseCharging = states.value(Component::Case).status == BatteryStatus::Charging;
+ }
- // Update states
- states[Component::Left] = {static_cast(rawLeftBattery), isLeftCharging ? BatteryStatus::Charging : BatteryStatus::Discharging};
- states[Component::Right] = {static_cast(rawRightBattery), isRightCharging ? BatteryStatus::Charging : BatteryStatus::Discharging};
- if (podInCase) {
- states[Component::Case] = {static_cast(rawCaseBattery), isCaseCharging ? BatteryStatus::Charging : BatteryStatus::Discharging};
+ // Update states
+ states[Component::Left] = {static_cast(rawLeftBattery), isLeftCharging ? BatteryStatus::Charging : BatteryStatus::Discharging};
+ states[Component::Right] = {static_cast(rawRightBattery), isRightCharging ? BatteryStatus::Charging : BatteryStatus::Discharging};
+ if (podInCase) {
+ states[Component::Case] = {static_cast(rawCaseBattery), isCaseCharging ? BatteryStatus::Charging : BatteryStatus::Discharging};
+ }
+ primaryPod = isLeftPodPrimary ? Component::Left : Component::Right;
+ secondaryPod = isLeftPodPrimary ? Component::Right : Component::Left;
}
- primaryPod = isLeftPodPrimary ? Component::Left : Component::Right;
- secondaryPod = isLeftPodPrimary ? Component::Right : Component::Left;
emit batteryStatusChanged();
emit primaryChanged();
@@ -236,6 +263,9 @@ class Battery : public QObject
quint8 getCaseLevel() const { return states.value(Component::Case).level; }
bool isCaseCharging() const { return isStatus(Component::Case, BatteryStatus::Charging); }
bool isCaseAvailable() const { return !isStatus(Component::Case, BatteryStatus::Disconnected); }
+ quint8 getHeadsetLevel() const { return states.value(Component::Headset).level; }
+ bool isHeadsetCharging() const { return isStatus(Component::Headset, BatteryStatus::Charging); }
+ bool isHeadsetAvailable() const { return !isStatus(Component::Headset, BatteryStatus::Disconnected); }
signals:
void batteryStatusChanged();
@@ -257,4 +287,4 @@ class Battery : public QObject
QMap states;
Component primaryPod;
Component secondaryPod;
-};
\ No newline at end of file
+};
diff --git a/linux/deviceinfo.hpp b/linux/deviceinfo.hpp
index 7a4c7a0c4..a3ac8affd 100644
--- a/linux/deviceinfo.hpp
+++ b/linux/deviceinfo.hpp
@@ -197,7 +197,12 @@ class DeviceInfo : public QObject
int leftLevel = getBattery()->getState(Battery::Component::Left).level;
int rightLevel = getBattery()->getState(Battery::Component::Right).level;
int caseLevel = getBattery()->getState(Battery::Component::Case).level;
- setBatteryStatus(QString("Left: %1%, Right: %2%, Case: %3%").arg(leftLevel).arg(rightLevel).arg(caseLevel));
+ if (getBattery()->getPrimaryPod() == Battery::Component::Headset) {
+ int headsetLevel = getBattery()->getState(Battery::Component::Headset).level;
+ setBatteryStatus(QString("Headset: %1%").arg(headsetLevel));
+ } else {
+ setBatteryStatus(QString("Left: %1%, Right: %2%, Case: %3%").arg(leftLevel).arg(rightLevel).arg(caseLevel));
+ }
}
signals:
@@ -229,4 +234,4 @@ class DeviceInfo : public QObject
QString m_manufacturer;
QString m_bluetoothAddress;
EarDetection *m_earDetection;
-};
\ No newline at end of file
+};
diff --git a/linux/enums.h b/linux/enums.h
index 347e33805..815415db4 100644
--- a/linux/enums.h
+++ b/linux/enums.h
@@ -85,11 +85,23 @@ namespace AirpodsTrayApp
return {"podpro.png", "podpro_case.png"};
case AirPodsModel::AirPodsMaxLightning:
case AirPodsModel::AirPodsMaxUSBC:
- return {"max.png", "max_case.png"};
+ return {"podmax.png", "max_case.png"};
default:
return {"pod.png", "pod_case.png"}; // Default icon for unknown models
}
}
+ // TODO: Only used for parseEncryptedPacket for battery status. Is it possible to determine this
+ // from the data in the packet rather than by model? i.e number of batteries
+ inline bool isModelHeadset(AirPodsModel model) {
+ switch (model) {
+ case AirPodsModel::AirPodsMaxLightning:
+ case AirPodsModel::AirPodsMaxUSBC:
+ return true;
+ default:
+ return false;
+ }
+ }
+
}
-}
\ No newline at end of file
+}
diff --git a/linux/hearing-aid-adjustments.py b/linux/hearing-aid-adjustments.py
index 2312b8ed4..85420b12b 100644
--- a/linux/hearing-aid-adjustments.py
+++ b/linux/hearing-aid-adjustments.py
@@ -1,10 +1,13 @@
-import sys
+import logging
+import signal
import socket
import struct
+import sys
import threading
+from socket import socket as Socket
from queue import Queue
-import logging
-import signal
+from threading import Thread
+from typing import Any, Dict, List, Optional
# Configure logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
@@ -12,47 +15,47 @@
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QLabel, QSlider, QCheckBox, QPushButton, QLineEdit, QFormLayout, QGridLayout
from PyQt5.QtCore import Qt, QTimer, pyqtSignal, QObject
-OPCODE_READ_REQUEST = 0x0A
-OPCODE_WRITE_REQUEST = 0x12
-OPCODE_HANDLE_VALUE_NTF = 0x1B
+OPCODE_READ_REQUEST: int = 0x0A
+OPCODE_WRITE_REQUEST: int = 0x12
+OPCODE_HANDLE_VALUE_NTF: int = 0x1B
-ATT_HANDLES = {
+ATT_HANDLES: Dict[str, int] = {
'TRANSPARENCY': 0x18,
'LOUD_SOUND_REDUCTION': 0x1B,
'HEARING_AID': 0x2A,
}
-ATT_CCCD_HANDLES = {
+ATT_CCCD_HANDLES: Dict[str, int] = {
'TRANSPARENCY': ATT_HANDLES['TRANSPARENCY'] + 1,
'LOUD_SOUND_REDUCTION': ATT_HANDLES['LOUD_SOUND_REDUCTION'] + 1,
'HEARING_AID': ATT_HANDLES['HEARING_AID'] + 1,
}
-PSM_ATT = 31
+PSM_ATT: int = 31
class ATTManager:
- def __init__(self, mac_address):
- self.mac_address = mac_address
- self.sock = None
- self.responses = Queue()
- self.listeners = {}
- self.notification_thread = None
- self.running = False
+ def __init__(self, mac_address: str) -> None:
+ self.mac_address: str = mac_address
+ self.sock: Optional[Socket] = None
+ self.responses: Queue = Queue()
+ self.listeners: Dict[int, List[Any]] = {}
+ self.notification_thread: Optional[Thread] = None
+ self.running: bool = False
# Avoid logging full MAC address to prevent sensitive data exposure
- mac_tail = ':'.join(mac_address.split(':')[-2:]) if isinstance(mac_address, str) and ':' in mac_address else '[redacted]'
+ mac_tail: str = ':'.join(mac_address.split(':')[-2:]) if isinstance(mac_address, str) and ':' in mac_address else '[redacted]'
logging.info(f"ATTManager initialized")
- def connect(self):
+ def connect(self) -> None:
logging.info("Attempting to connect to ATT socket")
- self.sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
+ self.sock = Socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
self.sock.connect((self.mac_address, PSM_ATT))
self.sock.settimeout(0.1)
self.running = True
- self.notification_thread = threading.Thread(target=self._listen_notifications)
+ self.notification_thread = Thread(target=self._listen_notifications)
self.notification_thread.start()
logging.info("Connected to ATT socket")
- def disconnect(self):
+ def disconnect(self) -> None:
logging.info("Disconnecting from ATT socket")
self.running = False
if self.sock:
@@ -63,37 +66,37 @@ def disconnect(self):
self.notification_thread.join(timeout=1.0)
logging.info("Disconnected from ATT socket")
- def register_listener(self, handle, listener):
+ def register_listener(self, handle: int, listener: Any) -> None:
if handle not in self.listeners:
self.listeners[handle] = []
self.listeners[handle].append(listener)
logging.debug(f"Registered listener for handle {handle}")
- def unregister_listener(self, handle, listener):
+ def unregister_listener(self, handle: int, listener: Any) -> None:
if handle in self.listeners:
self.listeners[handle].remove(listener)
logging.debug(f"Unregistered listener for handle {handle}")
- def enable_notifications(self, handle):
+ def enable_notifications(self, handle: Any) -> None:
self.write_cccd(handle, b'\x01\x00')
logging.info(f"Enabled notifications for handle {handle.name}")
- def read(self, handle):
- handle_value = ATT_HANDLES[handle.name]
- lsb = handle_value & 0xFF
- msb = (handle_value >> 8) & 0xFF
- pdu = bytes([OPCODE_READ_REQUEST, lsb, msb])
+ def read(self, handle: Any) -> bytes:
+ handle_value: int = ATT_HANDLES[handle.name]
+ lsb: int = handle_value & 0xFF
+ msb: int = (handle_value >> 8) & 0xFF
+ pdu: bytes = bytes([OPCODE_READ_REQUEST, lsb, msb])
logging.debug(f"Sending read request for handle {handle.name}: {pdu.hex()}")
self._write_raw(pdu)
- response = self._read_response()
+ response: bytes = self._read_response()
logging.debug(f"Read response for handle {handle.name}: {response.hex()}")
return response
- def write(self, handle, value):
- handle_value = ATT_HANDLES[handle.name]
- lsb = handle_value & 0xFF
- msb = (handle_value >> 8) & 0xFF
- pdu = bytes([OPCODE_WRITE_REQUEST, lsb, msb]) + value
+ def write(self, handle: Any, value: bytes) -> None:
+ handle_value: int = ATT_HANDLES[handle.name]
+ lsb: int = handle_value & 0xFF
+ msb: int = (handle_value >> 8) & 0xFF
+ pdu: bytes = bytes([OPCODE_WRITE_REQUEST, lsb, msb]) + value
logging.debug(f"Sending write request for handle {handle.name}: {pdu.hex()}")
self._write_raw(pdu)
try:
@@ -102,11 +105,11 @@ def write(self, handle, value):
except:
logging.warning(f"No write response received for handle {handle.name}")
- def write_cccd(self, handle, value):
- handle_value = ATT_CCCD_HANDLES[handle.name]
- lsb = handle_value & 0xFF
- msb = (handle_value >> 8) & 0xFF
- pdu = bytes([OPCODE_WRITE_REQUEST, lsb, msb]) + value
+ def write_cccd(self, handle: Any, value: bytes) -> None:
+ handle_value: int = ATT_CCCD_HANDLES[handle.name]
+ lsb: int = handle_value & 0xFF
+ msb: int = (handle_value >> 8) & 0xFF
+ pdu: bytes = bytes([OPCODE_WRITE_REQUEST, lsb, msb]) + value
logging.debug(f"Sending CCCD write request for handle {handle.name}: {pdu.hex()}")
self._write_raw(pdu)
try:
@@ -115,42 +118,42 @@ def write_cccd(self, handle, value):
except:
logging.warning(f"No CCCD write response received for handle {handle.name}")
- def _write_raw(self, pdu):
+ def _write_raw(self, pdu: bytes) -> None:
self.sock.send(pdu)
logging.debug(f"Sent PDU: {pdu.hex()}")
- def _read_pdu(self):
+ def _read_pdu(self) -> Optional[bytes]:
try:
- data = self.sock.recv(512)
+ data: bytes = self.sock.recv(512)
logging.debug(f"Received PDU: {data.hex()}")
return data
- except socket.timeout:
+ except TimeoutError:
return None
except:
raise
- def _read_response(self, timeout=2.0):
+ def _read_response(self, timeout: float = 2.0) -> bytes:
try:
- response = self.responses.get(timeout=timeout)[1:] # Skip opcode
+ response: bytes = self.responses.get(timeout=timeout)[1:] # Skip opcode
logging.debug(f"Response received: {response.hex()}")
return response
except:
logging.error("No response received within timeout")
raise Exception("No response received")
- def _listen_notifications(self):
+ def _listen_notifications(self) -> None:
logging.info("Starting notification listener thread")
while self.running:
try:
- pdu = self._read_pdu()
+ pdu: Optional[bytes] = self._read_pdu()
except:
break
if pdu is None:
continue
if len(pdu) > 0 and pdu[0] == OPCODE_HANDLE_VALUE_NTF:
logging.debug(f"Notification PDU received: {pdu.hex()}")
- handle = pdu[1] | (pdu[2] << 8)
- value = pdu[3:]
+ handle: int = pdu[1] | (pdu[2] << 8)
+ value: bytes = pdu[3:]
logging.debug(f"Notification for handle {handle}: {value.hex()}")
if handle in self.listeners:
for listener in self.listeners[handle]:
@@ -165,36 +168,36 @@ def _listen_notifications(self):
logging.error(f"Reconnection failed: {e}")
class HearingAidSettings:
- def __init__(self, left_eq, right_eq, left_amp, right_amp, left_tone, right_tone,
- left_conv, right_conv, left_anr, right_anr, net_amp, balance, own_voice):
- self.left_eq = left_eq
- self.right_eq = right_eq
- self.left_amplification = left_amp
- self.right_amplification = right_amp
- self.left_tone = left_tone
- self.right_tone = right_tone
- self.left_conversation_boost = left_conv
- self.right_conversation_boost = right_conv
- self.left_ambient_noise_reduction = left_anr
- self.right_ambient_noise_reduction = right_anr
- self.net_amplification = net_amp
- self.balance = balance
- self.own_voice_amplification = own_voice
+ def __init__(self, left_eq: List[float], right_eq: List[float], left_amp: float, right_amp: float, left_tone: float, right_tone: float,
+ left_conv: bool, right_conv: bool, left_anr: float, right_anr: float, net_amp: float, balance: float, own_voice: float) -> None:
+ self.left_eq: List[float] = left_eq
+ self.right_eq: List[float] = right_eq
+ self.left_amplification: float = left_amp
+ self.right_amplification: float = right_amp
+ self.left_tone: float = left_tone
+ self.right_tone: float = right_tone
+ self.left_conversation_boost: bool = left_conv
+ self.right_conversation_boost: bool = right_conv
+ self.left_ambient_noise_reduction: float = left_anr
+ self.right_ambient_noise_reduction: float = right_anr
+ self.net_amplification: float = net_amp
+ self.balance: float = balance
+ self.own_voice_amplification: float = own_voice
logging.debug(f"HearingAidSettings created: amp={net_amp}, balance={balance}, tone={left_tone}, anr={left_anr}, conv={left_conv}")
-def parse_hearing_aid_settings(data):
+def parse_hearing_aid_settings(data: bytes) -> Optional[HearingAidSettings]:
logging.debug(f"Parsing hearing aid settings from data: {data.hex()}")
if len(data) < 104:
logging.warning("Data too short for parsing")
return None
- buffer = data
- offset = 0
+ buffer: bytes = data
+ offset: int = 0
offset += 4
logging.info(f"Parsing hearing aid settings, starting read at offset 4, value: {buffer[offset]:02x}")
- left_eq = []
+ left_eq: List[float] = []
for i in range(8):
val, = struct.unpack(' None:
logging.info("Sending hearing aid settings")
- data = att_manager.read(type('Handle', (), {'name': 'HEARING_AID'})())
+ data: bytes = att_manager.read(type('Handle', (), {'name': 'HEARING_AID'})())
if len(data) < 104:
logging.error("Read data too short for sending settings")
return
- buffer = bytearray(data)
+ buffer: bytearray = bytearray(data)
# Modify byte at index 2 to 0x64
buffer[2] = 0x64
@@ -272,16 +275,16 @@ def send_hearing_aid_settings(att_manager, settings):
logging.info("Hearing aid settings sent")
class SignalEmitter(QObject):
- update_ui = pyqtSignal(HearingAidSettings)
+ update_ui: pyqtSignal = pyqtSignal(HearingAidSettings)
class HearingAidApp(QWidget):
- def __init__(self, mac_address):
+ def __init__(self, mac_address: str) -> None:
super().__init__()
- self.mac_address = mac_address
- self.att_manager = ATTManager(mac_address)
- self.emitter = SignalEmitter()
+ self.mac_address: str = mac_address
+ self.att_manager: ATTManager = ATTManager(mac_address)
+ self.emitter: SignalEmitter = SignalEmitter()
self.emitter.update_ui.connect(self.on_update_ui)
- self.debounce_timer = QTimer()
+ self.debounce_timer: QTimer = QTimer()
self.debounce_timer.setSingleShot(True)
self.debounce_timer.timeout.connect(self.send_settings)
logging.info("HearingAidConfig initialized")
@@ -289,25 +292,25 @@ def __init__(self, mac_address):
self.init_ui()
self.connect_att()
- def init_ui(self):
+ def init_ui(self) -> None:
logging.debug("Initializing UI")
self.setWindowTitle("Hearing Aid Adjustments")
- layout = QVBoxLayout()
+ layout: QVBoxLayout = QVBoxLayout()
# EQ Inputs
- eq_layout = QGridLayout()
- self.left_eq_inputs = []
- self.right_eq_inputs = []
+ eq_layout: QGridLayout = QGridLayout()
+ self.left_eq_inputs: List[QLineEdit] = []
+ self.right_eq_inputs: List[QLineEdit] = []
- eq_labels = ["250Hz", "500Hz", "1kHz", "2kHz", "3kHz", "4kHz", "6kHz", "8kHz"]
+ eq_labels: List[str] = ["250Hz", "500Hz", "1kHz", "2kHz", "3kHz", "4kHz", "6kHz", "8kHz"]
eq_layout.addWidget(QLabel("Frequency"), 0, 0)
eq_layout.addWidget(QLabel("Left"), 0, 1)
eq_layout.addWidget(QLabel("Right"), 0, 2)
for i, label in enumerate(eq_labels):
eq_layout.addWidget(QLabel(label), i + 1, 0)
- left_input = QLineEdit()
- right_input = QLineEdit()
+ left_input: QLineEdit = QLineEdit()
+ right_input: QLineEdit = QLineEdit()
left_input.setPlaceholderText("Left")
right_input.setPlaceholderText("Right")
self.left_eq_inputs.append(left_input)
@@ -315,52 +318,52 @@ def init_ui(self):
eq_layout.addWidget(left_input, i + 1, 1)
eq_layout.addWidget(right_input, i + 1, 2)
- eq_group = QWidget()
+ eq_group: QWidget = QWidget()
eq_group.setLayout(eq_layout)
layout.addWidget(QLabel("Loss, in dBHL"))
layout.addWidget(eq_group)
# Amplification
- self.amp_slider = QSlider(Qt.Horizontal)
+ self.amp_slider: QSlider = QSlider(Qt.Horizontal)
self.amp_slider.setRange(-100, 100)
self.amp_slider.setValue(50)
layout.addWidget(QLabel("Amplification"))
layout.addWidget(self.amp_slider)
# Balance
- self.balance_slider = QSlider(Qt.Horizontal)
+ self.balance_slider: QSlider = QSlider(Qt.Horizontal)
self.balance_slider.setRange(-100, 100)
self.balance_slider.setValue(50)
layout.addWidget(QLabel("Balance"))
layout.addWidget(self.balance_slider)
# Tone
- self.tone_slider = QSlider(Qt.Horizontal)
+ self.tone_slider: QSlider = QSlider(Qt.Horizontal)
self.tone_slider.setRange(-100, 100)
self.tone_slider.setValue(50)
layout.addWidget(QLabel("Tone"))
layout.addWidget(self.tone_slider)
# Ambient Noise Reduction
- self.anr_slider = QSlider(Qt.Horizontal)
+ self.anr_slider: QSlider = QSlider(Qt.Horizontal)
self.anr_slider.setRange(0, 100)
self.anr_slider.setValue(0)
layout.addWidget(QLabel("Ambient Noise Reduction"))
layout.addWidget(self.anr_slider)
# Conversation Boost
- self.conv_checkbox = QCheckBox("Conversation Boost")
+ self.conv_checkbox: QCheckBox = QCheckBox("Conversation Boost")
layout.addWidget(self.conv_checkbox)
# Own Voice Amplification
- self.own_voice_slider = QSlider(Qt.Horizontal)
+ self.own_voice_slider: QSlider = QSlider(Qt.Horizontal)
self.own_voice_slider.setRange(0, 100)
self.own_voice_slider.setValue(50)
# layout.addWidget(QLabel("Own Voice Amplification"))
# layout.addWidget(self.own_voice_slider) # seems to have no effect
# Reset button
- self.reset_button = QPushButton("Reset")
+ self.reset_button: QPushButton = QPushButton("Reset")
layout.addWidget(self.reset_button)
# Connect signals
@@ -377,15 +380,15 @@ def init_ui(self):
self.setLayout(layout)
logging.debug("UI initialized")
- def connect_att(self):
+ def connect_att(self) -> None:
logging.info("Connecting to ATT in UI")
try:
self.att_manager.connect()
self.att_manager.enable_notifications(type('Handle', (), {'name': 'HEARING_AID'})())
self.att_manager.register_listener(ATT_HANDLES['HEARING_AID'], self.on_notification)
# Initial read
- data = self.att_manager.read(type('Handle', (), {'name': 'HEARING_AID'})())
- settings = parse_hearing_aid_settings(data)
+ data: bytes = self.att_manager.read(type('Handle', (), {'name': 'HEARING_AID'})())
+ settings: Optional[HearingAidSettings] = parse_hearing_aid_settings(data)
if settings:
self.emitter.update_ui.emit(settings)
logging.info("Initial settings loaded")
@@ -396,13 +399,13 @@ def connect_att(self):
else:
logging.error(f"Connection failed: {e}")
- def on_notification(self, value):
+ def on_notification(self, value: bytes) -> None:
logging.debug("Notification received")
- settings = parse_hearing_aid_settings(value)
+ settings: Optional[HearingAidSettings] = parse_hearing_aid_settings(value)
if settings:
self.emitter.update_ui.emit(settings)
- def on_update_ui(self, settings):
+ def on_update_ui(self, settings: HearingAidSettings) -> None:
logging.debug("Updating UI with settings")
self.amp_slider.setValue(int(settings.net_amplification * 100))
self.balance_slider.setValue(int(settings.balance * 100))
@@ -416,30 +419,30 @@ def on_update_ui(self, settings):
for i, value in enumerate(settings.right_eq):
self.right_eq_inputs[i].setText(f"{value:.2f}")
- def on_value_changed(self):
+ def on_value_changed(self) -> None:
logging.debug("UI value changed, starting debounce")
self.debounce_timer.start(100)
- def send_settings(self):
+ def send_settings(self) -> None:
logging.info("Sending settings from UI")
- amp = self.amp_slider.value() / 100.0
- balance = self.balance_slider.value() / 100.0
- tone = self.tone_slider.value() / 100.0
- anr = self.anr_slider.value() / 100.0
- conv = self.conv_checkbox.isChecked()
- own_voice = self.own_voice_slider.value() / 100.0
+ amp: float = self.amp_slider.value() / 100.0
+ balance: float = self.balance_slider.value() / 100.0
+ tone: float = self.tone_slider.value() / 100.0
+ anr: float = self.anr_slider.value() / 100.0
+ conv: bool = self.conv_checkbox.isChecked()
+ own_voice: float = self.own_voice_slider.value() / 100.0
- left_amp = amp + (0.5 - balance) * amp * 2 if balance < 0 else amp
- right_amp = amp + (balance - 0.5) * amp * 2 if balance > 0 else amp
+ left_amp: float = amp + (0.5 - balance) * amp * 2 if balance < 0 else amp
+ right_amp: float = amp + (balance - 0.5) * amp * 2 if balance > 0 else amp
- left_eq = [float(input_box.text() or 0) for input_box in self.left_eq_inputs]
- right_eq = [float(input_box.text() or 0) for input_box in self.right_eq_inputs]
+ left_eq: List[float] = [float(input_box.text() or 0) for input_box in self.left_eq_inputs]
+ right_eq: List[float] = [float(input_box.text() or 0) for input_box in self.right_eq_inputs]
- settings = HearingAidSettings(
+ settings: HearingAidSettings = HearingAidSettings(
left_eq, right_eq, left_amp, right_amp, tone, tone,
conv, conv, anr, anr, amp, balance, own_voice
)
- threading.Thread(target=send_hearing_aid_settings, args=(self.att_manager, settings)).start()
+ Thread(target=send_hearing_aid_settings, args=(self.att_manager, settings)).start()
def reset_settings(self):
logging.debug("Resetting settings to defaults")
@@ -451,26 +454,25 @@ def reset_settings(self):
self.own_voice_slider.setValue(50)
self.on_value_changed()
- def closeEvent(self, event):
+ def closeEvent(self, event: Any) -> None:
logging.info("Closing app")
self.att_manager.disconnect()
event.accept()
if __name__ == "__main__":
- mac = None
if len(sys.argv) != 2:
logging.error("Usage: python hearing-aid-adjustments.py ")
sys.exit(1)
- mac = sys.argv[1]
- mac_regex = r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
+ mac: str = sys.argv[1]
+ mac_regex: str = r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
import re
if not re.match(mac_regex, mac):
logging.error("Invalid MAC address format")
sys.exit(1)
logging.info(f"Starting app")
- app = QApplication(sys.argv)
+ app: QApplication = QApplication(sys.argv)
- def quit_app(signum, frame):
+ def quit_app(signum: int, frame: Any) -> None:
app.quit()
signal.signal(signal.SIGINT, quit_app)
diff --git a/linux/librepods-ctl.cpp b/linux/librepods-ctl.cpp
new file mode 100644
index 000000000..71c32ce95
--- /dev/null
+++ b/linux/librepods-ctl.cpp
@@ -0,0 +1,31 @@
+#include
+#include
+#include
+
+int main(int argc, char *argv[]) {
+ QCoreApplication app(argc, argv);
+
+ if (argc < 2) {
+ QTextStream(stderr) << "Usage: librepods-ctl \n"
+ << "Commands:\n"
+ << " noise:off Disable noise control\n"
+ << " noise:anc Enable Active Noise Cancellation\n"
+ << " noise:transparency Enable Transparency mode\n"
+ << " noise:adaptive Enable Adaptive mode\n";
+ return 1;
+ }
+
+ QLocalSocket socket;
+ socket.connectToServer("app_server");
+
+ if (!socket.waitForConnected(500)) {
+ QTextStream(stderr) << "Could not connect to librepods (is it running?)\n";
+ return 1;
+ }
+
+ socket.write(QByteArray(argv[1]));
+ socket.flush();
+ socket.waitForBytesWritten(200);
+ socket.disconnectFromServer();
+ return 0;
+}
diff --git a/linux/main.cpp b/linux/main.cpp
index 9e8d7b9ad..7b1826b49 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -12,6 +12,10 @@
#include
#include
#include
+#include
+#include
+#include
+#include
#include "airpods_packets.h"
#include "logger.h"
@@ -666,7 +670,7 @@ private slots:
else if (data.startsWith(AirPodsPackets::Parse::FEATURES_ACK))
{
writePacketToSocket(AirPodsPackets::Connection::REQUEST_NOTIFICATIONS, "Request notifications packet written: ");
-
+
QTimer::singleShot(2000, this, [this]() {
if (m_deviceInfo->batteryStatus().isEmpty()) {
writePacketToSocket(AirPodsPackets::Connection::REQUEST_NOTIFICATIONS, "Request notifications packet written: ");
@@ -718,7 +722,7 @@ private slots:
mediaController->handleEarDetection(m_deviceInfo->getEarDetection());
}
// Battery Status
- else if (data.size() == 22 && data.startsWith(AirPodsPackets::Parse::BATTERY_STATUS))
+ else if ((data.size() == 22 || data.size() == 12) && data.startsWith(AirPodsPackets::Parse::BATTERY_STATUS))
{
m_deviceInfo->getBattery()->parsePacket(data);
m_deviceInfo->updateBatteryStatus();
@@ -766,7 +770,7 @@ private slots:
}
QBluetoothAddress phoneAddress("00:00:00:00:00:00"); // Default address, will be overwritten if PHONE_MAC_ADDRESS is set
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
-
+
if (!env.value("PHONE_MAC_ADDRESS").isEmpty())
{
phoneAddress = QBluetoothAddress(env.value("PHONE_MAC_ADDRESS"));
@@ -875,7 +879,7 @@ private slots:
if (BLEUtils::isValidIrkRpa(m_deviceInfo->magicAccIRK(), device.address)) {
m_deviceInfo->setModel(device.modelName);
auto decryptet = BLEUtils::decryptLastBytes(device.encryptedPayload, m_deviceInfo->magicAccEncKey());
- m_deviceInfo->getBattery()->parseEncryptedPacket(decryptet, device.primaryLeft, device.isThisPodInTheCase);
+ m_deviceInfo->getBattery()->parseEncryptedPacket(decryptet, device.primaryLeft, device.isThisPodInTheCase, isModelHeadset(m_deviceInfo->model()));
m_deviceInfo->getEarDetection()->overrideEarDetectionStatus(device.isPrimaryInEar, device.isSecondaryInEar);
}
}
@@ -987,31 +991,44 @@ private slots:
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
- QSharedMemory sharedMemory;
- sharedMemory.setKey("TcpServer-Key2");
+ // Load translations
+ QTranslator *translator = new QTranslator(&app);
+ QString locale = QLocale::system().name();
- // Check if app is already open
- if(sharedMemory.create(1) == false)
- {
- LOG_INFO("Another instance already running! Opening App Window Instead");
- QLocalSocket socket;
- // Connect to the original app, then trigger the reopen signal
- socket.connectToServer("app_server");
- if (socket.waitForConnected(500)) {
- socket.write("reopen");
- socket.flush();
- socket.waitForBytesWritten(500);
- socket.disconnectFromServer();
- app.exit(); // exit; process already running
- return 0;
- }
- else
- {
- // Failed connection, log and open the app (assume it's not running)
- LOG_ERROR("Failed to connect to the original app instance. Assuming it is not running.");
- LOG_DEBUG("Socket error: " << socket.errorString());
+ // Try to load translation from various locations
+ QStringList translationPaths = {
+ QCoreApplication::applicationDirPath() + "/translations",
+ QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/librepods/translations",
+ "/usr/share/librepods/translations",
+ "/usr/local/share/librepods/translations"
+ };
+
+ for (const QString &path : translationPaths) {
+ if (translator->load("librepods_" + locale, path)) {
+ app.installTranslator(translator);
+ break;
}
}
+
+ QLocalServer::removeServer("app_server");
+
+ QFile stale("/tmp/app_server");
+ if (stale.exists())
+ stale.remove();
+
+ QLocalSocket socket_check;
+ socket_check.connectToServer("app_server");
+
+ if (socket_check.waitForConnected(300)) {
+ LOG_INFO("Another instance already running! Reopening window...");
+
+ socket_check.write("reopen");
+ socket_check.flush();
+ socket_check.waitForBytesWritten(200);
+ socket_check.disconnectFromServer();
+
+ return 0;
+ }
app.setDesktopFileName("me.kavishdevar.librepods");
app.setQuitOnLastWindowClosed(false);
@@ -1072,6 +1089,18 @@ int main(int argc, char *argv[]) {
trayApp->loadMainModule();
}
}
+ else if (msg == "noise:off") {
+ trayApp->setNoiseControlModeInt(0);
+ }
+ else if (msg == "noise:anc") {
+ trayApp->setNoiseControlModeInt(1);
+ }
+ else if (msg == "noise:transparency") {
+ trayApp->setNoiseControlModeInt(2);
+ }
+ else if (msg == "noise:adaptive") {
+ trayApp->setNoiseControlModeInt(3);
+ }
else
{
LOG_ERROR("Unknown message received: " << msg);
@@ -1083,7 +1112,7 @@ int main(int argc, char *argv[]) {
LOG_ERROR("Failed to connect to the duplicate app instance");
LOG_DEBUG("Connection error: " << socket->errorString());
});
-
+
// Handle server-level errors
QObject::connect(&server, &QLocalServer::serverError, [&]() {
LOG_ERROR("Server failed to accept a new connection");
@@ -1092,8 +1121,16 @@ int main(int argc, char *argv[]) {
});
QObject::connect(&app, &QCoreApplication::aboutToQuit, [&]() {
- LOG_DEBUG("Application is about to quit. Cleaning up...");
- sharedMemory.detach();
+ LOG_DEBUG("Application quitting. Cleaning up local server...");
+
+ if (server.isListening()) {
+ server.close();
+ }
+
+ QLocalServer::removeServer("app_server");
+ QFile stale("/tmp/app_server");
+ if (stale.exists())
+ stale.remove();
});
return app.exec();
}
diff --git a/linux/media/mediacontroller.cpp b/linux/media/mediacontroller.cpp
index 531efd5b2..078129c5a 100644
--- a/linux/media/mediacontroller.cpp
+++ b/linux/media/mediacontroller.cpp
@@ -101,40 +101,54 @@ bool MediaController::isActiveOutputDeviceAirPods() {
}
void MediaController::handleConversationalAwareness(const QByteArray &data) {
- LOG_DEBUG("Handling conversational awareness data: " << data.toHex());
- bool lowered = data[9] == 0x01;
- LOG_INFO("Conversational awareness: " << (lowered ? "enabled" : "disabled"));
-
- if (lowered) {
- if (initialVolume == -1 && isActiveOutputDeviceAirPods()) {
- QString defaultSink = m_pulseAudio->getDefaultSink();
- initialVolume = m_pulseAudio->getSinkVolume(defaultSink);
- if (initialVolume == -1) {
- LOG_ERROR("Failed to get initial volume");
+ if (data.size() < 10) {
+ LOG_ERROR("Invalid conversational awareness packet");
return;
- }
- LOG_DEBUG("Initial volume: " << initialVolume << "%");
- }
- QString defaultSink = m_pulseAudio->getDefaultSink();
- int targetVolume = initialVolume * 0.20;
- if (m_pulseAudio->setSinkVolume(defaultSink, targetVolume)) {
- LOG_INFO("Volume lowered to 0.20 of initial which is " << targetVolume << "%");
- } else {
- LOG_ERROR("Failed to lower volume");
}
- } else {
- if (initialVolume != -1 && isActiveOutputDeviceAirPods()) {
- QString defaultSink = m_pulseAudio->getDefaultSink();
- if (m_pulseAudio->setSinkVolume(defaultSink, initialVolume)) {
- LOG_INFO("Volume restored to " << initialVolume << "%");
- } else {
- LOG_ERROR("Failed to restore volume");
- }
- initialVolume = -1;
+
+ uint8_t flag = (uint8_t)data[9];
+
+ switch (flag) {
+ case 0x01:
+ LOG_INFO("Conversational awareness event: voice detected");
+
+ if (initialVolume == -1 && isActiveOutputDeviceAirPods()) {
+ QString sink = m_pulseAudio->getDefaultSink();
+ initialVolume = m_pulseAudio->getSinkVolume(sink);
+ LOG_DEBUG("Initial volume saved: " << initialVolume << "%");
+ }
+
+ if (initialVolume != -1) {
+ QString sink = m_pulseAudio->getDefaultSink();
+ int target = initialVolume * 0.20;
+ m_pulseAudio->setSinkVolume(sink, target);
+ LOG_INFO("Volume lowered to " << target << "%");
+ }
+ break;
+
+ case 0x08:
+ LOG_INFO("Conversational awareness disabled");
+ initialVolume = -1;
+ break;
+
+ case 0x09:
+ LOG_INFO("Conversational awareness enabled");
+ break;
+
+ default:
+ LOG_INFO("Conversational awareness event: voice ended");
+
+ if (initialVolume != -1 && isActiveOutputDeviceAirPods()) {
+ QString sink = m_pulseAudio->getDefaultSink();
+ m_pulseAudio->setSinkVolume(sink, initialVolume);
+ LOG_INFO("Volume restored to " << initialVolume << "%");
+ initialVolume = -1;
+ }
+ break;
}
- }
}
+
bool MediaController::isA2dpProfileAvailable() {
if (m_deviceOutputName.isEmpty()) {
return false;
diff --git a/linux/translations/librepods_it_IT.ts b/linux/translations/librepods_it_IT.ts
new file mode 100644
index 000000000..f0970b205
--- /dev/null
+++ b/linux/translations/librepods_it_IT.ts
@@ -0,0 +1,151 @@
+
+
+
+
+ Main
+
+ Connected
+ Connesso
+
+
+ Disconnected
+ Disconnesso
+
+
+ Off
+ Non attivo
+
+
+ Noise Cancellation
+ Cancellazione rumore
+
+
+ Transparency
+ Trasparenza
+
+
+ Adaptive
+ Adattivo
+
+
+ Adaptive Noise Level:
+ Livello rumore adattivo:
+
+
+ Conversational Awareness
+ Rilevamento conversazione
+
+
+ Hearing Aid
+ Apparecchio acustico
+
+
+ Settings
+ Impostazioni
+
+
+ Pause Behavior When Removing AirPods:
+ Pausa alla rimozione delle AirPods:
+
+
+ One Removed
+ Una rimossa
+
+
+ Both Removed
+ Entrambe rimosse
+
+
+ Never
+ Mai
+
+
+ Cross-Device Connectivity with Android
+ Connettività multi-dispositivo con Android
+
+
+ Auto-Start on Login
+ Avvio automatico all'accesso
+
+
+ Enable System Notifications
+ Abilita notifiche di sistema
+
+
+ One Bud ANC Mode
+ Modalità ANC singolo auricolare
+
+
+ Enable ANC when using one AirPod
+(More noise reduction, but uses more battery)
+ Abilita ANC con un solo AirPod
+(Maggiore riduzione rumore, ma consuma più batteria)
+
+
+ Bluetooth Retry Attempts:
+ Tentativi riprova Bluetooth:
+
+
+ Rename
+ Rinomina
+
+
+ Change Phone MAC
+ Cambia MAC Telefono
+
+
+ Show Magic Cloud Keys QR
+ Mostra QR Magic Cloud Keys
+
+
+
+ TrayIconManager
+
+ Battery Status:
+ Stato batteria:
+
+
+ Open
+ Apri
+
+
+ Settings
+ Impostazioni
+
+
+ Toggle Conversational Awareness
+ Attiva/Disattiva Rilevamento conversazione
+
+
+ Adaptive
+ Adattivo
+
+
+ Transparency
+ Trasparenza
+
+
+ Noise Cancellation
+ Cancellazione rumore
+
+
+ Off
+ Non attivo
+
+
+ Quit
+ Esci
+
+
+
+ AirPodsTrayApp
+
+ AirPods Disconnected
+ AirPods disconnesse
+
+
+ Your AirPods have been disconnected
+ Le tue AirPods sono state disconnesse
+
+
+
diff --git a/linux/translations/librepods_tr.ts b/linux/translations/librepods_tr.ts
new file mode 100644
index 000000000..34521ab80
--- /dev/null
+++ b/linux/translations/librepods_tr.ts
@@ -0,0 +1,151 @@
+
+
+
+
+ Main
+
+ Connected
+ Bağlı
+
+
+ Disconnected
+ Bağlantı Kesildi
+
+
+ Off
+ Kapalı
+
+
+ Noise Cancellation
+ Gürültü Engelleme
+
+
+ Transparency
+ Şeffaflık
+
+
+ Adaptive
+ Uyarlanabilir
+
+
+ Adaptive Noise Level:
+ Uyarlanabilir Gürültü Seviyesi:
+
+
+ Conversational Awareness
+ Konuşma Farkındalığı
+
+
+ Hearing Aid
+ İşitme Cihazı
+
+
+ Settings
+ Ayarlar
+
+
+ Pause Behavior When Removing AirPods:
+ AirPods Çıkarıldığında Duraklatma Davranışı:
+
+
+ One Removed
+ Biri Çıkarıldığında
+
+
+ Both Removed
+ İkisi de Çıkarıldığında
+
+
+ Never
+ Asla
+
+
+ Cross-Device Connectivity with Android
+ Android ile Çapraz Cihaz Bağlantısı
+
+
+ Auto-Start on Login
+ Oturum Açıldığında Otomatik Başlat
+
+
+ Enable System Notifications
+ Sistem Bildirimlerini Etkinleştir
+
+
+ One Bud ANC Mode
+ Tek Kulaklık ANC Modu
+
+
+ Enable ANC when using one AirPod
+(More noise reduction, but uses more battery)
+ Tek AirPod kullanırken ANC'yi etkinleştir
+(Daha fazla gürültü azaltma, ancak daha fazla pil kullanır)
+
+
+ Bluetooth Retry Attempts:
+ Bluetooth Yeniden Deneme Sayısı:
+
+
+ Rename
+ Yeniden Adlandır
+
+
+ Change Phone MAC
+ Telefon MAC Adresini Değiştir
+
+
+ Show Magic Cloud Keys QR
+ Magic Cloud Anahtarları QR'ını Göster
+
+
+
+ TrayIconManager
+
+ Battery Status:
+ Pil Durumu:
+
+
+ Open
+ Aç
+
+
+ Settings
+ Ayarlar
+
+
+ Toggle Conversational Awareness
+ Konuşma Farkındalığını Aç/Kapat
+
+
+ Adaptive
+ Uyarlanabilir
+
+
+ Transparency
+ Şeffaflık
+
+
+ Noise Cancellation
+ Gürültü Engelleme
+
+
+ Off
+ Kapalı
+
+
+ Quit
+ Çıkış
+
+
+
+ AirPodsTrayApp
+
+ AirPods Disconnected
+ AirPods Bağlantısı Kesildi
+
+
+ Your AirPods have been disconnected
+ AirPods'unuzun bağlantısı kesildi
+
+
+
diff --git a/linux/translations/librepods_zh_TW.ts b/linux/translations/librepods_zh_TW.ts
new file mode 100644
index 000000000..5f33b8795
--- /dev/null
+++ b/linux/translations/librepods_zh_TW.ts
@@ -0,0 +1,151 @@
+
+
+
+
+ Main
+
+ Connected
+ 已連線
+
+
+ Disconnected
+ 已中斷連線
+
+
+ Off
+ 關閉
+
+
+ Noise Cancellation
+ 降噪
+
+
+ Transparency
+ 通透模式
+
+
+ Adaptive
+ 自適應
+
+
+ Adaptive Noise Level:
+ 自適應噪音等級:
+
+
+ Conversational Awareness
+ 對話感知
+
+
+ Hearing Aid
+ 助聽器
+
+
+ Settings
+ 設定
+
+
+ Pause Behavior When Removing AirPods:
+ 取下 AirPods 時的暫停行為:
+
+
+ One Removed
+ 取下其中一只時
+
+
+ Both Removed
+ 兩只都取下時
+
+
+ Never
+ 永不
+
+
+ Cross-Device Connectivity with Android
+ 與 Android 的跨裝置連線
+
+
+ Auto-Start on Login
+ 登入時自動啟動
+
+
+ Enable System Notifications
+ 啟用系統通知
+
+
+ One Bud ANC Mode
+ 單耳 ANC 模式
+
+
+ Enable ANC when using one AirPod
+(More noise reduction, but uses more battery)
+ 使用一只 AirPod 時啟用 ANC
+(更多降噪效果,但更耗電)
+
+
+ Bluetooth Retry Attempts:
+ Bluetooth 重試次數:
+
+
+ Rename
+ 重新命名
+
+
+ Change Phone MAC
+ 變更手機 MAC 位址
+
+
+ Show Magic Cloud Keys QR
+ 顯示 Magic Cloud Key QR 碼
+
+
+
+ TrayIconManager
+
+ Battery Status:
+ 電池狀態:
+
+
+ Open
+ 開啟
+
+
+ Settings
+ 設定
+
+
+ Toggle Conversational Awareness
+ 切換對話感知
+
+
+ Adaptive
+ 自適應
+
+
+ Transparency
+ 通透模式
+
+
+ Noise Cancellation
+ 降噪
+
+
+ Off
+ 關閉
+
+
+ Quit
+ 結束
+
+
+
+ AirPodsTrayApp
+
+ AirPods Disconnected
+ AirPods 已中斷連線
+
+
+ Your AirPods have been disconnected
+ 你的 AirPods 已中斷連線
+
+
+
diff --git a/linux/trayiconmanager.cpp b/linux/trayiconmanager.cpp
index 57c0a68b5..738feecf1 100644
--- a/linux/trayiconmanager.cpp
+++ b/linux/trayiconmanager.cpp
@@ -36,7 +36,7 @@ void TrayIconManager::showNotification(const QString &title, const QString &mess
void TrayIconManager::TrayIconManager::updateBatteryStatus(const QString &status)
{
- trayIcon->setToolTip("Battery Status: " + status);
+ trayIcon->setToolTip(tr("Battery Status: ") + status);
updateIconFromBattery(status);
}
@@ -57,20 +57,20 @@ void TrayIconManager::updateConversationalAwareness(bool enabled)
void TrayIconManager::setupMenuActions()
{
// Open action
- QAction *openAction = new QAction("Open", trayMenu);
+ QAction *openAction = new QAction(tr("Open"), trayMenu);
trayMenu->addAction(openAction);
connect(openAction, &QAction::triggered, qApp, [this](){emit openApp();});
// Settings Menu
- QAction *settingsMenu = new QAction("Settings", trayMenu);
+ QAction *settingsMenu = new QAction(tr("Settings"), trayMenu);
trayMenu->addAction(settingsMenu);
connect(settingsMenu, &QAction::triggered, qApp, [this](){emit openSettings();});
trayMenu->addSeparator();
// Conversational Awareness Toggle
- caToggleAction = new QAction("Toggle Conversational Awareness", trayMenu);
+ caToggleAction = new QAction(tr("Toggle Conversational Awareness"), trayMenu);
caToggleAction->setCheckable(true);
trayMenu->addAction(caToggleAction);
connect(caToggleAction, &QAction::triggered, this, [this](bool checked)
@@ -81,10 +81,10 @@ void TrayIconManager::setupMenuActions()
// Noise Control Options
noiseControlGroup = new QActionGroup(trayMenu);
const QPair noiseOptions[] = {
- {"Adaptive", NoiseControlMode::Adaptive},
- {"Transparency", NoiseControlMode::Transparency},
- {"Noise Cancellation", NoiseControlMode::NoiseCancellation},
- {"Off", NoiseControlMode::Off}};
+ {tr("Adaptive"), NoiseControlMode::Adaptive},
+ {tr("Transparency"), NoiseControlMode::Transparency},
+ {tr("Noise Cancellation"), NoiseControlMode::NoiseCancellation},
+ {tr("Off"), NoiseControlMode::Off}};
for (auto option : noiseOptions)
{
@@ -100,7 +100,7 @@ void TrayIconManager::setupMenuActions()
trayMenu->addSeparator();
// Quit action
- QAction *quitAction = new QAction("Quit", trayMenu);
+ QAction *quitAction = new QAction(tr("Quit"), trayMenu);
trayMenu->addAction(quitAction);
connect(quitAction, &QAction::triggered, qApp, &QApplication::quit);
}
@@ -109,25 +109,26 @@ void TrayIconManager::updateIconFromBattery(const QString &status)
{
int leftLevel = 0;
int rightLevel = 0;
+ int minLevel = 0;
if (!status.isEmpty())
{
// Parse the battery status string
QStringList parts = status.split(", ");
- if (parts.size() >= 2)
- {
+ if (parts.size() >= 2) {
leftLevel = parts[0].split(": ")[1].replace("%", "").toInt();
rightLevel = parts[1].split(": ")[1].replace("%", "").toInt();
+ minLevel = (leftLevel == 0) ? rightLevel : (rightLevel == 0) ? leftLevel
+ : qMin(leftLevel, rightLevel);
+ } else if (parts.size() == 1) {
+ minLevel = parts[0].split(": ")[1].replace("%", "").toInt();
}
}
-
- int minLevel = (leftLevel == 0) ? rightLevel : (rightLevel == 0) ? leftLevel
- : qMin(leftLevel, rightLevel);
QPixmap pixmap(32, 32);
pixmap.fill(Qt::transparent);
QPainter painter(&pixmap);
- painter.setPen(QApplication::palette().color(QPalette::WindowText));
+ painter.setPen(Qt::white);
painter.setFont(QFont("Arial", 12, QFont::Bold));
painter.drawText(pixmap.rect(), Qt::AlignCenter, QString::number(minLevel) + "%");
painter.end();
@@ -141,4 +142,5 @@ void TrayIconManager::onTrayIconActivated(QSystemTrayIcon::ActivationReason reas
{
emit trayClicked();
}
-}
\ No newline at end of file
+}
+
diff --git a/proximity_keys.py b/proximity_keys.py
index a0a9e4218..29ec444f2 100644
--- a/proximity_keys.py
+++ b/proximity_keys.py
@@ -4,50 +4,53 @@
# See https://github.com/google/bumble/blob/main/docs/mkdocs/src/platforms/windows.md for usage.
# You need to associate WinUSB with your Bluetooth interface. Once done, you can roll back to the original driver from Device Manager.
-import sys
import asyncio
-import argparse
+import colorama
import logging
import platform
-from typing import Any, Optional
-
-from colorama import Fore, Style, init as colorama_init
-colorama_init(autoreset=True)
-
-handler = logging.StreamHandler()
-class ColorFormatter(logging.Formatter):
- COLORS = {
+from argparse import ArgumentParser, Namespace
+from asyncio import Queue, TimeoutError
+from colorama import Fore, Style
+from logging import Formatter, LogRecord, Logger, StreamHandler
+from socket import socket as Socket
+from typing import Any, Dict, List, Optional, Tuple
+
+colorama.init(autoreset=True)
+
+handler: StreamHandler = StreamHandler()
+class ColorFormatter(Formatter):
+ COLORS: Dict[int, str] = {
logging.DEBUG: Fore.BLUE,
logging.INFO: Fore.GREEN,
logging.WARNING: Fore.YELLOW,
logging.ERROR: Fore.RED,
logging.CRITICAL: Fore.MAGENTA,
}
- def format(self, record):
- color = self.COLORS.get(record.levelno, "")
- prefix = f"{color}[{record.levelname}:{record.name}]{Style.RESET_ALL}"
+ def format(self, record: LogRecord) -> str:
+ color: str = self.COLORS.get(record.levelno, "")
+ prefix: str = f"{color}[{record.levelname}:{record.name}]{Style.RESET_ALL}"
return f"{prefix} {record.getMessage()}"
handler.setFormatter(ColorFormatter())
logging.basicConfig(level=logging.INFO, handlers=[handler])
-logger = logging.getLogger("proximitykeys")
+logger: Logger = logging.getLogger("proximitykeys")
-PROXIMITY_KEY_TYPES = {0x01: "IRK", 0x04: "ENC_KEY"}
+PROXIMITY_KEY_TYPES: Dict[int, str] = {0x01: "IRK", 0x04: "ENC_KEY"}
-def parse_proximity_keys_response(data: bytes):
+def parse_proximity_keys_response(data: bytes) -> Optional[List[Tuple[str, bytes]]]:
if len(data) < 7 or data[4] != 0x31:
return None
- key_count = data[6]
- keys = []
- offset = 7
+ key_count: int = data[6]
+ keys: List[Tuple[str, bytes]] = []
+ offset: int = 7
for _ in range(key_count):
if offset + 3 >= len(data):
break
- key_type = data[offset]
- key_length = data[offset + 2]
+ key_type: int = data[offset]
+ key_length: int = data[offset + 2]
offset += 4
if offset + key_length > len(data):
break
- key_bytes = data[offset:offset + key_length]
+ key_bytes: bytes = data[offset:offset + key_length]
keys.append((PROXIMITY_KEY_TYPES.get(key_type, f"TYPE_{key_type:02X}"), key_bytes))
offset += key_length
return keys
@@ -55,7 +58,7 @@ def parse_proximity_keys_response(data: bytes):
def hexdump(data: bytes) -> str:
return " ".join(f"{b:02X}" for b in data)
-async def run_bumble(bdaddr: str):
+async def run_bumble(bdaddr: str) -> int:
try:
from bumble.l2cap import ClassicChannelSpec
from bumble.transport import open_transport
@@ -68,19 +71,23 @@ async def run_bumble(bdaddr: str):
logger.error("Bumble not installed")
return 1
- PSM_PROXIMITY = 0x1001
- HANDSHAKE = bytes.fromhex("00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00")
- KEY_REQ = bytes.fromhex("04 00 04 00 30 00 05 00")
+ PSM_PROXIMITY: int = 0x1001
+ HANDSHAKE: bytes = bytes.fromhex("00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00")
+ KEY_REQ: bytes = bytes.fromhex("04 00 04 00 30 00 05 00")
class KeyStore:
- async def delete(self, name: str): pass
- async def update(self, name: str, keys: Any): pass
- async def get(self, _name: str) -> Optional[Any]: return None
- async def get_all(self): return []
-
- async def get_resolving_keys(self) -> list[tuple[bytes, Any]]:
- all_keys = await self.get_all()
- resolving_keys = []
+ async def delete(self, name: str) -> None:
+ pass
+ async def update(self, name: str, keys: Any) -> None:
+ pass
+ async def get(self, _name: str) -> Optional[Any]:
+ return None
+ async def get_all(self) -> List[Tuple[str, Any]]:
+ return []
+
+ async def get_resolving_keys(self) -> List[Tuple[bytes, Any]]:
+ all_keys: List[Tuple[str, Any]] = await self.get_all()
+ resolving_keys: List[Tuple[bytes, Any]] = []
for name, keys in all_keys:
if getattr(keys, "irk", None) is not None:
resolving_keys.append((
@@ -89,8 +96,8 @@ async def get_resolving_keys(self) -> list[tuple[bytes, Any]]:
))
return resolving_keys
- async def exchange_keys(channel, timeout=5.0):
- recv_q: asyncio.Queue = asyncio.Queue()
+ async def exchange_keys(channel: Any, timeout: float = 5.0) -> Optional[List[Tuple[str, bytes]]]:
+ recv_q: Queue = Queue()
channel.sink = lambda sdu: recv_q.put_nowait(sdu)
logger.info("Sending handshake packet...")
channel.send_pdu(HANDSHAKE)
@@ -99,19 +106,19 @@ async def exchange_keys(channel, timeout=5.0):
channel.send_pdu(KEY_REQ)
while True:
try:
- pkt = await asyncio.wait_for(recv_q.get(), timeout)
- except asyncio.TimeoutError:
+ pkt: bytes = await asyncio.wait_for(recv_q.get(), timeout)
+ except TimeoutError:
logger.error("Timed out waiting for SDU response")
return None
logger.debug("Received SDU (%d bytes): %s", len(pkt), hexdump(pkt))
- keys = parse_proximity_keys_response(pkt)
+ keys: Optional[List[Tuple[str, bytes]]] = parse_proximity_keys_response(pkt)
if keys:
return keys
- async def get_device():
+ async def get_device() -> Tuple[Any, Device]:
logger.info("Opening transport...")
- transport = await open_transport("usb:0")
- device = Device(host=Host(controller_source=transport.source, controller_sink=transport.sink))
+ transport: Any = await open_transport("usb:0")
+ device: Device = Device(host=Host(controller_source=transport.source, controller_sink=transport.sink))
device.classic_enabled = True
device.le_enabled = False
device.keystore = KeyStore()
@@ -123,15 +130,15 @@ async def get_device():
logger.info("Device powered on")
return transport, device
- async def create_channel_and_exchange(conn):
- spec = ClassicChannelSpec(psm=PSM_PROXIMITY, mtu=2048)
+ async def create_channel_and_exchange(conn: Any) -> None:
+ spec: ClassicChannelSpec = ClassicChannelSpec(psm=PSM_PROXIMITY, mtu=2048)
logger.info("Requesting L2CAP channel on PSM = 0x%04X", spec.psm)
if not conn.is_encrypted:
logger.info("Enabling link encryption...")
await conn.encrypt()
await asyncio.sleep(0.05)
- channel = await conn.create_l2cap_channel(spec=spec)
- keys = await exchange_keys(channel, timeout=8.0)
+ channel: Any = await conn.create_l2cap_channel(spec=spec)
+ keys: Optional[List[Tuple[str, bytes]]] = await exchange_keys(channel, timeout=8.0)
if not keys:
logger.warning("No proximity keys found")
return
@@ -165,14 +172,14 @@ async def create_channel_and_exchange(conn):
logger.info("Transport closed")
return 0
-def run_linux(bdaddr: str):
+def run_linux(bdaddr: str) -> None:
import socket
- PSM = 0x1001
- handshake = bytes.fromhex("00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00")
- key_req = bytes.fromhex("04 00 04 00 30 00 05 00")
+ PSM: int = 0x1001
+ handshake: bytes = bytes.fromhex("00 00 04 00 01 00 02 00 00 00 00 00 00 00 00 00")
+ key_req: bytes = bytes.fromhex("04 00 04 00 30 00 05 00")
logger.info("Connecting to %s (L2CAP)...", bdaddr)
- sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
+ sock: Socket = Socket(socket.AF_BLUETOOTH, socket.SOCK_SEQPACKET, socket.BTPROTO_L2CAP)
try:
sock.connect((bdaddr, PSM))
logger.info("Connected, sending handshake and key request...")
@@ -180,9 +187,9 @@ def run_linux(bdaddr: str):
sock.send(key_req)
while True:
- pkt = sock.recv(1024)
+ pkt: bytes = sock.recv(1024)
logger.debug("Received packet (%d bytes): %s", len(pkt), hexdump(pkt))
- keys = parse_proximity_keys_response(pkt)
+ keys: Optional[List[Tuple[str, bytes]]] = parse_proximity_keys_response(pkt)
if keys:
logger.info("Keys successfully retrieved")
print(f"{Fore.CYAN}{Style.BRIGHT}Proximity Keys:{Style.RESET_ALL}")
@@ -197,12 +204,12 @@ def run_linux(bdaddr: str):
sock.close()
logger.info("Connection closed")
-def main():
- parser = argparse.ArgumentParser()
+def main() -> None:
+ parser: ArgumentParser = ArgumentParser()
parser.add_argument("bdaddr")
parser.add_argument("--debug", action="store_true")
parser.add_argument("--bumble", action="store_true")
- args = parser.parse_args()
+ args: Namespace = parser.parse_args()
logging.getLogger().setLevel(logging.DEBUG if args.debug else logging.INFO)
if args.bumble or platform.system() == "Windows":