hap-java / HAP-Java

Java implementation of the HomeKit Accessory Protocol
MIT License
152 stars 83 forks source link

Major update for Android runtime support and camera devices. #116

Closed koush closed 2 years ago

koush commented 3 years ago

Pull Request Checklist

Please confirm that you've done the following when opening a new pull request:

koush commented 3 years ago

I had forked this repository a couple years ago and never contributed back. I basically hand picked all my changes/fixes and cleaned them up to apply them to this repo (which had a large refactor and package rename).

I'll leave comments inline.

Note that this just exposes the camera services, configurations, and makes it easy to respond with camera snapshots (just a byte array of a jpeg). It's up to the implementer to parse the TLV and actually manage the setupEndpoints and selectedRTP characteristic setters. I use FFMPEG, similar to Homebridge.

koush commented 3 years ago

Unclear why travis is failing. I think the gradle wrapper is correct and working properly on a clean checkout from my machine.

koush commented 3 years ago

Fixes this. https://github.com/hap-java/HAP-Java/issues/117

yfre commented 3 years ago

@koush thank you for PRs. it has many very good things, e.g.

maybe you could it split in several PRs so that it is easier to review and easier to get CI working

koush commented 3 years ago

I doubt I'll have the time to break this up into separate changes, as I had to basically implement it as one big patch to simply get everything working again (due to the package rename). The old cherry picks are for the pre-rename code.

I think the reason CI is failing is because it detects the build.gradle which is necessary for compiling+debugging on android. I think deleting that file would fix the CI. The CI needs to ignore it. It may be possible to delete it, but then Android would not compile. the mvn built jars should work on Android too though.

The patch is fairly non-intrusive and actually not that large. The majority of the files are the gradle wrapper and the various data types for video (which are unused anyways).

gjvanderheiden commented 3 years ago

I agree this could use a split up.

BouncyCastle could be updated to 1.67, with a small modification if (!Arrays.constantTimeAreEqual(calculatedMAC, receivedMAC)) { throw new TlsFatalAlert(AlertDescription.bad_record_mac); } TlsFatalAlert could be converted into IOException, because TlsFatalAlert doesn't exist anymore in .67. TlsFatalAlert is just an IOException, no biggie.

I also was a bit surprised there is no TLV object in HAP-java. You introduced it, but now it isn't used in the server packages. So it is a really nice addition and should be exploited in the server package with some extra methods (getState(), getMethod() etc).

gjvanderheiden commented 3 years ago

Could you maybe rename the gradle file for now, so that the build doesn't fail?