matter-all-in-one-addon 2.3.1 → 2.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -8
- package/dist/camera/ai/camera-ai-detector.d.ts +0 -2
- package/dist/camera/ai/camera-ai-detector.js +52 -57
- package/dist/camera/ai/camera-ai-detector.js.map +1 -1
- package/dist/camera/browser-preview.d.ts +9 -0
- package/dist/camera/browser-preview.js +135 -0
- package/dist/camera/browser-preview.js.map +1 -0
- package/dist/camera/camera-source-resolver.js +5 -3
- package/dist/camera/camera-source-resolver.js.map +1 -1
- package/dist/camera/camera-types.d.ts +0 -2
- package/dist/camera/cameraui/cameraui-client.js +91 -30
- package/dist/camera/cameraui/cameraui-client.js.map +1 -1
- package/dist/camera/cameraui/cameraui-homekit-bridge.js +13 -4
- package/dist/camera/cameraui/cameraui-homekit-bridge.js.map +1 -1
- package/dist/camera/cameraui/cameraui-storage.js.map +1 -1
- package/dist/camera/cameraui/cameraui-types.d.ts +6 -2
- package/dist/camera/cameraui/ha-camera-entity.js +5 -2
- package/dist/camera/cameraui/ha-camera-entity.js.map +1 -1
- package/dist/camera/homekit/ffmpeg-helper.js +17 -35
- package/dist/camera/homekit/ffmpeg-helper.js.map +1 -1
- package/dist/camera/homekit/hevc/fmp4-hevc.js +3 -1
- package/dist/camera/homekit/hevc/fmp4-hevc.js.map +1 -1
- package/dist/camera/homekit/hevc/hevc-recording.d.ts +0 -2
- package/dist/camera/homekit/hevc/hevc-recording.js +28 -63
- package/dist/camera/homekit/hevc/hevc-recording.js.map +1 -1
- package/dist/camera/homekit/hevc/multi-tier-rtp.d.ts +1 -15
- package/dist/camera/homekit/hevc/multi-tier-rtp.js +70 -228
- package/dist/camera/homekit/hevc/multi-tier-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe-rtp.d.ts +0 -2
- package/dist/camera/homekit/hevc/sframe-rtp.js +0 -25
- package/dist/camera/homekit/hevc/sframe-rtp.js.map +1 -1
- package/dist/camera/homekit/hevc/sframe.d.ts +1 -11
- package/dist/camera/homekit/hevc/sframe.js +18 -133
- package/dist/camera/homekit/hevc/sframe.js.map +1 -1
- package/dist/camera/homekit/hevc/types.js +81 -9
- package/dist/camera/homekit/hevc/types.js.map +1 -1
- package/dist/camera/homekit/hevc/webrtc-session.d.ts +3 -17
- package/dist/camera/homekit/hevc/webrtc-session.js +55 -229
- package/dist/camera/homekit/hevc/webrtc-session.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.d.ts +0 -1
- package/dist/camera/homekit/homekit-camera-recording.delegate.js +115 -43
- package/dist/camera/homekit/homekit-camera-recording.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera-stream.delegate.d.ts +4 -7
- package/dist/camera/homekit/homekit-camera-stream.delegate.js +388 -201
- package/dist/camera/homekit/homekit-camera-stream.delegate.js.map +1 -1
- package/dist/camera/homekit/homekit-camera.accessory.d.ts +7 -34
- package/dist/camera/homekit/homekit-camera.accessory.js +207 -169
- package/dist/camera/homekit/homekit-camera.accessory.js.map +1 -1
- package/dist/camera/homekit/live-view-telemetry.d.ts +0 -4
- package/dist/camera/homekit/live-view-telemetry.js.map +1 -1
- package/dist/camera/homekit/tuya-hap-talkback.d.ts +41 -0
- package/dist/camera/homekit/tuya-hap-talkback.js +326 -0
- package/dist/camera/homekit/tuya-hap-talkback.js.map +1 -0
- package/dist/camera/matter/camera-endpoint.builder.js +9 -7
- package/dist/camera/matter/camera-endpoint.builder.js.map +1 -1
- package/dist/camera/matter/camera-session-manager.d.ts +1 -0
- package/dist/camera/matter/camera-session-manager.js +2 -0
- package/dist/camera/matter/camera-session-manager.js.map +1 -1
- package/dist/camera/matter/camera-webrtc-adapter.js +32 -15
- package/dist/camera/matter/camera-webrtc-adapter.js.map +1 -1
- package/dist/camera/motion/ffmpeg-motion-detector.js +28 -14
- package/dist/camera/motion/ffmpeg-motion-detector.js.map +1 -1
- package/dist/camera/nest/nest-camera-adapter.js +9 -5
- package/dist/camera/nest/nest-camera-adapter.js.map +1 -1
- package/dist/camera/ptz/ptz-capabilities.js +3 -1
- package/dist/camera/ptz/ptz-capabilities.js.map +1 -1
- package/dist/camera/ptz/ptz-legacy-discovery.js.map +1 -1
- package/dist/camera/ptz/ptz-mqtt-publisher.js +50 -12
- package/dist/camera/ptz/ptz-mqtt-publisher.js.map +1 -1
- package/dist/camera/ptz/ptz-zones-manager.js +6 -1
- package/dist/camera/ptz/ptz-zones-manager.js.map +1 -1
- package/dist/camera/scrypted/scrypted-camera-card.js +3 -1
- package/dist/camera/scrypted/scrypted-camera-card.js.map +1 -1
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js +7 -5
- package/dist/camera/scrypted/scrypted-camera-discovery-adapter.js.map +1 -1
- package/dist/camera/scrypted/scrypted-client-discovery-adapter.js.map +1 -1
- package/dist/camera/scrypted/scrypted-client.js +6 -5
- package/dist/camera/scrypted/scrypted-client.js.map +1 -1
- package/dist/camera/scrypted/scrypted-discovery-provider.js.map +1 -1
- package/dist/camera/scrypted/scrypted-homekit-bridge.js +6 -4
- package/dist/camera/scrypted/scrypted-homekit-bridge.js.map +1 -1
- package/dist/camera/scrypted/scrypted-reconnect-manager.js.map +1 -1
- package/dist/camera/scrypted/scrypted-runtime-facade.js +2 -2
- package/dist/camera/scrypted/scrypted-runtime-facade.js.map +1 -1
- package/dist/camera/scrypted/scrypted-runtime-ingest.js +3 -1
- package/dist/camera/scrypted/scrypted-runtime-ingest.js.map +1 -1
- package/dist/camera/scrypted/scrypted-storage.js +12 -6
- package/dist/camera/scrypted/scrypted-storage.js.map +1 -1
- package/dist/camera/scrypted/scrypted-stream-validator.js +25 -7
- package/dist/camera/scrypted/scrypted-stream-validator.js.map +1 -1
- package/dist/camera/tuya-webrtc-session.d.ts +53 -0
- package/dist/camera/tuya-webrtc-session.js +261 -0
- package/dist/camera/tuya-webrtc-session.js.map +1 -0
- package/dist/converters/sensor.converter.js +4 -1
- package/dist/converters/sensor.converter.js.map +1 -1
- package/dist/device-profiles.js +3 -1
- package/dist/device-profiles.js.map +1 -1
- package/dist/entities/air_quality.entity.js +3 -1
- package/dist/entities/air_quality.entity.js.map +1 -1
- package/dist/entities/base.entity.js +45 -17
- package/dist/entities/base.entity.js.map +1 -1
- package/dist/entities/camera.entity.d.ts +1 -0
- package/dist/entities/camera.entity.js +24 -2
- package/dist/entities/camera.entity.js.map +1 -1
- package/dist/entities/composite-device.entity.js +37 -13
- package/dist/entities/composite-device.entity.js.map +1 -1
- package/dist/entities/energy_tariff.entity.js.map +1 -1
- package/dist/entities/pet_feeder.entity.d.ts +1 -0
- package/dist/entities/pet_feeder.entity.js +12 -0
- package/dist/entities/pet_feeder.entity.js.map +1 -1
- package/dist/entities/vacuum.entity.js +16 -5
- package/dist/entities/vacuum.entity.js.map +1 -1
- package/dist/frontend/assets/index-1k-iTL-m.js +26 -0
- package/dist/frontend/assets/{index-NrzHqycm.css → index-CJdlkpIy.css} +1 -1
- package/dist/frontend/index.html +2 -2
- package/dist/hap/hap-generic-accessory.d.ts +4 -0
- package/dist/hap/hap-generic-accessory.js +512 -122
- package/dist/hap/hap-generic-accessory.js.map +1 -1
- package/dist/homeAssistant.d.ts +1 -0
- package/dist/homeAssistant.js +23 -5
- package/dist/homeAssistant.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mqtt/mqtt-client.js.map +1 -1
- package/dist/mqtt/mqtt.entity.js +41 -17
- package/dist/mqtt/mqtt.entity.js.map +1 -1
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +83 -13
- package/dist/platform.js.map +1 -1
- package/dist/utils/atomic-json-store.js +5 -1
- package/dist/utils/atomic-json-store.js.map +1 -1
- package/dist/utils/ha-state.js +3 -1
- package/dist/utils/ha-state.js.map +1 -1
- package/dist/utils/light-color.js +3 -5
- package/dist/utils/light-color.js.map +1 -1
- package/dist/utils/matter-command-response.js.map +1 -1
- package/dist/utils/matter-firmware.js +1 -2
- package/dist/utils/matter-firmware.js.map +1 -1
- package/dist/utils/matter-protocol.d.ts +1 -0
- package/dist/utils/matter-protocol.js +30 -0
- package/dist/utils/matter-protocol.js.map +1 -0
- package/package.json +27 -19
- package/dist/camera/camera-entity-control.d.ts +0 -12
- package/dist/camera/camera-entity-control.js +0 -24
- package/dist/camera/camera-entity-control.js.map +0 -1
- package/dist/camera/homekit/hevc/bootstrap.d.ts +0 -9
- package/dist/camera/homekit/hevc/bootstrap.js +0 -47
- package/dist/camera/homekit/hevc/bootstrap.js.map +0 -1
- package/dist/camera/homekit/hevc/recording-output.d.ts +0 -2
- package/dist/camera/homekit/hevc/recording-output.js +0 -33
- package/dist/camera/homekit/hevc/recording-output.js.map +0 -1
- package/dist/camera/homekit/media-policy.d.ts +0 -25
- package/dist/camera/homekit/media-policy.js +0 -102
- package/dist/camera/homekit/media-policy.js.map +0 -1
- package/dist/camera/homekit/route-address.d.ts +0 -2
- package/dist/camera/homekit/route-address.js +0 -27
- package/dist/camera/homekit/route-address.js.map +0 -1
- package/dist/camera/homekit/rtp-relay.d.ts +0 -21
- package/dist/camera/homekit/rtp-relay.js +0 -112
- package/dist/camera/homekit/rtp-relay.js.map +0 -1
- package/dist/camera/homekit/startup-timing.d.ts +0 -8
- package/dist/camera/homekit/startup-timing.js +0 -14
- package/dist/camera/homekit/startup-timing.js.map +0 -1
- package/dist/camera/source-adapter.d.ts +0 -132
- package/dist/camera/source-adapter.js +0 -282
- package/dist/camera/source-adapter.js.map +0 -1
- package/dist/frontend/assets/index-Bka3TVAQ.js +0 -21
- package/vendor/hap-nodejs/LICENSE +0 -176
- package/vendor/hap-nodejs/MIAO.md +0 -5
- package/vendor/hap-nodejs/PATCH.md +0 -37
- package/vendor/hap-nodejs/README.md +0 -86
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js +0 -128
- package/vendor/hap-nodejs/dist/accessories/AirConditioner_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js +0 -159
- package/vendor/hap-nodejs/dist/accessories/AppleTVRemote_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js +0 -545
- package/vendor/hap-nodejs/dist/accessories/Camera_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js +0 -74
- package/vendor/hap-nodejs/dist/accessories/Fan_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js +0 -78
- package/vendor/hap-nodejs/dist/accessories/GarageDoorOpener_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js +0 -106
- package/vendor/hap-nodejs/dist/accessories/Light-AdaptiveLighting_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js +0 -145
- package/vendor/hap-nodejs/dist/accessories/Light_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js +0 -76
- package/vendor/hap-nodejs/dist/accessories/Lock_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js +0 -45
- package/vendor/hap-nodejs/dist/accessories/MotionSensor_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js +0 -79
- package/vendor/hap-nodejs/dist/accessories/Outlet_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js +0 -44
- package/vendor/hap-nodejs/dist/accessories/SmartSpeaker_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js +0 -128
- package/vendor/hap-nodejs/dist/accessories/Sprinkler_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js +0 -101
- package/vendor/hap-nodejs/dist/accessories/TV_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts +0 -2
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js +0 -44
- package/vendor/hap-nodejs/dist/accessories/TemperatureSensor_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts +0 -3
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js +0 -17
- package/vendor/hap-nodejs/dist/accessories/Wi-FiRouter_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts +0 -3
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js +0 -19
- package/vendor/hap-nodejs/dist/accessories/Wi-FiSatellite_accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts +0 -25
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js +0 -145
- package/vendor/hap-nodejs/dist/accessories/gstreamer-audioProducer.js.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/types.d.ts +0 -78
- package/vendor/hap-nodejs/dist/accessories/types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/accessories/types.js +0 -88
- package/vendor/hap-nodejs/dist/accessories/types.js.map +0 -1
- package/vendor/hap-nodejs/dist/index.d.ts +0 -50
- package/vendor/hap-nodejs/dist/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/index.js +0 -54
- package/vendor/hap-nodejs/dist/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/internal-types.d.ts +0 -76
- package/vendor/hap-nodejs/dist/internal-types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/internal-types.js +0 -80
- package/vendor/hap-nodejs/dist/internal-types.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts +0 -521
- package/vendor/hap-nodejs/dist/lib/Accessory.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Accessory.js +0 -1762
- package/vendor/hap-nodejs/dist/lib/Accessory.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts +0 -190
- package/vendor/hap-nodejs/dist/lib/Advertiser.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Advertiser.js +0 -592
- package/vendor/hap-nodejs/dist/lib/Advertiser.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts +0 -12
- package/vendor/hap-nodejs/dist/lib/Bridge.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Bridge.js +0 -19
- package/vendor/hap-nodejs/dist/lib/Bridge.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts +0 -1768
- package/vendor/hap-nodejs/dist/lib/Characteristic.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Characteristic.js +0 -2532
- package/vendor/hap-nodejs/dist/lib/Characteristic.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts +0 -299
- package/vendor/hap-nodejs/dist/lib/HAPServer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/HAPServer.js +0 -968
- package/vendor/hap-nodejs/dist/lib/HAPServer.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Service.d.ts +0 -598
- package/vendor/hap-nodejs/dist/lib/Service.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/Service.js +0 -797
- package/vendor/hap-nodejs/dist/lib/Service.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts +0 -102
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js +0 -317
- package/vendor/hap-nodejs/dist/lib/camera/CMAFIngest.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts +0 -38
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js +0 -174
- package/vendor/hap-nodejs/dist/lib/camera/HDSSnapshotTransport.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts +0 -59
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js +0 -267
- package/vendor/hap-nodejs/dist/lib/camera/RTPProxy.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts +0 -379
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js +0 -1021
- package/vendor/hap-nodejs/dist/lib/camera/RTPStreamManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts +0 -325
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js +0 -800
- package/vendor/hap-nodejs/dist/lib/camera/RecordingManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts +0 -20
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js +0 -48
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoCredentials.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts +0 -618
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js +0 -911
- package/vendor/hap-nodejs/dist/lib/camera/SecureVideoTypes.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/camera/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/camera/index.js +0 -11
- package/vendor/hap-nodejs/dist/lib/camera/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts +0 -452
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js +0 -868
- package/vendor/hap-nodejs/dist/lib/controller/AdaptiveLightingController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts +0 -410
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js +0 -658
- package/vendor/hap-nodejs/dist/lib/controller/CameraController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts +0 -197
- package/vendor/hap-nodejs/dist/lib/controller/Controller.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js +0 -32
- package/vendor/hap-nodejs/dist/lib/controller/Controller.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts +0 -59
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js +0 -102
- package/vendor/hap-nodejs/dist/lib/controller/DoorbellController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts +0 -434
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js +0 -1178
- package/vendor/hap-nodejs/dist/lib/controller/RemoteController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts +0 -380
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js +0 -947
- package/vendor/hap-nodejs/dist/lib/controller/SecureVideoController.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/controller/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/controller/index.js +0 -10
- package/vendor/hap-nodejs/dist/lib/controller/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts +0 -73
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js +0 -205
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts +0 -186
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js +0 -880
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamParser.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts +0 -351
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js +0 -878
- package/vendor/hap-nodejs/dist/lib/datastream/DataStreamServer.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts +0 -4
- package/vendor/hap-nodejs/dist/lib/datastream/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/datastream/index.js +0 -7
- package/vendor/hap-nodejs/dist/lib/datastream/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts +0 -2245
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js +0 -4957
- package/vendor/hap-nodejs/dist/lib/definitions/CharacteristicDefinitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts +0 -584
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js +0 -1518
- package/vendor/hap-nodejs/dist/lib/definitions/ServiceDefinitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts +0 -34
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js +0 -624
- package/vendor/hap-nodejs/dist/lib/definitions/generate-definitions.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts +0 -22
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js +0 -734
- package/vendor/hap-nodejs/dist/lib/definitions/generator-configuration.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts +0 -3
- package/vendor/hap-nodejs/dist/lib/definitions/index.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/definitions/index.js +0 -6
- package/vendor/hap-nodejs/dist/lib/definitions/index.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js +0 -9
- package/vendor/hap-nodejs/dist/lib/gen/HomeKit.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts +0 -91
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js +0 -311
- package/vendor/hap-nodejs/dist/lib/model/AccessoryInfo.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts +0 -46
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js +0 -277
- package/vendor/hap-nodejs/dist/lib/model/ControllerStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts +0 -75
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js +0 -190
- package/vendor/hap-nodejs/dist/lib/model/HAPFileStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts +0 -26
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js +0 -79
- package/vendor/hap-nodejs/dist/lib/model/HAPStorage.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts +0 -33
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js +0 -114
- package/vendor/hap-nodejs/dist/lib/model/IdentifierCache.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts +0 -83
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js +0 -127
- package/vendor/hap-nodejs/dist/lib/tv/AccessControlManagement.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts +0 -8
- package/vendor/hap-nodejs/dist/lib/util/checkName.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/checkName.js +0 -28
- package/vendor/hap-nodejs/dist/lib/util/checkName.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/util/clone.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/clone.js +0 -22
- package/vendor/hap-nodejs/dist/lib/util/clone.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts +0 -18
- package/vendor/hap-nodejs/dist/lib/util/color-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js +0 -442
- package/vendor/hap-nodejs/dist/lib/util/color-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts +0 -251
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js +0 -714
- package/vendor/hap-nodejs/dist/lib/util/eventedhttp.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts +0 -50
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js +0 -185
- package/vendor/hap-nodejs/dist/lib/util/hapCrypto.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts +0 -16
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js +0 -29
- package/vendor/hap-nodejs/dist/lib/util/hapStatusError.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts +0 -21
- package/vendor/hap-nodejs/dist/lib/util/net-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js +0 -79
- package/vendor/hap-nodejs/dist/lib/util/net-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts +0 -7
- package/vendor/hap-nodejs/dist/lib/util/once.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/once.js +0 -22
- package/vendor/hap-nodejs/dist/lib/util/once.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts +0 -14
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js +0 -29
- package/vendor/hap-nodejs/dist/lib/util/promise-utils.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts +0 -36
- package/vendor/hap-nodejs/dist/lib/util/request-util.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/request-util.js +0 -108
- package/vendor/hap-nodejs/dist/lib/util/request-util.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts +0 -9
- package/vendor/hap-nodejs/dist/lib/util/time.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/time.js +0 -23
- package/vendor/hap-nodejs/dist/lib/util/time.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts +0 -90
- package/vendor/hap-nodejs/dist/lib/util/tlv.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/tlv.js +0 -318
- package/vendor/hap-nodejs/dist/lib/util/tlv.js.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts +0 -23
- package/vendor/hap-nodejs/dist/lib/util/uuid.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/lib/util/uuid.js +0 -78
- package/vendor/hap-nodejs/dist/lib/util/uuid.js.map +0 -1
- package/vendor/hap-nodejs/dist/types.d.ts +0 -276
- package/vendor/hap-nodejs/dist/types.d.ts.map +0 -1
- package/vendor/hap-nodejs/dist/types.js +0 -11
- package/vendor/hap-nodejs/dist/types.js.map +0 -1
- package/vendor/hap-nodejs/package.json +0 -53
- package/vendor/hap-nodejs/src/lib/util/hapCrypto.ts +0 -208
|
@@ -1,880 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataStreamWriter = exports.DataStreamReader = exports.DataStreamParser = exports.DataFormatTags = exports.UUID = exports.SecondsSince2001 = exports.Float64 = exports.Float32 = exports.Int64 = exports.Int32 = exports.Int16 = exports.Int8 = exports.ValueWrapper = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const uuid = tslib_1.__importStar(require("../util/uuid"));
|
|
6
|
-
const hapCrypto = tslib_1.__importStar(require("../util/hapCrypto"));
|
|
7
|
-
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
8
|
-
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
9
|
-
// welcome to hell :)
|
|
10
|
-
// in this file lies madness and frustration. and It's not only about HDS. Also, JavaScript is hell
|
|
11
|
-
const debug = (0, debug_1.default)("HAP-NodeJS:DataStream:Parser");
|
|
12
|
-
class Magics {
|
|
13
|
-
static TERMINATOR = { type: "terminator" };
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @group HomeKit Data Streams (HDS)
|
|
17
|
-
*/
|
|
18
|
-
class ValueWrapper {
|
|
19
|
-
value;
|
|
20
|
-
constructor(value) {
|
|
21
|
-
this.value = value;
|
|
22
|
-
}
|
|
23
|
-
equals(obj) {
|
|
24
|
-
return this.constructor.name === obj.constructor.name && obj.value === this.value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.ValueWrapper = ValueWrapper;
|
|
28
|
-
/**
|
|
29
|
-
* @group HomeKit Data Streams (HDS)
|
|
30
|
-
*/
|
|
31
|
-
class Int8 extends ValueWrapper {
|
|
32
|
-
}
|
|
33
|
-
exports.Int8 = Int8;
|
|
34
|
-
/**
|
|
35
|
-
* @group HomeKit Data Streams (HDS)
|
|
36
|
-
*/
|
|
37
|
-
class Int16 extends ValueWrapper {
|
|
38
|
-
}
|
|
39
|
-
exports.Int16 = Int16;
|
|
40
|
-
/**
|
|
41
|
-
* @group HomeKit Data Streams (HDS)
|
|
42
|
-
*/
|
|
43
|
-
class Int32 extends ValueWrapper {
|
|
44
|
-
}
|
|
45
|
-
exports.Int32 = Int32;
|
|
46
|
-
/**
|
|
47
|
-
* @group HomeKit Data Streams (HDS)
|
|
48
|
-
*/
|
|
49
|
-
class Int64 extends ValueWrapper {
|
|
50
|
-
}
|
|
51
|
-
exports.Int64 = Int64;
|
|
52
|
-
/**
|
|
53
|
-
* @group HomeKit Data Streams (HDS)
|
|
54
|
-
*/
|
|
55
|
-
class Float32 extends ValueWrapper {
|
|
56
|
-
}
|
|
57
|
-
exports.Float32 = Float32;
|
|
58
|
-
/**
|
|
59
|
-
* @group HomeKit Data Streams (HDS)
|
|
60
|
-
*/
|
|
61
|
-
class Float64 extends ValueWrapper {
|
|
62
|
-
}
|
|
63
|
-
exports.Float64 = Float64;
|
|
64
|
-
/**
|
|
65
|
-
* @group HomeKit Data Streams (HDS)
|
|
66
|
-
*/
|
|
67
|
-
class SecondsSince2001 extends ValueWrapper {
|
|
68
|
-
}
|
|
69
|
-
exports.SecondsSince2001 = SecondsSince2001;
|
|
70
|
-
/**
|
|
71
|
-
* @group HomeKit Data Streams (HDS)
|
|
72
|
-
*/
|
|
73
|
-
class UUID extends ValueWrapper {
|
|
74
|
-
constructor(value) {
|
|
75
|
-
(0, assert_1.default)(uuid.isValid(value), "invalid uuid format");
|
|
76
|
-
super(value);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.UUID = UUID;
|
|
80
|
-
/**
|
|
81
|
-
* @group HomeKit Data Streams (HDS)
|
|
82
|
-
*/
|
|
83
|
-
var DataFormatTags;
|
|
84
|
-
(function (DataFormatTags) {
|
|
85
|
-
DataFormatTags[DataFormatTags["INVALID"] = 0] = "INVALID";
|
|
86
|
-
DataFormatTags[DataFormatTags["TRUE"] = 1] = "TRUE";
|
|
87
|
-
DataFormatTags[DataFormatTags["FALSE"] = 2] = "FALSE";
|
|
88
|
-
DataFormatTags[DataFormatTags["TERMINATOR"] = 3] = "TERMINATOR";
|
|
89
|
-
DataFormatTags[DataFormatTags["NULL"] = 4] = "NULL";
|
|
90
|
-
DataFormatTags[DataFormatTags["UUID"] = 5] = "UUID";
|
|
91
|
-
DataFormatTags[DataFormatTags["DATE"] = 6] = "DATE";
|
|
92
|
-
DataFormatTags[DataFormatTags["INTEGER_MINUS_ONE"] = 7] = "INTEGER_MINUS_ONE";
|
|
93
|
-
DataFormatTags[DataFormatTags["INTEGER_RANGE_START_0"] = 8] = "INTEGER_RANGE_START_0";
|
|
94
|
-
DataFormatTags[DataFormatTags["INTEGER_RANGE_STOP_39"] = 46] = "INTEGER_RANGE_STOP_39";
|
|
95
|
-
DataFormatTags[DataFormatTags["INT8"] = 48] = "INT8";
|
|
96
|
-
DataFormatTags[DataFormatTags["INT16LE"] = 49] = "INT16LE";
|
|
97
|
-
DataFormatTags[DataFormatTags["INT32LE"] = 50] = "INT32LE";
|
|
98
|
-
DataFormatTags[DataFormatTags["INT64LE"] = 51] = "INT64LE";
|
|
99
|
-
DataFormatTags[DataFormatTags["FLOAT32LE"] = 53] = "FLOAT32LE";
|
|
100
|
-
DataFormatTags[DataFormatTags["FLOAT64LE"] = 54] = "FLOAT64LE";
|
|
101
|
-
DataFormatTags[DataFormatTags["UTF8_LENGTH_START"] = 64] = "UTF8_LENGTH_START";
|
|
102
|
-
DataFormatTags[DataFormatTags["UTF8_LENGTH_STOP"] = 96] = "UTF8_LENGTH_STOP";
|
|
103
|
-
DataFormatTags[DataFormatTags["UTF8_LENGTH8"] = 97] = "UTF8_LENGTH8";
|
|
104
|
-
DataFormatTags[DataFormatTags["UTF8_LENGTH16LE"] = 98] = "UTF8_LENGTH16LE";
|
|
105
|
-
DataFormatTags[DataFormatTags["UTF8_LENGTH32LE"] = 99] = "UTF8_LENGTH32LE";
|
|
106
|
-
DataFormatTags[DataFormatTags["UTF8_LENGTH64LE"] = 100] = "UTF8_LENGTH64LE";
|
|
107
|
-
DataFormatTags[DataFormatTags["UTF8_NULL_TERMINATED"] = 111] = "UTF8_NULL_TERMINATED";
|
|
108
|
-
DataFormatTags[DataFormatTags["DATA_LENGTH_START"] = 112] = "DATA_LENGTH_START";
|
|
109
|
-
DataFormatTags[DataFormatTags["DATA_LENGTH_STOP"] = 144] = "DATA_LENGTH_STOP";
|
|
110
|
-
DataFormatTags[DataFormatTags["DATA_LENGTH8"] = 145] = "DATA_LENGTH8";
|
|
111
|
-
DataFormatTags[DataFormatTags["DATA_LENGTH16LE"] = 146] = "DATA_LENGTH16LE";
|
|
112
|
-
DataFormatTags[DataFormatTags["DATA_LENGTH32LE"] = 147] = "DATA_LENGTH32LE";
|
|
113
|
-
DataFormatTags[DataFormatTags["DATA_LENGTH64LE"] = 148] = "DATA_LENGTH64LE";
|
|
114
|
-
DataFormatTags[DataFormatTags["DATA_TERMINATED"] = 159] = "DATA_TERMINATED";
|
|
115
|
-
DataFormatTags[DataFormatTags["COMPRESSION_START"] = 160] = "COMPRESSION_START";
|
|
116
|
-
DataFormatTags[DataFormatTags["COMPRESSION_STOP"] = 207] = "COMPRESSION_STOP";
|
|
117
|
-
DataFormatTags[DataFormatTags["ARRAY_LENGTH_START"] = 208] = "ARRAY_LENGTH_START";
|
|
118
|
-
DataFormatTags[DataFormatTags["ARRAY_LENGTH_STOP"] = 222] = "ARRAY_LENGTH_STOP";
|
|
119
|
-
DataFormatTags[DataFormatTags["ARRAY_TERMINATED"] = 223] = "ARRAY_TERMINATED";
|
|
120
|
-
DataFormatTags[DataFormatTags["DICTIONARY_LENGTH_START"] = 224] = "DICTIONARY_LENGTH_START";
|
|
121
|
-
DataFormatTags[DataFormatTags["DICTIONARY_LENGTH_STOP"] = 238] = "DICTIONARY_LENGTH_STOP";
|
|
122
|
-
DataFormatTags[DataFormatTags["DICTIONARY_TERMINATED"] = 239] = "DICTIONARY_TERMINATED";
|
|
123
|
-
})(DataFormatTags || (exports.DataFormatTags = DataFormatTags = {}));
|
|
124
|
-
/**
|
|
125
|
-
* @group HomeKit Data Streams (HDS)
|
|
126
|
-
*/
|
|
127
|
-
class DataStreamParser {
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
|
-
static decode(buffer) {
|
|
130
|
-
const tag = buffer.readTag();
|
|
131
|
-
if (tag === 0 /* DataFormatTags.INVALID */) {
|
|
132
|
-
throw new Error("HDSDecoder: zero tag detected on index " + buffer.readerIndex);
|
|
133
|
-
}
|
|
134
|
-
else if (tag === 1 /* DataFormatTags.TRUE */) {
|
|
135
|
-
return buffer.readTrue();
|
|
136
|
-
}
|
|
137
|
-
else if (tag === 2 /* DataFormatTags.FALSE */) {
|
|
138
|
-
return buffer.readFalse();
|
|
139
|
-
}
|
|
140
|
-
else if (tag === 3 /* DataFormatTags.TERMINATOR */) {
|
|
141
|
-
return Magics.TERMINATOR;
|
|
142
|
-
}
|
|
143
|
-
else if (tag === 4 /* DataFormatTags.NULL */) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
else if (tag === 5 /* DataFormatTags.UUID */) {
|
|
147
|
-
return buffer.readUUID();
|
|
148
|
-
}
|
|
149
|
-
else if (tag === 6 /* DataFormatTags.DATE */) {
|
|
150
|
-
return buffer.readSecondsSince2001_01_01();
|
|
151
|
-
}
|
|
152
|
-
else if (tag === 7 /* DataFormatTags.INTEGER_MINUS_ONE */) {
|
|
153
|
-
return buffer.readNegOne();
|
|
154
|
-
}
|
|
155
|
-
else if (tag >= 8 /* DataFormatTags.INTEGER_RANGE_START_0 */ && tag <= 46 /* DataFormatTags.INTEGER_RANGE_STOP_39 */) {
|
|
156
|
-
return buffer.readIntRange(tag); // integer values from 0-39
|
|
157
|
-
}
|
|
158
|
-
else if (tag === 48 /* DataFormatTags.INT8 */) {
|
|
159
|
-
return buffer.readInt8();
|
|
160
|
-
}
|
|
161
|
-
else if (tag === 49 /* DataFormatTags.INT16LE */) {
|
|
162
|
-
return buffer.readInt16LE();
|
|
163
|
-
}
|
|
164
|
-
else if (tag === 50 /* DataFormatTags.INT32LE */) {
|
|
165
|
-
return buffer.readInt32LE();
|
|
166
|
-
}
|
|
167
|
-
else if (tag === 51 /* DataFormatTags.INT64LE */) {
|
|
168
|
-
return buffer.readInt64LE();
|
|
169
|
-
}
|
|
170
|
-
else if (tag === 53 /* DataFormatTags.FLOAT32LE */) {
|
|
171
|
-
return buffer.readFloat32LE();
|
|
172
|
-
}
|
|
173
|
-
else if (tag === 54 /* DataFormatTags.FLOAT64LE */) {
|
|
174
|
-
return buffer.readFloat64LE();
|
|
175
|
-
}
|
|
176
|
-
else if (tag >= 64 /* DataFormatTags.UTF8_LENGTH_START */ && tag <= 96 /* DataFormatTags.UTF8_LENGTH_STOP */) {
|
|
177
|
-
const length = tag - 64 /* DataFormatTags.UTF8_LENGTH_START */;
|
|
178
|
-
return buffer.readUTF8(length);
|
|
179
|
-
}
|
|
180
|
-
else if (tag === 97 /* DataFormatTags.UTF8_LENGTH8 */) {
|
|
181
|
-
return buffer.readUTF8_Length8();
|
|
182
|
-
}
|
|
183
|
-
else if (tag === 98 /* DataFormatTags.UTF8_LENGTH16LE */) {
|
|
184
|
-
return buffer.readUTF8_Length16LE();
|
|
185
|
-
}
|
|
186
|
-
else if (tag === 99 /* DataFormatTags.UTF8_LENGTH32LE */) {
|
|
187
|
-
return buffer.readUTF8_Length32LE();
|
|
188
|
-
}
|
|
189
|
-
else if (tag === 100 /* DataFormatTags.UTF8_LENGTH64LE */) {
|
|
190
|
-
return buffer.readUTF8_Length64LE();
|
|
191
|
-
}
|
|
192
|
-
else if (tag === 111 /* DataFormatTags.UTF8_NULL_TERMINATED */) {
|
|
193
|
-
return buffer.readUTF8_NULL_terminated();
|
|
194
|
-
}
|
|
195
|
-
else if (tag >= 112 /* DataFormatTags.DATA_LENGTH_START */ && tag <= 144 /* DataFormatTags.DATA_LENGTH_STOP */) {
|
|
196
|
-
const length = tag - 112 /* DataFormatTags.DATA_LENGTH_START */;
|
|
197
|
-
buffer.readData(length);
|
|
198
|
-
}
|
|
199
|
-
else if (tag === 145 /* DataFormatTags.DATA_LENGTH8 */) {
|
|
200
|
-
return buffer.readData_Length8();
|
|
201
|
-
}
|
|
202
|
-
else if (tag === 146 /* DataFormatTags.DATA_LENGTH16LE */) {
|
|
203
|
-
return buffer.readData_Length16LE();
|
|
204
|
-
}
|
|
205
|
-
else if (tag === 147 /* DataFormatTags.DATA_LENGTH32LE */) {
|
|
206
|
-
return buffer.readData_Length32LE();
|
|
207
|
-
}
|
|
208
|
-
else if (tag === 148 /* DataFormatTags.DATA_LENGTH64LE */) {
|
|
209
|
-
return buffer.readData_Length64LE();
|
|
210
|
-
}
|
|
211
|
-
else if (tag === 159 /* DataFormatTags.DATA_TERMINATED */) {
|
|
212
|
-
return buffer.readData_terminated();
|
|
213
|
-
}
|
|
214
|
-
else if (tag >= 160 /* DataFormatTags.COMPRESSION_START */ && tag <= 207 /* DataFormatTags.COMPRESSION_STOP */) {
|
|
215
|
-
const index = tag - 160 /* DataFormatTags.COMPRESSION_START */;
|
|
216
|
-
return buffer.decompressData(index);
|
|
217
|
-
}
|
|
218
|
-
else if (tag >= 208 /* DataFormatTags.ARRAY_LENGTH_START */ && tag <= 222 /* DataFormatTags.ARRAY_LENGTH_STOP */) {
|
|
219
|
-
const length = tag - 208 /* DataFormatTags.ARRAY_LENGTH_START */;
|
|
220
|
-
const array = [];
|
|
221
|
-
for (let i = 0; i < length; i++) {
|
|
222
|
-
array.push(this.decode(buffer));
|
|
223
|
-
}
|
|
224
|
-
return array;
|
|
225
|
-
}
|
|
226
|
-
else if (tag === 223 /* DataFormatTags.ARRAY_TERMINATED */) {
|
|
227
|
-
const array = [];
|
|
228
|
-
let element;
|
|
229
|
-
while ((element = this.decode(buffer)) !== Magics.TERMINATOR) {
|
|
230
|
-
array.push(element);
|
|
231
|
-
}
|
|
232
|
-
return array;
|
|
233
|
-
}
|
|
234
|
-
else if (tag >= 224 /* DataFormatTags.DICTIONARY_LENGTH_START */ && tag <= 238 /* DataFormatTags.DICTIONARY_LENGTH_STOP */) {
|
|
235
|
-
const length = tag - 224 /* DataFormatTags.DICTIONARY_LENGTH_START */;
|
|
236
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
237
|
-
const dictionary = {};
|
|
238
|
-
for (let i = 0; i < length; i++) {
|
|
239
|
-
const key = this.decode(buffer);
|
|
240
|
-
dictionary[key] = this.decode(buffer);
|
|
241
|
-
}
|
|
242
|
-
return dictionary;
|
|
243
|
-
}
|
|
244
|
-
else if (tag === 239 /* DataFormatTags.DICTIONARY_TERMINATED */) {
|
|
245
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
246
|
-
const dictionary = {};
|
|
247
|
-
let key;
|
|
248
|
-
while ((key = this.decode(buffer)) !== Magics.TERMINATOR) {
|
|
249
|
-
dictionary[key] = this.decode(buffer); // decode value
|
|
250
|
-
}
|
|
251
|
-
return dictionary;
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
throw new Error("HDSDecoder: encountered unknown tag on index " + buffer.readerIndex + ": " + tag.toString(16));
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any
|
|
258
|
-
static encode(data, buffer) {
|
|
259
|
-
if (data === undefined) {
|
|
260
|
-
throw new Error("HDSEncoder: cannot encode undefined");
|
|
261
|
-
}
|
|
262
|
-
if (data === null) {
|
|
263
|
-
buffer.writeTag(4 /* DataFormatTags.NULL */);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
switch (typeof data) {
|
|
267
|
-
case "boolean":
|
|
268
|
-
if (data) {
|
|
269
|
-
buffer.writeTrue();
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
buffer.writeFalse();
|
|
273
|
-
}
|
|
274
|
-
break;
|
|
275
|
-
case "number":
|
|
276
|
-
if (Number.isInteger(data)) {
|
|
277
|
-
buffer.writeNumber(data);
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
buffer.writeFloat64LE(new Float64(data));
|
|
281
|
-
}
|
|
282
|
-
break;
|
|
283
|
-
case "string":
|
|
284
|
-
buffer.writeUTF8(data);
|
|
285
|
-
break;
|
|
286
|
-
case "object":
|
|
287
|
-
if (Array.isArray(data)) {
|
|
288
|
-
const length = data.length;
|
|
289
|
-
if (length <= 12) {
|
|
290
|
-
buffer.writeTag(208 /* DataFormatTags.ARRAY_LENGTH_START */ + length);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
buffer.writeTag(223 /* DataFormatTags.ARRAY_TERMINATED */);
|
|
294
|
-
}
|
|
295
|
-
data.forEach(element => {
|
|
296
|
-
this.encode(element, buffer);
|
|
297
|
-
});
|
|
298
|
-
if (length > 12) {
|
|
299
|
-
buffer.writeTag(3 /* DataFormatTags.TERMINATOR */);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
else if (data instanceof ValueWrapper) {
|
|
303
|
-
if (data instanceof Int8) {
|
|
304
|
-
buffer.writeInt8(data);
|
|
305
|
-
}
|
|
306
|
-
else if (data instanceof Int16) {
|
|
307
|
-
buffer.writeInt16LE(data);
|
|
308
|
-
}
|
|
309
|
-
else if (data instanceof Int32) {
|
|
310
|
-
buffer.writeInt32LE(data);
|
|
311
|
-
}
|
|
312
|
-
else if (data instanceof Int64) {
|
|
313
|
-
buffer.writeInt64LE(data);
|
|
314
|
-
}
|
|
315
|
-
else if (data instanceof Float32) {
|
|
316
|
-
buffer.writeFloat32LE(data);
|
|
317
|
-
}
|
|
318
|
-
else if (data instanceof Float64) {
|
|
319
|
-
buffer.writeFloat64LE(data);
|
|
320
|
-
}
|
|
321
|
-
else if (data instanceof SecondsSince2001) {
|
|
322
|
-
buffer.writeSecondsSince2001_01_01(data);
|
|
323
|
-
}
|
|
324
|
-
else if (data instanceof UUID) {
|
|
325
|
-
buffer.writeUUID(data.value);
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
throw new Error("Unknown wrapped object 'ValueWrapper' of class " + data.constructor.name);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
else if (data instanceof Buffer) {
|
|
332
|
-
buffer.writeData(data);
|
|
333
|
-
}
|
|
334
|
-
else { // object is treated as dictionary
|
|
335
|
-
const entries = Object.entries(data)
|
|
336
|
-
.filter(entry => entry[1] !== undefined); // explicitly setting undefined will result in an entry here
|
|
337
|
-
if (entries.length <= 14) {
|
|
338
|
-
buffer.writeTag(224 /* DataFormatTags.DICTIONARY_LENGTH_START */ + entries.length);
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
buffer.writeTag(239 /* DataFormatTags.DICTIONARY_TERMINATED */);
|
|
342
|
-
}
|
|
343
|
-
entries.forEach(entry => {
|
|
344
|
-
this.encode(entry[0], buffer); // encode key
|
|
345
|
-
this.encode(entry[1], buffer); // encode value
|
|
346
|
-
});
|
|
347
|
-
if (entries.length > 14) {
|
|
348
|
-
buffer.writeTag(3 /* DataFormatTags.TERMINATOR */);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
break;
|
|
352
|
-
default:
|
|
353
|
-
throw new Error("HDSEncoder: no idea how to encode value of type '" + (typeof data) + "': " + data);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
exports.DataStreamParser = DataStreamParser;
|
|
358
|
-
/**
|
|
359
|
-
* @group HomeKit Data Streams (HDS)
|
|
360
|
-
*/
|
|
361
|
-
class DataStreamReader {
|
|
362
|
-
data;
|
|
363
|
-
readerIndex;
|
|
364
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
365
|
-
trackedCompressedData = [];
|
|
366
|
-
constructor(data) {
|
|
367
|
-
this.data = data;
|
|
368
|
-
this.readerIndex = 0;
|
|
369
|
-
}
|
|
370
|
-
finished() {
|
|
371
|
-
if (this.readerIndex < this.data.length) {
|
|
372
|
-
const remainingHex = this.data.subarray(this.readerIndex, this.data.length).toString("hex");
|
|
373
|
-
debug("WARNING Finished reading HDS stream, but there are still %d bytes remaining () %s", this.data.length - this.readerIndex, remainingHex);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
377
|
-
decompressData(index) {
|
|
378
|
-
if (index >= this.trackedCompressedData.length) {
|
|
379
|
-
throw new Error("HDSDecoder: Tried decompression of data for an index out of range (index " + index +
|
|
380
|
-
" and got " + this.trackedCompressedData.length + " elements)");
|
|
381
|
-
}
|
|
382
|
-
return this.trackedCompressedData[index];
|
|
383
|
-
}
|
|
384
|
-
trackData(data) {
|
|
385
|
-
this.trackedCompressedData.push(data);
|
|
386
|
-
return data;
|
|
387
|
-
}
|
|
388
|
-
ensureLength(bytes) {
|
|
389
|
-
if (this.readerIndex + bytes > this.data.length) {
|
|
390
|
-
const remaining = this.data.length - this.readerIndex;
|
|
391
|
-
throw new Error("HDSDecoder: End of data stream. Tried reading " + bytes + " bytes however got only " + remaining + " remaining!");
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
readTag() {
|
|
395
|
-
this.ensureLength(1);
|
|
396
|
-
return this.data.readUInt8(this.readerIndex++);
|
|
397
|
-
}
|
|
398
|
-
readTrue() {
|
|
399
|
-
return this.trackData(true); // do those tag encoded values get cached?
|
|
400
|
-
}
|
|
401
|
-
readFalse() {
|
|
402
|
-
return this.trackData(false);
|
|
403
|
-
}
|
|
404
|
-
readNegOne() {
|
|
405
|
-
return this.trackData(-1);
|
|
406
|
-
}
|
|
407
|
-
readIntRange(tag) {
|
|
408
|
-
return this.trackData(tag - 8 /* DataFormatTags.INTEGER_RANGE_START_0 */); // integer values from 0-39
|
|
409
|
-
}
|
|
410
|
-
readInt8() {
|
|
411
|
-
this.ensureLength(1);
|
|
412
|
-
return this.trackData(this.data.readInt8(this.readerIndex++));
|
|
413
|
-
}
|
|
414
|
-
readInt16LE() {
|
|
415
|
-
this.ensureLength(2);
|
|
416
|
-
const value = this.data.readInt16LE(this.readerIndex);
|
|
417
|
-
this.readerIndex += 2;
|
|
418
|
-
return this.trackData(value);
|
|
419
|
-
}
|
|
420
|
-
readInt32LE() {
|
|
421
|
-
this.ensureLength(4);
|
|
422
|
-
const value = this.data.readInt32LE(this.readerIndex);
|
|
423
|
-
this.readerIndex += 4;
|
|
424
|
-
return this.trackData(value);
|
|
425
|
-
}
|
|
426
|
-
readInt64LE() {
|
|
427
|
-
this.ensureLength(8);
|
|
428
|
-
const low = this.data.readInt32LE(this.readerIndex);
|
|
429
|
-
let value = this.data.readInt32LE(this.readerIndex + 4) * 0x100000000 + low;
|
|
430
|
-
if (low < 0) {
|
|
431
|
-
value += 0x100000000;
|
|
432
|
-
}
|
|
433
|
-
this.readerIndex += 8;
|
|
434
|
-
return this.trackData(value);
|
|
435
|
-
}
|
|
436
|
-
readFloat32LE() {
|
|
437
|
-
this.ensureLength(4);
|
|
438
|
-
const value = this.data.readFloatLE(this.readerIndex);
|
|
439
|
-
this.readerIndex += 4;
|
|
440
|
-
return this.trackData(value);
|
|
441
|
-
}
|
|
442
|
-
readFloat64LE() {
|
|
443
|
-
this.ensureLength(8);
|
|
444
|
-
const value = this.data.readDoubleLE(this.readerIndex);
|
|
445
|
-
this.readerIndex += 8;
|
|
446
|
-
return this.trackData(value);
|
|
447
|
-
}
|
|
448
|
-
readLength8() {
|
|
449
|
-
this.ensureLength(1);
|
|
450
|
-
return this.data.readUInt8(this.readerIndex++);
|
|
451
|
-
}
|
|
452
|
-
readLength16LE() {
|
|
453
|
-
this.ensureLength(2);
|
|
454
|
-
const value = this.data.readUInt16LE(this.readerIndex);
|
|
455
|
-
this.readerIndex += 2;
|
|
456
|
-
return value;
|
|
457
|
-
}
|
|
458
|
-
readLength32LE() {
|
|
459
|
-
this.ensureLength(4);
|
|
460
|
-
const value = this.data.readUInt32LE(this.readerIndex);
|
|
461
|
-
this.readerIndex += 4;
|
|
462
|
-
return value;
|
|
463
|
-
}
|
|
464
|
-
readLength64LE() {
|
|
465
|
-
this.ensureLength(8);
|
|
466
|
-
const low = this.data.readUInt32LE(this.readerIndex);
|
|
467
|
-
const value = this.data.readUInt32LE(this.readerIndex + 4) * 0x100000000 + low;
|
|
468
|
-
this.readerIndex += 8;
|
|
469
|
-
return value;
|
|
470
|
-
}
|
|
471
|
-
readUTF8(length) {
|
|
472
|
-
this.ensureLength(length);
|
|
473
|
-
const value = this.data.toString("utf8", this.readerIndex, this.readerIndex + length);
|
|
474
|
-
this.readerIndex += length;
|
|
475
|
-
return this.trackData(value);
|
|
476
|
-
}
|
|
477
|
-
readUTF8_Length8() {
|
|
478
|
-
const length = this.readLength8();
|
|
479
|
-
return this.readUTF8(length);
|
|
480
|
-
}
|
|
481
|
-
readUTF8_Length16LE() {
|
|
482
|
-
const length = this.readLength16LE();
|
|
483
|
-
return this.readUTF8(length);
|
|
484
|
-
}
|
|
485
|
-
readUTF8_Length32LE() {
|
|
486
|
-
const length = this.readLength32LE();
|
|
487
|
-
return this.readUTF8(length);
|
|
488
|
-
}
|
|
489
|
-
readUTF8_Length64LE() {
|
|
490
|
-
const length = this.readLength64LE();
|
|
491
|
-
return this.readUTF8(length);
|
|
492
|
-
}
|
|
493
|
-
readUTF8_NULL_terminated() {
|
|
494
|
-
let offset = this.readerIndex;
|
|
495
|
-
let nextByte;
|
|
496
|
-
for (;;) {
|
|
497
|
-
nextByte = this.data[offset];
|
|
498
|
-
if (nextByte === undefined) {
|
|
499
|
-
throw new Error("HDSDecoder: Reached end of data stream while reading NUL terminated string!");
|
|
500
|
-
}
|
|
501
|
-
else if (nextByte === 0) {
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
else {
|
|
505
|
-
offset++;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
const value = this.data.toString("utf8", this.readerIndex, offset);
|
|
509
|
-
this.readerIndex = offset + 1;
|
|
510
|
-
return this.trackData(value);
|
|
511
|
-
}
|
|
512
|
-
readData(length) {
|
|
513
|
-
this.ensureLength(length);
|
|
514
|
-
const value = this.data.subarray(this.readerIndex, this.readerIndex + length);
|
|
515
|
-
this.readerIndex += length;
|
|
516
|
-
return this.trackData(value);
|
|
517
|
-
}
|
|
518
|
-
readData_Length8() {
|
|
519
|
-
const length = this.readLength8();
|
|
520
|
-
return this.readData(length);
|
|
521
|
-
}
|
|
522
|
-
readData_Length16LE() {
|
|
523
|
-
const length = this.readLength16LE();
|
|
524
|
-
return this.readData(length);
|
|
525
|
-
}
|
|
526
|
-
readData_Length32LE() {
|
|
527
|
-
const length = this.readLength32LE();
|
|
528
|
-
return this.readData(length);
|
|
529
|
-
}
|
|
530
|
-
readData_Length64LE() {
|
|
531
|
-
const length = this.readLength64LE();
|
|
532
|
-
return this.readData(length);
|
|
533
|
-
}
|
|
534
|
-
readData_terminated() {
|
|
535
|
-
let offset = this.readerIndex;
|
|
536
|
-
let nextByte;
|
|
537
|
-
for (;;) {
|
|
538
|
-
nextByte = this.data[offset];
|
|
539
|
-
if (nextByte === undefined) {
|
|
540
|
-
throw new Error("HDSDecoder: Reached end of data stream while reading terminated data!");
|
|
541
|
-
}
|
|
542
|
-
else if (nextByte === 3 /* DataFormatTags.TERMINATOR */) {
|
|
543
|
-
break;
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
offset++;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
const value = this.data.subarray(this.readerIndex, offset);
|
|
550
|
-
this.readerIndex = offset + 1;
|
|
551
|
-
return this.trackData(value);
|
|
552
|
-
}
|
|
553
|
-
readSecondsSince2001_01_01() {
|
|
554
|
-
// second since 2001-01-01 00:00:00
|
|
555
|
-
return this.readFloat64LE();
|
|
556
|
-
}
|
|
557
|
-
readUUID() {
|
|
558
|
-
this.ensureLength(16);
|
|
559
|
-
const value = uuid.unparse(this.data, this.readerIndex);
|
|
560
|
-
this.readerIndex += 16;
|
|
561
|
-
return this.trackData(value);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
exports.DataStreamReader = DataStreamReader;
|
|
565
|
-
class WrittenDataList {
|
|
566
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
567
|
-
writtenData = [];
|
|
568
|
-
push(data) {
|
|
569
|
-
this.writtenData.push(data);
|
|
570
|
-
}
|
|
571
|
-
indexOf(data) {
|
|
572
|
-
for (let i = 0; i < this.writtenData.length; i++) {
|
|
573
|
-
const data0 = this.writtenData[i];
|
|
574
|
-
if (data === data0) {
|
|
575
|
-
return i;
|
|
576
|
-
}
|
|
577
|
-
if (data instanceof ValueWrapper && data0 instanceof ValueWrapper) {
|
|
578
|
-
if (data.equals(data0)) {
|
|
579
|
-
return i;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
return -1;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* @group HomeKit Data Streams (HDS)
|
|
588
|
-
*/
|
|
589
|
-
class DataStreamWriter {
|
|
590
|
-
static chunkSize = 128; // seems to be a good default
|
|
591
|
-
data;
|
|
592
|
-
writerIndex;
|
|
593
|
-
writtenData = new WrittenDataList();
|
|
594
|
-
constructor() {
|
|
595
|
-
this.data = Buffer.alloc(DataStreamWriter.chunkSize);
|
|
596
|
-
this.writerIndex = 0;
|
|
597
|
-
}
|
|
598
|
-
length() {
|
|
599
|
-
return this.writerIndex; // since writerIndex points to the next FREE index it also represents the length
|
|
600
|
-
}
|
|
601
|
-
getData() {
|
|
602
|
-
return this.data.subarray(0, this.writerIndex);
|
|
603
|
-
}
|
|
604
|
-
ensureLength(bytes) {
|
|
605
|
-
const neededBytes = (this.writerIndex + bytes) - this.data.length;
|
|
606
|
-
if (neededBytes > 0) {
|
|
607
|
-
const chunks = Math.ceil(neededBytes / DataStreamWriter.chunkSize);
|
|
608
|
-
// don't know if it's best for performance to immediately concatenate the buffers. That way it's
|
|
609
|
-
// the easiest way to handle writing though.
|
|
610
|
-
this.data = Buffer.concat([this.data, Buffer.alloc(chunks * DataStreamWriter.chunkSize)]);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
compressDataIfPossible(data) {
|
|
614
|
-
const index = this.writtenData.indexOf(data);
|
|
615
|
-
if (index < 0) {
|
|
616
|
-
// data is not present yet
|
|
617
|
-
this.writtenData.push(data);
|
|
618
|
-
return false;
|
|
619
|
-
}
|
|
620
|
-
else if (index <= 207 /* DataFormatTags.COMPRESSION_STOP */ - 160 /* DataFormatTags.COMPRESSION_START */) {
|
|
621
|
-
// data was already written and the index is in the applicable range => shorten the payload
|
|
622
|
-
this.writeTag(160 /* DataFormatTags.COMPRESSION_START */ + index);
|
|
623
|
-
return true;
|
|
624
|
-
}
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
writeTag(tag) {
|
|
628
|
-
this.ensureLength(1);
|
|
629
|
-
this.data.writeUInt8(tag, this.writerIndex++);
|
|
630
|
-
}
|
|
631
|
-
writeTrue() {
|
|
632
|
-
this.writeTag(1 /* DataFormatTags.TRUE */);
|
|
633
|
-
}
|
|
634
|
-
writeFalse() {
|
|
635
|
-
this.writeTag(2 /* DataFormatTags.FALSE */);
|
|
636
|
-
}
|
|
637
|
-
writeNumber(number) {
|
|
638
|
-
if (number === -1) {
|
|
639
|
-
this.writeTag(7 /* DataFormatTags.INTEGER_MINUS_ONE */);
|
|
640
|
-
}
|
|
641
|
-
else if (number >= 0 && number <= 39) {
|
|
642
|
-
this.writeTag(8 /* DataFormatTags.INTEGER_RANGE_START_0 */ + number);
|
|
643
|
-
}
|
|
644
|
-
else if (number >= -128 && number <= 127) {
|
|
645
|
-
this.writeInt8(new Int8(number));
|
|
646
|
-
}
|
|
647
|
-
else if (number >= -32768 && number <= 32767) {
|
|
648
|
-
this.writeInt16LE(new Int16(number));
|
|
649
|
-
}
|
|
650
|
-
else if (number >= -2147483648 && number <= 2147483647) {
|
|
651
|
-
this.writeInt32LE(new Int32(number));
|
|
652
|
-
}
|
|
653
|
-
else if (number >= Number.MIN_SAFE_INTEGER && number <= Number.MAX_SAFE_INTEGER) { // use correct uin64 restriction when we convert to bigint
|
|
654
|
-
this.writeInt64LE(new Int64(number));
|
|
655
|
-
}
|
|
656
|
-
else {
|
|
657
|
-
throw new Error("Tried writing unrepresentable number (" + number + ")");
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
writeInt8(int8) {
|
|
661
|
-
if (this.compressDataIfPossible(int8)) {
|
|
662
|
-
return;
|
|
663
|
-
}
|
|
664
|
-
this.ensureLength(2);
|
|
665
|
-
this.writeTag(48 /* DataFormatTags.INT8 */);
|
|
666
|
-
this.data.writeInt8(int8.value, this.writerIndex++);
|
|
667
|
-
}
|
|
668
|
-
writeInt16LE(int16) {
|
|
669
|
-
if (this.compressDataIfPossible(int16)) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
this.ensureLength(3);
|
|
673
|
-
this.writeTag(49 /* DataFormatTags.INT16LE */);
|
|
674
|
-
this.data.writeInt16LE(int16.value, this.writerIndex);
|
|
675
|
-
this.writerIndex += 2;
|
|
676
|
-
}
|
|
677
|
-
writeInt32LE(int32) {
|
|
678
|
-
if (this.compressDataIfPossible(int32)) {
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
this.ensureLength(5);
|
|
682
|
-
this.writeTag(50 /* DataFormatTags.INT32LE */);
|
|
683
|
-
this.data.writeInt32LE(int32.value, this.writerIndex);
|
|
684
|
-
this.writerIndex += 4;
|
|
685
|
-
}
|
|
686
|
-
writeInt64LE(int64) {
|
|
687
|
-
if (this.compressDataIfPossible(int64)) {
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
this.ensureLength(9);
|
|
691
|
-
this.writeTag(51 /* DataFormatTags.INT64LE */);
|
|
692
|
-
this.data.writeUInt32LE(int64.value, this.writerIndex); // TODO correctly implement int64; currently it's basically an int32
|
|
693
|
-
this.data.writeUInt32LE(0, this.writerIndex + 4);
|
|
694
|
-
this.writerIndex += 8;
|
|
695
|
-
}
|
|
696
|
-
writeFloat32LE(float32) {
|
|
697
|
-
if (this.compressDataIfPossible(float32)) {
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
this.ensureLength(5);
|
|
701
|
-
this.writeTag(53 /* DataFormatTags.FLOAT32LE */);
|
|
702
|
-
this.data.writeFloatLE(float32.value, this.writerIndex);
|
|
703
|
-
this.writerIndex += 4;
|
|
704
|
-
}
|
|
705
|
-
writeFloat64LE(float64) {
|
|
706
|
-
if (this.compressDataIfPossible(float64)) {
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
this.ensureLength(9);
|
|
710
|
-
this.writeTag(54 /* DataFormatTags.FLOAT64LE */);
|
|
711
|
-
this.data.writeDoubleLE(float64.value, this.writerIndex);
|
|
712
|
-
this.writerIndex += 8;
|
|
713
|
-
}
|
|
714
|
-
writeLength8(length) {
|
|
715
|
-
this.ensureLength(1);
|
|
716
|
-
this.data.writeUInt8(length, this.writerIndex++);
|
|
717
|
-
}
|
|
718
|
-
writeLength16LE(length) {
|
|
719
|
-
this.ensureLength(2);
|
|
720
|
-
this.data.writeUInt16LE(length, this.writerIndex);
|
|
721
|
-
this.writerIndex += 2;
|
|
722
|
-
}
|
|
723
|
-
writeLength32LE(length) {
|
|
724
|
-
this.ensureLength(4);
|
|
725
|
-
this.data.writeUInt32LE(length, this.writerIndex);
|
|
726
|
-
this.writerIndex += 4;
|
|
727
|
-
}
|
|
728
|
-
writeLength64LE(length) {
|
|
729
|
-
this.ensureLength(8);
|
|
730
|
-
hapCrypto.writeUInt64LE(length, this.data, this.writerIndex);
|
|
731
|
-
this.writerIndex += 8;
|
|
732
|
-
}
|
|
733
|
-
writeUTF8(utf8) {
|
|
734
|
-
if (this.compressDataIfPossible(utf8)) {
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
const length = Buffer.byteLength(utf8);
|
|
738
|
-
if (length <= 32) {
|
|
739
|
-
this.ensureLength(1 + length);
|
|
740
|
-
this.writeTag(64 /* DataFormatTags.UTF8_LENGTH_START */ + length);
|
|
741
|
-
this._writeUTF8(utf8);
|
|
742
|
-
}
|
|
743
|
-
else if (length <= 255) {
|
|
744
|
-
this.writeUTF8_Length8(utf8);
|
|
745
|
-
}
|
|
746
|
-
else if (length <= 65535) {
|
|
747
|
-
this.writeUTF8_Length16LE(utf8);
|
|
748
|
-
}
|
|
749
|
-
else if (length <= 4294967295) {
|
|
750
|
-
this.writeUTF8_Length32LE(utf8);
|
|
751
|
-
}
|
|
752
|
-
else if (length <= Number.MAX_SAFE_INTEGER) { // use correct uin64 restriction when we convert to bigint
|
|
753
|
-
this.writeUTF8_Length64LE(utf8);
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
this.writeUTF8_NULL_terminated(utf8);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
_writeUTF8(utf8) {
|
|
760
|
-
const byteLength = Buffer.byteLength(utf8);
|
|
761
|
-
this.ensureLength(byteLength);
|
|
762
|
-
this.data.write(utf8, this.writerIndex, byteLength, "utf8");
|
|
763
|
-
this.writerIndex += byteLength;
|
|
764
|
-
}
|
|
765
|
-
writeUTF8_Length8(utf8) {
|
|
766
|
-
const length = Buffer.byteLength(utf8);
|
|
767
|
-
this.ensureLength(2 + length);
|
|
768
|
-
this.writeTag(97 /* DataFormatTags.UTF8_LENGTH8 */);
|
|
769
|
-
this.writeLength8(length);
|
|
770
|
-
this._writeUTF8(utf8);
|
|
771
|
-
}
|
|
772
|
-
writeUTF8_Length16LE(utf8) {
|
|
773
|
-
const length = Buffer.byteLength(utf8);
|
|
774
|
-
this.ensureLength(3 + length);
|
|
775
|
-
this.writeTag(98 /* DataFormatTags.UTF8_LENGTH16LE */);
|
|
776
|
-
this.writeLength16LE(length);
|
|
777
|
-
this._writeUTF8(utf8);
|
|
778
|
-
}
|
|
779
|
-
writeUTF8_Length32LE(utf8) {
|
|
780
|
-
const length = Buffer.byteLength(utf8);
|
|
781
|
-
this.ensureLength(5 + length);
|
|
782
|
-
this.writeTag(99 /* DataFormatTags.UTF8_LENGTH32LE */);
|
|
783
|
-
this.writeLength32LE(length);
|
|
784
|
-
this._writeUTF8(utf8);
|
|
785
|
-
}
|
|
786
|
-
writeUTF8_Length64LE(utf8) {
|
|
787
|
-
const length = Buffer.byteLength(utf8);
|
|
788
|
-
this.ensureLength(9 + length);
|
|
789
|
-
this.writeTag(100 /* DataFormatTags.UTF8_LENGTH64LE */);
|
|
790
|
-
this.writeLength64LE(length);
|
|
791
|
-
this._writeUTF8(utf8);
|
|
792
|
-
}
|
|
793
|
-
writeUTF8_NULL_terminated(utf8) {
|
|
794
|
-
this.ensureLength(1 + Buffer.byteLength(utf8) + 1);
|
|
795
|
-
this.writeTag(111 /* DataFormatTags.UTF8_NULL_TERMINATED */);
|
|
796
|
-
this._writeUTF8(utf8);
|
|
797
|
-
this.data.writeUInt8(0, this.writerIndex++);
|
|
798
|
-
}
|
|
799
|
-
writeData(data) {
|
|
800
|
-
if (this.compressDataIfPossible(data)) {
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
if (data.length <= 32) {
|
|
804
|
-
this.writeTag(112 /* DataFormatTags.DATA_LENGTH_START */ + data.length);
|
|
805
|
-
this._writeData(data);
|
|
806
|
-
}
|
|
807
|
-
else if (data.length <= 255) {
|
|
808
|
-
this.writeData_Length8(data);
|
|
809
|
-
}
|
|
810
|
-
else if (data.length <= 65535) {
|
|
811
|
-
this.writeData_Length16LE(data);
|
|
812
|
-
}
|
|
813
|
-
else if (data.length <= 4294967295) {
|
|
814
|
-
this.writeData_Length32LE(data);
|
|
815
|
-
}
|
|
816
|
-
else if (data.length <= Number.MAX_SAFE_INTEGER) {
|
|
817
|
-
this.writeData_Length64LE(data);
|
|
818
|
-
}
|
|
819
|
-
else {
|
|
820
|
-
this.writeData_terminated(data);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
_writeData(data) {
|
|
824
|
-
this.ensureLength(data.length);
|
|
825
|
-
for (let i = 0; i < data.length; i++) {
|
|
826
|
-
this.data[this.writerIndex++] = data[i];
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
writeData_Length8(data) {
|
|
830
|
-
this.ensureLength(2 + data.length);
|
|
831
|
-
this.writeTag(145 /* DataFormatTags.DATA_LENGTH8 */);
|
|
832
|
-
this.writeLength8(data.length);
|
|
833
|
-
this._writeData(data);
|
|
834
|
-
}
|
|
835
|
-
writeData_Length16LE(data) {
|
|
836
|
-
this.ensureLength(3 + data.length);
|
|
837
|
-
this.writeTag(146 /* DataFormatTags.DATA_LENGTH16LE */);
|
|
838
|
-
this.writeLength16LE(data.length);
|
|
839
|
-
this._writeData(data);
|
|
840
|
-
}
|
|
841
|
-
writeData_Length32LE(data) {
|
|
842
|
-
this.ensureLength(5 + data.length);
|
|
843
|
-
this.writeTag(147 /* DataFormatTags.DATA_LENGTH32LE */);
|
|
844
|
-
this.writeLength32LE(data.length);
|
|
845
|
-
this._writeData(data);
|
|
846
|
-
}
|
|
847
|
-
writeData_Length64LE(data) {
|
|
848
|
-
this.ensureLength(9 + data.length);
|
|
849
|
-
this.writeTag(148 /* DataFormatTags.DATA_LENGTH64LE */);
|
|
850
|
-
this.writeLength64LE(data.length);
|
|
851
|
-
this._writeData(data);
|
|
852
|
-
}
|
|
853
|
-
writeData_terminated(data) {
|
|
854
|
-
this.ensureLength(1 + data.length + 1);
|
|
855
|
-
this.writeTag(159 /* DataFormatTags.DATA_TERMINATED */);
|
|
856
|
-
this._writeData(data);
|
|
857
|
-
this.writeTag(3 /* DataFormatTags.TERMINATOR */);
|
|
858
|
-
}
|
|
859
|
-
writeSecondsSince2001_01_01(seconds) {
|
|
860
|
-
if (this.compressDataIfPossible(seconds)) {
|
|
861
|
-
return;
|
|
862
|
-
}
|
|
863
|
-
this.ensureLength(9);
|
|
864
|
-
this.writeTag(6 /* DataFormatTags.DATE */);
|
|
865
|
-
this.data.writeDoubleLE(seconds.value, this.writerIndex);
|
|
866
|
-
this.writerIndex += 8;
|
|
867
|
-
}
|
|
868
|
-
writeUUID(uuid_string) {
|
|
869
|
-
(0, assert_1.default)(uuid.isValid(uuid_string), "supplied uuid is invalid");
|
|
870
|
-
if (this.compressDataIfPossible(new UUID(uuid_string))) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
this.ensureLength(17);
|
|
874
|
-
this.writeTag(5 /* DataFormatTags.UUID */);
|
|
875
|
-
uuid.write(uuid_string, this.data, this.writerIndex);
|
|
876
|
-
this.writerIndex += 16;
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
exports.DataStreamWriter = DataStreamWriter;
|
|
880
|
-
//# sourceMappingURL=DataStreamParser.js.map
|