Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework the pairings folder #42

Closed
systemcrash opened this issue Jul 16, 2021 · 5 comments
Closed

Rework the pairings folder #42

systemcrash opened this issue Jul 16, 2021 · 5 comments

Comments

@systemcrash
Copy link
Member

@LewdNeko Wonder if you want to take a shot at this. This way, you avoid removing/reinserting all of the strange characters which are not 'file safe' that might appear in IDs today and tomorrow.

I think the pairings should be all be in a single file. It can be whatever format internally, but a text format for simplicity is nice. I propose a single flat JSON file, with each key, ID and permissions base64 encoded.

The alternative is to use binary plists, which we already use in ap2-receiver.

This will at least fix the issue we saw in #38 (comment)

@TheSpookyCat
Copy link
Contributor

Yes, this was actually how I did it the first time around. I had a lot of trouble encoding/decoding between bytes and string. For example, utf-8 won't work for the public key, you need utf-16. For the identifier, you need to use utf-8. For the permissions bit, I just forced a string conversion and reassembled with an if/else 😂

Base64 encoding would've been the smarter choice, and I'd be happy to PR this in. I will also include an override for the mDNS name, so that it is announced as configured by HomeKit.

E.g.

  1. Pair receiver to HomeKit
  2. Rename receiver in HomeKit
  3. mDNS name would match whatever it's configured as in HomeKit, if applicable.

@systemcrash
Copy link
Member Author

OK, I took a stab at this, and I'll hopefully have a PR coming soon.

@systemcrash
Copy link
Member Author

OK, what I have so far is viable. I've tested it with a number of different bit-flags. The extensive comments reveal that there are still a few bits missing. This motivates me to move the HK part to a different framework - like HAP-python. They've got some great code which means you can have multiple endpoints associated via HAP to control the speaker part. Currently, it's only one in this implementation.

Have a look at the differences here, or just go play with it, and see how it works for you.

@systemcrash
Copy link
Member Author

OK - pushed to master. If you want to fix 2 and 3, I welcome some attention to those bits. I've configure has nothing for more permanent storage.

@systemcrash
Copy link
Member Author

@LewdNeko wonder whether we can update this. Have you tried master recently?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants