Apollon77 / hap-controller-node

Node.js library to implement a HAP (HomeKit) controller
Mozilla Public License 2.0
55 stars 15 forks source link

Add Image/Resource support #35

Closed Apollon77 closed 3 years ago

Apollon77 commented 3 years ago

From specs:

An Image snapshot feature allows a controller to request the IP Camera accessory to capture and retrieve a static image from the camera.
2019-07-26 | Copyright © 2019 Apple Inc. All Rights Reserved. 242
11. IP Cameras

When a controller sends an HTTP POST request with the desired image-width and image-height in the body the accessory must run the resource routine:
POST /resource HTTP/1.1
Example of a snapshot request in POST:
/resource
aid: <number> (Optional)
resource-type : image
image-width : <number>
image-height: <number>
The IP camera must set the MIMEType in the HTTP response to image and must provide the snapshot in JPEG format. The IP Camera must return a snapshot only in the resolution that the controller requests for.
Note: aid field is optional and used to identify the camera that the snapshot request targets when applicable.
Apollon77 commented 3 years ago

I will look into it and provide a PR (most like blindly untested for the beginning)

Apollon77 commented 3 years ago

Ok I added ot for HTTP now based on https://github.com/TheRealLink/hap-controller-node/commit/fab1f3f7fa7364443ea4762fc6d8dd857393f40b ... need to check for BLE more deep

Apollon77 commented 3 years ago

No definition for BLE, so HTTP only ... I adjusted the method a bit, see changelog