@camera.ui/server 0.0.50-internal.0 → 0.0.50-internal.2
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/dist/interface/index.html +44 -44
- package/dist/interface/js/{@primevue.OhxoO3MD.0.0.50-internal.0.js → @primevue.BAIU_p3r.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@tanstack.D1IL6eOv.0.0.50-internal.0.js → @tanstack.mdCorqzE.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vee-validate.BGPyWWTh.0.0.50-internal.0.js → @vee-validate.D0vsSsly.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{@vueuse.BsKtqdiG.0.0.50-internal.0.js → @vueuse.we5ZpWr2.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Adminpanel.D93Kvbwp.0.0.50-internal.0.js → Adminpanel.9AEBJ3H1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Camera.DF2l3OMA.0.0.50-internal.0.js → Camera.CZcnEH0C.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Cameras.YzvZccdv.0.0.50-internal.0.js → Cameras.DE0LkcGu.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/Cammesh.CVvmkelB.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Camview.CB7_HnoQ.0.0.50-internal.0.js → Camview.CUr4pGoU.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Config.BwflsWTm.0.0.50-internal.0.js → Config.CaJhu4fF.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{Console.DZM8pN8Q.0.0.50-internal.0.js → Console.5VUmgryj.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiConsole.BXXU7Gth.0.0.50-internal.0.js → CuiConsole.iYmUxAR5.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiPluginCard.YFOrpbVD.0.0.50-internal.0.js → CuiPluginCard.DXPyE5mF.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{CuiTimeline.VV5KSJd5.0.0.50-internal.0.js → CuiTimeline.BqtlOFnV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{FirstSteps.b-nvymgb.0.0.50-internal.0.js → FirstSteps.C_RI-SDQ.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugin.BOMpVEwM.0.0.50-internal.0.js → Plugin.Ch_v02eN.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{Plugins.DdPwaUDA.0.0.50-internal.0.js → Plugins.BpXAYgSG.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/Recordings.CIKHJytH.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{Settings.D24ttaPu.0.0.50-internal.0.js → Settings.BcLoGNEy.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsAccount.ms3aqz4E.0.0.50-internal.0.js → SettingsAccount.DMROW8kx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsAppearance.CUaHpihp.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{SettingsAppearance.vue_vue_type_script_setup_true_lang.CBQ6lL3T.0.0.50-internal.0.js → SettingsAppearance.vue_vue_type_script_setup_true_lang.BuKZ-Uco.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsBackup.BPEc4Rjg.0.0.50-internal.0.js → SettingsBackup.0QdwFSpv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/SettingsRecordings.B-aj0U8_.0.0.50-internal.2.js +1 -0
- package/dist/interface/js/{SettingsRemote.BL5nXbUT.0.0.50-internal.0.js → SettingsRemote.Bi1YAJ76.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsSystem.D7T0AIpm.0.0.50-internal.0.js → SettingsSystem.CAx66Iir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{SettingsUsers.1u0vCOVG.0.0.50-internal.0.js → SettingsUsers.CQcDtGy1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{VersionsHandler.vue_vue_type_script_setup_true_lang.xDishkkS.0.0.50-internal.0.js → VersionsHandler.vue_vue_type_script_setup_true_lang.BhXMzIhV.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{ace-builds.D1nmvCwb.0.0.50-internal.0.js → ace-builds.C0sCXSu5.0.0.50-internal.2.js} +2 -2
- package/dist/interface/js/{ace.config.G96T2z54.0.0.50-internal.0.js → ace.config.DNqPWa0Q.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{backup.B_Gzxtp_.0.0.50-internal.0.js → backup.DAXgG3bP.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{chart.js.CP_nMnnf.0.0.50-internal.0.js → chart.js.Bq3YocRX.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{close-circle.DYLuVIOg.0.0.50-internal.0.js → close-circle.9rxyNw0z.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{dnd-core.T9OeW7mu.0.0.50-internal.0.js → dnd-core.BuEvHAsS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{draggabilly.D3zGcBb3.0.0.50-internal.0.js → draggabilly.DUdE08x8.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{engine.io-client.kITRnq-g.0.0.50-internal.0.js → engine.io-client.DWU6YI8o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{fast-deep-equal.Bpc9mIsj.0.0.50-internal.0.js → fast-deep-equal.BpPyC6E4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{highlight.js.BlSXU-Wb.0.0.50-internal.0.js → highlight.js.BoR2Rhdd.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{linkify-it.C3N1lWsJ.0.0.50-internal.0.js → linkify-it.BXzPONHs.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{main.D0YR3Jat.0.0.50-internal.0.js → main.DwcBYfWc.0.0.50-internal.2.js} +3 -3
- package/dist/interface/js/{markdown-it.Dj0dt5s2.0.0.50-internal.0.js → markdown-it.BUDVOjPt.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{nprogress.BwQWDcGj.0.0.50-internal.0.js → nprogress.CsG-OBoI.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{pinia.DRh7plEC.0.0.50-internal.0.js → pinia.CqEQao5R.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{primevue.Cl58krXf.0.0.50-internal.0.js → primevue.D91sslRx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{qrcode.C1sDj6P8.0.0.50-internal.0.js → qrcode.SdSTPzZO.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{react-dnd-touch-backend.BA4WhUJo.0.0.50-internal.0.js → react-dnd-touch-backend.BwroebQ4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{refresh-rounded.D_SmhhUf.0.0.50-internal.0.js → refresh-rounded.DxM48YSv.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{rxjs.C-fTBwEO.0.0.50-internal.0.js → rxjs.Cmpbnzo4.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-client.DKrRxgjP.0.0.50-internal.0.js → socket.io-client.DF2YgZo1.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{socket.io-parser.EXj3YDH2.0.0.50-internal.0.js → socket.io-parser.BUs2ineY.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{system.CY8rGd-Q.0.0.50-internal.0.js → system.DmkT2LKx.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{trash-fill.CMnCN3Oy.0.0.50-internal.0.js → trash-fill.dPzyZDVa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{unidragger.D0w6Tqtt.0.0.50-internal.0.js → unidragger.y2ZlFveS.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vee-validate.BeiObIH8.0.0.50-internal.0.js → vee-validate.Y-alCADW.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-chartjs.DtdZdiYw.0.0.50-internal.0.js → vue-chartjs.sRVFTqDf.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-i18n.BW2bx_6z.0.0.50-internal.0.js → vue-i18n.D5WrXOZa.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-inline-svg.BJkQGmKz.0.0.50-internal.0.js → vue-inline-svg.R0uz_abA.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-router.B2mOXHaC.0.0.50-internal.0.js → vue-router.65mnGy-o.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue-zoomable.BKDyCJE7.0.0.50-internal.0.js → vue-zoomable.B1Qop6Uu.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{vue3-dnd.DRK24CBp.0.0.50-internal.0.js → vue3-dnd.CwmyAcir.0.0.50-internal.2.js} +1 -1
- package/dist/interface/js/{zoom-out.DxvzgVEo.0.0.50-internal.0.js → zoom-out.CMPALvRh.0.0.50-internal.2.js} +1 -1
- package/dist/interface/sw.js +1 -1
- package/dist/server/package.json +1 -1
- package/dist/server/src/rpc/server.js +4 -1
- package/dist/server/src/rpc/server.js.map +1 -1
- package/package.json +1 -1
- package/.prettierignore +0 -12
- package/.prettierrc.json +0 -12
- package/artillery.yaml +0 -29
- package/bin/cameraui-server.ts +0 -11
- package/dist/interface/js/Cammesh.D-6dAROQ.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/Recordings.DhxjIW7e.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsAppearance.DsTjKXk1.0.0.50-internal.0.js +0 -1
- package/dist/interface/js/SettingsRecordings.DgW7M0jj.0.0.50-internal.0.js +0 -1
- package/eslint.config.js +0 -103
- package/localdeps.txt +0 -10
- package/mypy.ini +0 -30
- package/requirements.txt +0 -15
- package/ruff.toml +0 -90
- package/src/__init__.py +0 -0
- package/src/_camera_ui_tools/__init__.py +0 -0
- package/src/_camera_ui_tools/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/api/controllers/api.controller.ts +0 -19
- package/src/api/controllers/auth.controller.ts +0 -294
- package/src/api/controllers/backup.controller.ts +0 -72
- package/src/api/controllers/cameras.controller.ts +0 -1029
- package/src/api/controllers/config.controller.ts +0 -102
- package/src/api/controllers/files.controller.ts +0 -35
- package/src/api/controllers/frameWorkers.controller.ts +0 -109
- package/src/api/controllers/plugins.controller.ts +0 -1206
- package/src/api/controllers/system.controller.ts +0 -273
- package/src/api/controllers/users.controller.ts +0 -648
- package/src/api/database/checks.ts +0 -268
- package/src/api/database/constants.ts +0 -8
- package/src/api/database/index.ts +0 -262
- package/src/api/database/migration.ts +0 -62
- package/src/api/database/selfcheck.ts +0 -492
- package/src/api/database/types.ts +0 -104
- package/src/api/go2rtc/api/application.ts +0 -48
- package/src/api/go2rtc/api/config.ts +0 -61
- package/src/api/go2rtc/api/discover.ts +0 -197
- package/src/api/go2rtc/api/index.ts +0 -49
- package/src/api/go2rtc/api/snapshot.ts +0 -44
- package/src/api/go2rtc/api/streams.ts +0 -168
- package/src/api/go2rtc/index.ts +0 -43
- package/src/api/go2rtc/queue.ts +0 -50
- package/src/api/go2rtc/types.ts +0 -174
- package/src/api/index.ts +0 -286
- package/src/api/middlewares/authPermission.middleware.ts +0 -46
- package/src/api/middlewares/authValidation.middleware.ts +0 -160
- package/src/api/middlewares/pagination.middleware.ts +0 -67
- package/src/api/middlewares/socketAuth.middleware.ts +0 -136
- package/src/api/plugins/header.plugin.ts +0 -15
- package/src/api/plugins/logger.plugin.ts +0 -44
- package/src/api/plugins/proxy.plugin.ts +0 -255
- package/src/api/plugins/socket.plugin.ts +0 -28
- package/src/api/plugins/system.plugin.ts +0 -48
- package/src/api/plugins/useragent.plugin.ts +0 -19
- package/src/api/routes/api.routes.ts +0 -10
- package/src/api/routes/auth.routes.ts +0 -56
- package/src/api/routes/backup.routes.ts +0 -28
- package/src/api/routes/cameras.routes.ts +0 -281
- package/src/api/routes/config.routes.ts +0 -66
- package/src/api/routes/files.routes.ts +0 -15
- package/src/api/routes/frameWorkers.routes.ts +0 -39
- package/src/api/routes/index.ts +0 -37
- package/src/api/routes/plugins.routes.ts +0 -420
- package/src/api/routes/system.routes.ts +0 -101
- package/src/api/routes/users.routes.ts +0 -167
- package/src/api/schemas/backup.schema.ts +0 -112
- package/src/api/schemas/cameras.schema.ts +0 -479
- package/src/api/schemas/config.schema.ts +0 -38
- package/src/api/schemas/go2rtc.schema.ts +0 -189
- package/src/api/schemas/plugins.schema.ts +0 -126
- package/src/api/schemas/storage.schema.ts +0 -11
- package/src/api/schemas/system.schema.ts +0 -45
- package/src/api/schemas/users.schema.ts +0 -185
- package/src/api/services/auth.service.ts +0 -210
- package/src/api/services/backup.service.ts +0 -144
- package/src/api/services/cameras.service.ts +0 -671
- package/src/api/services/plugins.service.ts +0 -470
- package/src/api/services/system.service.ts +0 -85
- package/src/api/services/users.service.ts +0 -276
- package/src/api/types/index.ts +0 -675
- package/src/api/utils/cert.ts +0 -254
- package/src/api/utils/constants.ts +0 -17
- package/src/api/utils/fetch.ts +0 -21
- package/src/api/utils/moveFiles.ts +0 -45
- package/src/api/utils/parse.ts +0 -17
- package/src/api/websocket/index.ts +0 -110
- package/src/api/websocket/nsp/logs.ts +0 -240
- package/src/api/websocket/nsp/main.ts +0 -27
- package/src/api/websocket/nsp/metrics.ts +0 -301
- package/src/api/websocket/nsp/notifications.ts +0 -43
- package/src/api/websocket/nsp/plugins.ts +0 -37
- package/src/api/websocket/nsp/server.ts +0 -220
- package/src/api/websocket/nsp/status.ts +0 -77
- package/src/api/websocket/types.ts +0 -55
- package/src/api.ts +0 -163
- package/src/camera/classes.ts +0 -32
- package/src/camera/controller.ts +0 -579
- package/src/camera/device.ts +0 -422
- package/src/camera/frameWorker.ts +0 -403
- package/src/camera/index.ts +0 -679
- package/src/camera/interfaces.ts +0 -95
- package/src/camera/iou.ts +0 -153
- package/src/camera/polygon.ts +0 -226
- package/src/camera/python/__init__.py +0 -0
- package/src/camera/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/classes.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/delegate_controller.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/interfaces.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/iou.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/iou2.cpython-310.pyc +0 -0
- package/src/camera/python/__pycache__/polygon.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/camera/python/__pycache__/video_frame.cpython-311.pyc +0 -0
- package/src/camera/python/classes.py +0 -41
- package/src/camera/python/interfaces.py +0 -130
- package/src/camera/python/iou.py +0 -158
- package/src/camera/python/polygon.py +0 -230
- package/src/camera/python/test/__pycache__/polygon.cpython-310.pyc +0 -0
- package/src/camera/python/test/iou_test.py +0 -799
- package/src/camera/python/test/polygon.py +0 -238
- package/src/camera/python/test/polygon_test.py +0 -256
- package/src/camera/python/test/polygon_test2.py +0 -484
- package/src/camera/python/typings.py +0 -50
- package/src/camera/python/video_frame.py +0 -143
- package/src/camera/session.ts +0 -192
- package/src/camera/streaming/fmp4-session.ts +0 -390
- package/src/camera/streaming/peer-connection.ts +0 -273
- package/src/camera/streaming/rtsp-session.ts +0 -331
- package/src/camera/streaming/webrtc-connection.ts +0 -260
- package/src/camera/streaming/werift-session.ts +0 -317
- package/src/camera/test/iou_test.ts +0 -761
- package/src/camera/test/polygon.test.ts +0 -611
- package/src/camera/test/polygon_test.ts +0 -210
- package/src/camera/types.ts +0 -48
- package/src/camera/utils.ts +0 -489
- package/src/camera/videoFrame.ts +0 -123
- package/src/cloud/index.ts +0 -61
- package/src/cloud/remote/cloudflare.ts +0 -18
- package/src/cloud/remote/upnp.ts +0 -18
- package/src/cloud/remote/utils.ts +0 -24
- package/src/cloud/types.ts +0 -16
- package/src/decoder/child.ts +0 -883
- package/src/decoder/imageUtils.ts +0 -275
- package/src/decoder/manager.ts +0 -251
- package/src/decoder/python/__init__.py +0 -0
- package/src/decoder/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/image_utils.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/decoder/python/__pycache__/utils.cpython-311.pyc +0 -0
- package/src/decoder/python/child.py +0 -903
- package/src/decoder/python/image_utils.py +0 -196
- package/src/decoder/python/pool.py +0 -45
- package/src/decoder/python/test/group.py +0 -62
- package/src/decoder/python/test/motion.mp4 +0 -0
- package/src/decoder/python/test/motion2.mp4 +0 -0
- package/src/decoder/python/test/opencl.cl +0 -70
- package/src/decoder/python/test/opencl2.cl +0 -130
- package/src/decoder/python/test/test.py +0 -427
- package/src/decoder/python/test/test1.jpg +0 -0
- package/src/decoder/python/test/test1_resized.jpg +0 -0
- package/src/decoder/python/test/test2.jpg +0 -0
- package/src/decoder/python/test/test2.py +0 -451
- package/src/decoder/python/test/test2_resized.jpg +0 -0
- package/src/decoder/python/test/test3.jpg +0 -0
- package/src/decoder/python/test/utils.py +0 -50
- package/src/decoder/python/typings.py +0 -57
- package/src/decoder/python/utils.py +0 -70
- package/src/decoder/test/child.ts +0 -117
- package/src/decoder/test/ffmpeg.ts +0 -371
- package/src/decoder/test/test.ts +0 -182
- package/src/decoder/types.ts +0 -27
- package/src/decoder/utils.ts +0 -64
- package/src/decoder/wasm/asconfig.json +0 -28
- package/src/decoder/wasm/assembly/console.ts +0 -1
- package/src/decoder/wasm/assembly/index.ts +0 -890
- package/src/decoder/wasm/build/decoder.d.ts +0 -43
- package/src/decoder/wasm/build/decoder.js +0 -108
- package/src/decoder/wasm/build/decoder.wasm +0 -0
- package/src/decoder/wasm/tsconfig.json +0 -5
- package/src/decoder/worker.ts +0 -113
- package/src/go2rtc/index.ts +0 -324
- package/src/go2rtc/types.ts +0 -88
- package/src/main.ts +0 -267
- package/src/manager/coreManager.ts +0 -78
- package/src/manager/deviceManager.ts +0 -132
- package/src/manager/types.ts +0 -17
- package/src/plugins/index.ts +0 -443
- package/src/plugins/plugin.ts +0 -177
- package/src/plugins/runtime/base.ts +0 -282
- package/src/plugins/runtime/index.ts +0 -15
- package/src/plugins/runtime/node/child.ts +0 -193
- package/src/plugins/runtime/node/index.ts +0 -67
- package/src/plugins/runtime/node/plugin.ts +0 -122
- package/src/plugins/runtime/node/pluginApi.ts +0 -27
- package/src/plugins/runtime/node/proxy/cameraDevice.ts +0 -299
- package/src/plugins/runtime/node/proxy/coreManager.ts +0 -128
- package/src/plugins/runtime/node/proxy/deviceManager.ts +0 -187
- package/src/plugins/runtime/node/storage.ts +0 -312
- package/src/plugins/runtime/node/storageController.ts +0 -91
- package/src/plugins/runtime/python/__init__.py +0 -0
- package/src/plugins/runtime/python/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/camera_storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/config_service.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/ipc.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/namespaces.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_api.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/plugin_logger.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/proxy_utils.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/schema.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/storage_controller.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/__pycache__/typings.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/child.py +0 -248
- package/src/plugins/runtime/python/index.ts +0 -73
- package/src/plugins/runtime/python/namespaces.py +0 -101
- package/src/plugins/runtime/python/plugin.py +0 -155
- package/src/plugins/runtime/python/plugin_api.py +0 -29
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/camera_device.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/constants.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/core_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/device_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/generate_keys.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/message_queue.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/plugins_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-310.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-311.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-38.pyc +0 -0
- package/src/plugins/runtime/python/proxy/__pycache__/system_manager.cpython-39.pyc +0 -0
- package/src/plugins/runtime/python/proxy/camera_device.py +0 -1732
- package/src/plugins/runtime/python/proxy/core_manager.py +0 -126
- package/src/plugins/runtime/python/proxy/device_manager.py +0 -197
- package/src/plugins/runtime/python/schema.py +0 -99
- package/src/plugins/runtime/python/storage.py +0 -353
- package/src/plugins/runtime/python/storage_controller.py +0 -102
- package/src/plugins/runtime/python/typings.py +0 -195
- package/src/plugins/schema.ts +0 -472
- package/src/plugins/types.ts +0 -60
- package/src/plugins/worker.ts +0 -250
- package/src/rpc/index.ts +0 -149
- package/src/rpc/namespaces.ts +0 -79
- package/src/rpc/server.ts +0 -422
- package/src/rpc/types.ts +0 -119
- package/src/rpc/utils.ts +0 -16
- package/src/services/config/constants.ts +0 -47
- package/src/services/config/defaults.ts +0 -57
- package/src/services/config/index.ts +0 -744
- package/src/services/config/types.ts +0 -211
- package/src/services/logger/index.ts +0 -96
- package/src/types.ts +0 -47
- package/src/utils/path.ts +0 -16
- package/src/utils/pythonInstaller.ts +0 -597
- package/tsconfig.json +0 -37
- package/types/fastify.d.ts +0 -14
- package/updates.config.js +0 -3
- /package/dist/interface/assets/{@xterm.DYP7pi_n.0.0.50-internal.0.css → @xterm.DYP7pi_n.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Adminpanel.BKek2EMH.0.0.50-internal.0.css → Adminpanel.BKek2EMH.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Cameras.BDWZJqPN.0.0.50-internal.0.css → Cameras.BDWZJqPN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Camview.BFUFMoNX.0.0.50-internal.0.css → Camview.BFUFMoNX.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiConsole.DCYyxdVg.0.0.50-internal.0.css → CuiConsole.DCYyxdVg.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiPluginCard.yF8V0SZY.0.0.50-internal.0.css → CuiPluginCard.yF8V0SZY.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{CuiTimeline.BkIwlYtw.0.0.50-internal.0.css → CuiTimeline.BkIwlYtw.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugin.DJElsAn5.0.0.50-internal.0.css → Plugin.DJElsAn5.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Plugins.0h77qnmN.0.0.50-internal.0.css → Plugins.0h77qnmN.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{Settings.CkgfRkQr.0.0.50-internal.0.css → Settings.CkgfRkQr.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsAccount.DeFul3eQ.0.0.50-internal.0.css → SettingsAccount.DeFul3eQ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{SettingsBackup.CX0rT0QJ.0.0.50-internal.0.css → SettingsBackup.CX0rT0QJ.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{highlight.Ch2EwETz.0.0.50-internal.0.css → highlight.Ch2EwETz.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{logo-256.BCQk9H1-.0.0.50-internal.0.png → logo-256.BCQk9H1-.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo-512.DLKVOU2S.0.0.50-internal.0.png → logo-512.DLKVOU2S.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{logo.DmEiRk0z.0.0.50-internal.0.png → logo.DmEiRk0z.0.0.50-internal.2.png} +0 -0
- /package/dist/interface/assets/{main.Cip9LkS3.0.0.50-internal.0.css → main.Cip9LkS3.0.0.50-internal.2.css} +0 -0
- /package/dist/interface/assets/{mode-json.Br7xisR1.0.0.50-internal.0.js → mode-json.Br7xisR1.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{mode-yaml.CIYL8U3d.0.0.50-internal.0.js → mode-yaml.CIYL8U3d.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-base.jEXLGV2h.0.0.50-internal.0.js → worker-base.jEXLGV2h.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-json.DgwNIOck.0.0.50-internal.0.js → worker-json.DgwNIOck.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/assets/{worker-yaml.B3uUYINB.0.0.50-internal.0.js → worker-yaml.B3uUYINB.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@babel.l0sNRNKZ.0.0.50-internal.0.js → @babel.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@intlify.BkGPX90O.0.0.50-internal.0.js → @intlify.BkGPX90O.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@kurkle.D8fDXNIl.0.0.50-internal.0.js → @kurkle.D8fDXNIl.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@primeuix.BFAY2Bk9.0.0.50-internal.0.js → @primeuix.BFAY2Bk9.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@react-dnd.CcwRs9xb.0.0.50-internal.0.js → @react-dnd.CcwRs9xb.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@socket.io.Dkula2eQ.0.0.50-internal.0.js → @socket.io.Dkula2eQ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@vue.B5vqhCp2.0.0.50-internal.0.js → @vue.B5vqhCp2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{@xterm.CAa7rpjv.0.0.50-internal.0.js → @xterm.C-5Lxnx_.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{axios.DHr9lByg.0.0.50-internal.0.js → axios.DHr9lByg.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{birpc.l0sNRNKZ.0.0.50-internal.0.js → birpc.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{compare-versions.DqEOhma6.0.0.50-internal.0.js → compare-versions.DqEOhma6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{dijkstrajs.C00ieaqj.0.0.50-internal.0.js → dijkstrajs.C00ieaqj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{engine.io-parser.BiEtp6m2.0.0.50-internal.0.js → engine.io-parser.BiEtp6m2.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{entities.C20TfXL6.0.0.50-internal.0.js → entities.C20TfXL6.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{ev-emitter.X5f1qa-c.0.0.50-internal.0.js → ev-emitter.X5f1qa-c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{get-size.D1dS-IaP.0.0.50-internal.0.js → get-size.D1dS-IaP.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{hookable.l0sNRNKZ.0.0.50-internal.0.js → hookable.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{mdurl.k9Sl0PQj.0.0.50-internal.0.js → mdurl.k9Sl0PQj.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{perfect-debounce.l0sNRNKZ.0.0.50-internal.0.js → perfect-debounce.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{primelocale.Bga3dOQu.0.0.50-internal.0.js → primelocale.Bga3dOQu.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{punycode.js.Dj65hjkv.0.0.50-internal.0.js → punycode.js.Dj65hjkv.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.0.js → react-dnd-html5-backend.1HQjlkwI.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{redux.BFxtlG_c.0.0.50-internal.0.js → redux.BFxtlG_c.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{tslib.9k7AwCpt.0.0.50-internal.0.js → tslib.9k7AwCpt.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uc.micro.kMc2yuuw.0.0.50-internal.0.js → uc.micro.kMc2yuuw.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{uuid.C6aID195.0.0.50-internal.0.js → uuid.C6aID195.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{vue.l0sNRNKZ.0.0.50-internal.0.js → vue.l0sNRNKZ.0.0.50-internal.2.js} +0 -0
- /package/dist/interface/js/{zod.SKKegNRO.0.0.50-internal.0.js → zod.SKKegNRO.0.0.50-internal.2.js} +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
|
|
3
|
-
import { CoreManagerProxy } from './proxy/coreManager.js';
|
|
4
|
-
import { DeviceManagerProxy } from './proxy/deviceManager.js';
|
|
5
|
-
import { StorageController } from './storageController.js';
|
|
6
|
-
|
|
7
|
-
import type { Logger } from '@camera.ui/common';
|
|
8
|
-
import type { ClientInstance } from '@camera.ui/rpc-client';
|
|
9
|
-
import type { PluginAPI as PluginAPIInterface } from '@camera.ui/types';
|
|
10
|
-
import type { RootDatabase } from 'lmdb';
|
|
11
|
-
import type { PluginInfo } from '../../types.js';
|
|
12
|
-
|
|
13
|
-
export class PluginAPI extends EventEmitter implements PluginAPIInterface {
|
|
14
|
-
readonly coreManager: CoreManagerProxy;
|
|
15
|
-
readonly deviceManager: DeviceManagerProxy;
|
|
16
|
-
readonly storageController: StorageController;
|
|
17
|
-
readonly storagePath: string;
|
|
18
|
-
|
|
19
|
-
constructor(proxy: ClientInstance, plugin: PluginInfo, storagePath: string, logger: Logger, pluginDb: RootDatabase<Record<string, any>, 'config'>) {
|
|
20
|
-
super();
|
|
21
|
-
|
|
22
|
-
this.storagePath = storagePath;
|
|
23
|
-
this.storageController = new StorageController(this, proxy, plugin, pluginDb);
|
|
24
|
-
this.coreManager = new CoreManagerProxy(proxy, this, plugin);
|
|
25
|
-
this.deviceManager = new DeviceManagerProxy(proxy, this, this.storageController, plugin, logger);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import { CameraDeviceCapability } from '@camera.ui/types';
|
|
2
|
-
|
|
3
|
-
import { API_EVENT } from '../../../../api.js';
|
|
4
|
-
import { CameraDevice } from '../../../../camera/device.js';
|
|
5
|
-
import { CameraInterface } from '../../../../camera/interfaces.js';
|
|
6
|
-
import { NamespaceManager } from '../../../../rpc/namespaces.js';
|
|
7
|
-
|
|
8
|
-
import type { Logger } from '@camera.ui/common';
|
|
9
|
-
import type { ClientInstance } from '@camera.ui/rpc-client';
|
|
10
|
-
import type { Message, Promisify, SubscriptionWrapper } from '@camera.ui/rpc-common';
|
|
11
|
-
import type {
|
|
12
|
-
Camera,
|
|
13
|
-
MotionDetectionFrame,
|
|
14
|
-
MotionSetEvent,
|
|
15
|
-
ProbeConfig,
|
|
16
|
-
PTZInterface,
|
|
17
|
-
SetValues,
|
|
18
|
-
SnapshotInterface,
|
|
19
|
-
StateValues,
|
|
20
|
-
StreamingInterface,
|
|
21
|
-
} from '@camera.ui/types';
|
|
22
|
-
import type { EventEmitter } from 'node:events';
|
|
23
|
-
import type { CameraDeviceInterface } from '../../../../camera/types.js';
|
|
24
|
-
import type { VideoFrame } from '../../../../camera/videoFrame.js';
|
|
25
|
-
import type { CameraNamespaces, FrameWorkerNamespaces, PluginCameraNamespaces } from '../../../../rpc/namespaces.js';
|
|
26
|
-
import type { CameraDeviceListenerMessagePayload, CameraDeviceListenerStatePayload, RefreshedStates } from '../../../../rpc/types.js';
|
|
27
|
-
import type { PluginInfo } from '../../../types.js';
|
|
28
|
-
import type { PluginAPI } from '../pluginApi.js';
|
|
29
|
-
|
|
30
|
-
export class CameraDeviceProxy extends CameraDevice {
|
|
31
|
-
protected cameraInterfaces: CameraInterface;
|
|
32
|
-
protected initialized = false;
|
|
33
|
-
|
|
34
|
-
#proxy: ClientInstance;
|
|
35
|
-
#namespaces: CameraNamespaces & FrameWorkerNamespaces & PluginCameraNamespaces;
|
|
36
|
-
|
|
37
|
-
#api: EventEmitter;
|
|
38
|
-
#plugin: PluginInfo;
|
|
39
|
-
#subscription?: SubscriptionWrapper;
|
|
40
|
-
|
|
41
|
-
constructor(proxy: ClientInstance, api: PluginAPI, camera: Camera, plugin: PluginInfo, logger: Logger) {
|
|
42
|
-
const namespaces = {
|
|
43
|
-
...NamespaceManager.cameraNamespaces(camera._id),
|
|
44
|
-
...NamespaceManager.frameWorkerNamespaces(camera._id),
|
|
45
|
-
...NamespaceManager.pluginCameraNamespaces(plugin.id, camera._id),
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
super(camera, proxy, namespaces, logger);
|
|
49
|
-
|
|
50
|
-
this.#api = api;
|
|
51
|
-
this.#plugin = plugin;
|
|
52
|
-
this.#proxy = proxy;
|
|
53
|
-
this.#namespaces = namespaces;
|
|
54
|
-
|
|
55
|
-
this.cameraInterfaces = new CameraInterface(this.#proxy, this.capabilities, this.id, this.pluginId);
|
|
56
|
-
|
|
57
|
-
this.#api.once(API_EVENT.SHUTDOWN, this.cleanup.bind(this));
|
|
58
|
-
this.#api.setMaxListeners(this.#api.getMaxListeners() + 1);
|
|
59
|
-
|
|
60
|
-
this.addSubscriptions(
|
|
61
|
-
this.onPropertyChange('name').subscribe(() => {
|
|
62
|
-
(this.logger as Logger).suffix = this.name;
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public async init(): Promise<void> {
|
|
68
|
-
if (this.initialized) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
this.initialized = true;
|
|
73
|
-
|
|
74
|
-
this.#subscription = this.#proxy.subscribe<CameraDeviceListenerStatePayload<keyof StateValues> | CameraDeviceListenerMessagePayload>(
|
|
75
|
-
this.#namespaces.cameraSubject,
|
|
76
|
-
this.#onEventMessage.bind(this),
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
await this.#proxy.registerRPCHandler(this.#namespaces.cameraInterfacesRpc, this.cameraInterfaces);
|
|
80
|
-
await this.#refreshStates();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public extend(interfaces: PTZInterface | SnapshotInterface | StreamingInterface): void {
|
|
84
|
-
this.cameraInterfaces.interfaces = interfaces;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
public async connect(): Promise<void> {
|
|
88
|
-
if (this.pluginId !== this.#plugin.id) {
|
|
89
|
-
throw new Error('Camera plugin ID does not match the current plugin ID.');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
93
|
-
return cameraControllerProxy.connect();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public async disconnect(): Promise<void> {
|
|
97
|
-
if (this.pluginId !== this.#plugin.id) {
|
|
98
|
-
throw new Error('Camera plugin ID does not match the current plugin ID.');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
102
|
-
return cameraControllerProxy.disconnect();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
public addCapabilities(capabilities: CameraDeviceCapability[]): void {
|
|
106
|
-
const changed = super.addCapabilitiesInternal(this.#plugin.id, capabilities);
|
|
107
|
-
|
|
108
|
-
if (changed) {
|
|
109
|
-
const updateCapabilities = async () => {
|
|
110
|
-
try {
|
|
111
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
112
|
-
return cameraControllerProxy.addPluginCapabilities(this.#plugin.id, capabilities);
|
|
113
|
-
} catch {
|
|
114
|
-
// this.logger.error('Failed to add capabilities:', error);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
updateCapabilities();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
public removeCapabilities(capabilities: CameraDeviceCapability[]): void {
|
|
123
|
-
const changed = super.removeCapabilitiesInternal(this.#plugin.id, capabilities);
|
|
124
|
-
|
|
125
|
-
if (changed) {
|
|
126
|
-
const updateCapabilities = async () => {
|
|
127
|
-
try {
|
|
128
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
129
|
-
return cameraControllerProxy.removePluginCapabilities(this.#plugin.id, capabilities);
|
|
130
|
-
} catch (error) {
|
|
131
|
-
this.logger.error('Failed to remove capabilities:', error);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
updateCapabilities();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public async updateState<T extends keyof SetValues>(stateName: T, eventData: SetValues[T], frame?: VideoFrame): Promise<void> {
|
|
140
|
-
try {
|
|
141
|
-
const canUpdate = this.#canUpdateStateInternal(stateName);
|
|
142
|
-
if (!canUpdate) {
|
|
143
|
-
this.logger.warn(`State "${stateName}" can only be updated by the corresponding plugin.`);
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const { changed, event } = super.checkStateInternal(stateName, eventData);
|
|
148
|
-
|
|
149
|
-
if (!changed) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
super.updateStateInternal(stateName as any, event as any, true, true); // remove if updating state only allowed for corresponding plugin
|
|
154
|
-
|
|
155
|
-
if (stateName === 'motion' && frame && this.hasObjectDetector) {
|
|
156
|
-
const motionEvent = eventData as MotionSetEvent;
|
|
157
|
-
if (motionEvent.state && motionEvent.detections?.length) {
|
|
158
|
-
const motionFrame: MotionDetectionFrame = {
|
|
159
|
-
frame: {
|
|
160
|
-
data: frame.data,
|
|
161
|
-
info: frame.info,
|
|
162
|
-
metadata: frame.metadata,
|
|
163
|
-
timestamp: Date.now(),
|
|
164
|
-
},
|
|
165
|
-
state: motionEvent,
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
this.#proxy.publish<MotionDetectionFrame>(this.#namespaces.cameraMotionFrameSubject, motionFrame);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
173
|
-
return cameraControllerProxy.updateState(stateName as any, eventData as any);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
if (!this.initialized) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
throw error;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
public async cleanup(): Promise<void> {
|
|
184
|
-
this.initialized = false;
|
|
185
|
-
this.removeAllListeners();
|
|
186
|
-
this.unsubscribe();
|
|
187
|
-
this.#api.removeListener('shutdown', this.cleanup.bind(this));
|
|
188
|
-
this.#api.setMaxListeners(this.#api.getMaxListeners() - 1);
|
|
189
|
-
this.#subscription?.unsubscribe();
|
|
190
|
-
this.#subscription = undefined;
|
|
191
|
-
await this.#disconnectRpc();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
protected async snapshot(sourceId: string, forceNew?: boolean): Promise<ArrayBuffer | undefined> {
|
|
195
|
-
const fromCache = this.snapshotCache.get(sourceId);
|
|
196
|
-
if (!forceNew && fromCache) {
|
|
197
|
-
return fromCache;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
201
|
-
const snapshot = await cameraControllerProxy.snapshot(sourceId, forceNew);
|
|
202
|
-
if (snapshot && snapshot.byteLength > 0) {
|
|
203
|
-
this.snapshotCache.set(sourceId, snapshot);
|
|
204
|
-
return snapshot;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
protected async probeStream(sourceId: string, probeConfig?: ProbeConfig, refresh = false) {
|
|
209
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
210
|
-
return cameraControllerProxy.probeStream(sourceId, probeConfig, refresh);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
async #refreshStates(): Promise<void> {
|
|
214
|
-
const cameraControllerProxy = await this.#cameraControllerProxy();
|
|
215
|
-
const response: RefreshedStates = await cameraControllerProxy.refreshStates();
|
|
216
|
-
|
|
217
|
-
super.updateCamera(response.camera);
|
|
218
|
-
super.updateCameraState(response.cameraState);
|
|
219
|
-
super.updateFrameWorkerState(response.frameWorkerState);
|
|
220
|
-
super.updateCapabilities(response.capabilities);
|
|
221
|
-
|
|
222
|
-
for (const [key, value] of Object.entries(response.states)) {
|
|
223
|
-
super.updateStateInternal(key as keyof StateValues, value, true);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
#canUpdateStateInternal<T extends keyof SetValues>(stateName: T): boolean {
|
|
228
|
-
switch (stateName) {
|
|
229
|
-
case 'audio':
|
|
230
|
-
const audioSensorCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.AudioSensor));
|
|
231
|
-
return audioSensorCapability?.pluginId === this.#plugin.id;
|
|
232
|
-
case 'motion':
|
|
233
|
-
const motionSensorCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.MotionSensor));
|
|
234
|
-
const motionDetectionCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.MotionDetector));
|
|
235
|
-
return motionSensorCapability?.pluginId === this.#plugin.id || motionDetectionCapability?.pluginId === this.#plugin.id;
|
|
236
|
-
case 'object':
|
|
237
|
-
const objectSensorCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.ObjectSensor));
|
|
238
|
-
const objectDetectionCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.ObjectDetector));
|
|
239
|
-
return objectSensorCapability?.pluginId === this.#plugin.id || objectDetectionCapability?.pluginId === this.#plugin.id;
|
|
240
|
-
case 'light':
|
|
241
|
-
const lightCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.Light));
|
|
242
|
-
return lightCapability?.pluginId === this.#plugin.id;
|
|
243
|
-
case 'doorbell':
|
|
244
|
-
const doorbellCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.Doorbell));
|
|
245
|
-
return doorbellCapability?.pluginId === this.#plugin.id;
|
|
246
|
-
case 'siren':
|
|
247
|
-
const sirenCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.Siren));
|
|
248
|
-
return sirenCapability?.pluginId === this.#plugin.id;
|
|
249
|
-
case 'battery':
|
|
250
|
-
const batteryCapability = this.capabilities.value.find((cap) => cap.capabilities.includes(CameraDeviceCapability.Battery));
|
|
251
|
-
return batteryCapability?.pluginId === this.#plugin.id;
|
|
252
|
-
default:
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
async #onEventMessage(event: Message<CameraDeviceListenerStatePayload<keyof StateValues> | CameraDeviceListenerMessagePayload>): Promise<void> {
|
|
258
|
-
if (!this.initialized) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const message = event.data;
|
|
263
|
-
|
|
264
|
-
if ('type' in message) {
|
|
265
|
-
switch (message.type) {
|
|
266
|
-
case 'removed':
|
|
267
|
-
this.cleanup();
|
|
268
|
-
break;
|
|
269
|
-
case 'updated':
|
|
270
|
-
super.updateCamera(message.data);
|
|
271
|
-
break;
|
|
272
|
-
case 'cameraState':
|
|
273
|
-
super.updateCameraState(message.data);
|
|
274
|
-
break;
|
|
275
|
-
case 'frameWorkerState':
|
|
276
|
-
super.updateFrameWorkerState(message.data);
|
|
277
|
-
break;
|
|
278
|
-
case 'capabilities':
|
|
279
|
-
super.updateCapabilities(message.data);
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
const stateName = message.stateName;
|
|
283
|
-
const newData = message.data.newEvent;
|
|
284
|
-
|
|
285
|
-
super.updateStateInternal(stateName, newData, true);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
async #cameraControllerProxy(): Promise<Promisify<CameraDeviceInterface>> {
|
|
290
|
-
return await this.#proxy.createRPCProxy<CameraDeviceInterface>(this.#namespaces.cameraControllerRpc);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
async #disconnectRpc(): Promise<void> {
|
|
294
|
-
await this.#proxy.unregisterRPCHandler(this.#namespaces.cameraInterfacesRpc);
|
|
295
|
-
await this.#proxy.disconnectRPCConnection(this.#namespaces.cameraControllerRpc);
|
|
296
|
-
await this.#proxy.disconnectRPCConnection(this.#namespaces.frameWorkerChildRpc);
|
|
297
|
-
await this.cameraInterfaces.disconnect();
|
|
298
|
-
}
|
|
299
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
|
|
3
|
-
import { API_EVENT } from '../../../../api.js';
|
|
4
|
-
import { NamespaceManager } from '../../../../rpc/namespaces.js';
|
|
5
|
-
|
|
6
|
-
import type { ClientInstance } from '@camera.ui/rpc-client';
|
|
7
|
-
import type { Message, Promisify, RPCConnection, SubscriptionWrapper } from '@camera.ui/rpc-common';
|
|
8
|
-
import type { CoreManager, CuiPlugin, FfmpegArgs, HWAccelOptions, IceServer } from '@camera.ui/types';
|
|
9
|
-
import type { CoreManagerInterface } from '../../../../manager/types.js';
|
|
10
|
-
import type { CoreManagerNamespaces, PluginNamespaces } from '../../../../rpc/namespaces.js';
|
|
11
|
-
import type { CoreManagerListenerMessagePayload } from '../../../../rpc/types.js';
|
|
12
|
-
import type { PluginInfo } from '../../../types.js';
|
|
13
|
-
import type { PluginAPI } from '../pluginApi.js';
|
|
14
|
-
|
|
15
|
-
export class CoreManagerProxy extends EventEmitter implements CoreManager {
|
|
16
|
-
#api: PluginAPI;
|
|
17
|
-
#proxy: ClientInstance;
|
|
18
|
-
#plugin: PluginInfo;
|
|
19
|
-
|
|
20
|
-
#initialized = false;
|
|
21
|
-
|
|
22
|
-
#subscription?: SubscriptionWrapper;
|
|
23
|
-
#namespaces: CoreManagerNamespaces & PluginNamespaces;
|
|
24
|
-
|
|
25
|
-
#rpcConnections = new Map<string, RPCConnection>();
|
|
26
|
-
|
|
27
|
-
constructor(proxy: ClientInstance, api: PluginAPI, plugin: PluginInfo) {
|
|
28
|
-
super();
|
|
29
|
-
|
|
30
|
-
this.#api = api;
|
|
31
|
-
this.#proxy = proxy;
|
|
32
|
-
this.#plugin = plugin;
|
|
33
|
-
this.#namespaces = {
|
|
34
|
-
...NamespaceManager.coreManagerNamespaces(),
|
|
35
|
-
...NamespaceManager.pluginNamespaces(this.#plugin.id),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
this.#api.once(API_EVENT.SHUTDOWN, this.#close.bind(this));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public async init(): Promise<void> {
|
|
42
|
-
if (this.#initialized) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
this.#initialized = true;
|
|
47
|
-
this.#subscription = this.#proxy.subscribe<CoreManagerListenerMessagePayload>(this.#namespaces.coreManagerSubject, this.#onEventMessage.bind(this));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public async connectToPlugin(pluginName: string): Promise<CuiPlugin | undefined> {
|
|
51
|
-
try {
|
|
52
|
-
const coreManagerProxy = await this.#coreManagerProxy();
|
|
53
|
-
const plugin = await coreManagerProxy.getPlugin(pluginName);
|
|
54
|
-
|
|
55
|
-
if (!plugin) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const namespaces = NamespaceManager.pluginNamespaces(plugin.id);
|
|
60
|
-
let rpcConnection: RPCConnection | undefined;
|
|
61
|
-
|
|
62
|
-
if (this.#rpcConnections.has(namespaces.pluginChildRpc)) {
|
|
63
|
-
rpcConnection = this.#rpcConnections.get(namespaces.pluginChildRpc)!;
|
|
64
|
-
await rpcConnection.connect();
|
|
65
|
-
} else {
|
|
66
|
-
rpcConnection = await this.#proxy.createRPCConnection(namespaces.pluginChildRpc);
|
|
67
|
-
this.#rpcConnections.set(namespaces.pluginChildRpc, rpcConnection);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return rpcConnection.createProxy<CuiPlugin>();
|
|
71
|
-
} catch {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public async getFFmpegPath(): Promise<string> {
|
|
77
|
-
const coreManagerProxy = await this.#coreManagerProxy();
|
|
78
|
-
return await coreManagerProxy.getFFmpegPath();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public async getHwaccelInfo(options: HWAccelOptions): Promise<FfmpegArgs[]> {
|
|
82
|
-
const coreManagerProxy = await this.#coreManagerProxy();
|
|
83
|
-
return await coreManagerProxy.getHwaccelInfo(options);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public async getServerAddresses(): Promise<string[]> {
|
|
87
|
-
const coreManagerProxy = await this.#coreManagerProxy();
|
|
88
|
-
return await coreManagerProxy.getServerAddresses();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
public async getIceServers(): Promise<IceServer[]> {
|
|
92
|
-
const coreManagerProxy = await this.#coreManagerProxy();
|
|
93
|
-
return await coreManagerProxy.getIceServers();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public emit(): boolean {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
async #coreManagerProxy(): Promise<Promisify<CoreManagerInterface>> {
|
|
101
|
-
return await this.#proxy.createRPCProxy<CoreManagerInterface>(this.#namespaces.coreManagerRpc);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
105
|
-
async #onEventMessage(message: Message<CoreManagerListenerMessagePayload>): Promise<void> {
|
|
106
|
-
// switch (message.type) {
|
|
107
|
-
// case 'systemUpdated': {
|
|
108
|
-
// const { system }: CoreManagerProxyEvents['systemUpdated'] = message.data;
|
|
109
|
-
// super.emit(message.type, system);
|
|
110
|
-
// break;
|
|
111
|
-
// }
|
|
112
|
-
// }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async #close(): Promise<void> {
|
|
116
|
-
this.#initialized = false;
|
|
117
|
-
this.removeAllListeners();
|
|
118
|
-
this.#api.removeListener('shutdown', this.#close.bind(this));
|
|
119
|
-
this.#subscription?.unsubscribe();
|
|
120
|
-
this.#subscription = undefined;
|
|
121
|
-
await this.#disconnectRpc();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async #disconnectRpc(): Promise<void> {
|
|
125
|
-
await this.#proxy.disconnectRPCConnection(this.#namespaces.coreManagerRpc);
|
|
126
|
-
await Promise.allSettled(Array.from(this.#rpcConnections.values()).map((rpcConnection) => rpcConnection.disconnect()));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
|
-
|
|
3
|
-
import { API_EVENT } from '../../../../api.js';
|
|
4
|
-
import { NamespaceManager } from '../../../../rpc/namespaces.js';
|
|
5
|
-
import { CameraDeviceProxy } from './cameraDevice.js';
|
|
6
|
-
|
|
7
|
-
import type { Logger } from '@camera.ui/common';
|
|
8
|
-
import type { ClientInstance } from '@camera.ui/rpc-client';
|
|
9
|
-
import type { Message, Promisify, SubscriptionWrapper } from '@camera.ui/rpc-common';
|
|
10
|
-
import type { Camera, CameraConfig, CameraDevice, DeviceManager } from '@camera.ui/types';
|
|
11
|
-
import type { DeviceManagerInterface } from '../../../../manager/types.js';
|
|
12
|
-
import type { DeviceManagerNamespaces, PluginNamespaces } from '../../../../rpc/namespaces.js';
|
|
13
|
-
import type { DeviceManagerListenerMessagePayload, DeviceManagerProxyEvents } from '../../../../rpc/types.js';
|
|
14
|
-
import type { PluginInfo } from '../../../types.js';
|
|
15
|
-
import type { PluginAPI } from '../pluginApi.js';
|
|
16
|
-
import type { StorageController } from '../storageController.js';
|
|
17
|
-
|
|
18
|
-
export class DeviceManagerProxy extends EventEmitter implements DeviceManager {
|
|
19
|
-
#api: PluginAPI;
|
|
20
|
-
#proxy: ClientInstance;
|
|
21
|
-
#storageController: StorageController;
|
|
22
|
-
#logger: Logger;
|
|
23
|
-
#plugin: PluginInfo;
|
|
24
|
-
|
|
25
|
-
#initialized = false;
|
|
26
|
-
|
|
27
|
-
#requests?: SubscriptionWrapper;
|
|
28
|
-
#namespaces: DeviceManagerNamespaces & PluginNamespaces;
|
|
29
|
-
|
|
30
|
-
#devices = new Map<string, CameraDeviceProxy>();
|
|
31
|
-
|
|
32
|
-
constructor(proxy: ClientInstance, api: PluginAPI, storageController: StorageController, plugin: PluginInfo, logger: Logger) {
|
|
33
|
-
super();
|
|
34
|
-
|
|
35
|
-
this.#api = api;
|
|
36
|
-
this.#proxy = proxy;
|
|
37
|
-
this.#storageController = storageController;
|
|
38
|
-
this.#logger = logger;
|
|
39
|
-
this.#plugin = plugin;
|
|
40
|
-
this.#namespaces = {
|
|
41
|
-
...NamespaceManager.deviceManagerNamespaces(),
|
|
42
|
-
...NamespaceManager.pluginNamespaces(this.#plugin.id),
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
this.#api.once(API_EVENT.SHUTDOWN, this.#close.bind(this));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public async init(): Promise<void> {
|
|
49
|
-
if (this.#initialized) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.#initialized = true;
|
|
54
|
-
this.#requests = this.#proxy.handleRequest<DeviceManagerListenerMessagePayload>(this.#namespaces.pluginDeviceManagerSubject, this.#onEventMessage.bind(this));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public async getCamera(cameraIdOrName: string): Promise<CameraDevice | undefined> {
|
|
58
|
-
let cameraDevice = await this.#getCameraDevice(cameraIdOrName);
|
|
59
|
-
|
|
60
|
-
if (!cameraDevice) {
|
|
61
|
-
const deviceManagerProxy = await this.#deviceManagerProxy();
|
|
62
|
-
const camera = await deviceManagerProxy.getCamera(cameraIdOrName, this.#plugin.id);
|
|
63
|
-
|
|
64
|
-
if (camera) {
|
|
65
|
-
cameraDevice = await this.#getCameraDevice(camera);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return cameraDevice;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
public async createCamera(cameraConfig: CameraConfig): Promise<CameraDevice> {
|
|
73
|
-
const deviceManagerProxy = await this.#deviceManagerProxy();
|
|
74
|
-
const camera = await deviceManagerProxy.createCamera(cameraConfig, this.#plugin.id);
|
|
75
|
-
const cameraDevice = await this.#getCameraDevice(camera);
|
|
76
|
-
return cameraDevice;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public async updateCamera(cameraIdOrName: string, cameraConfig: Partial<CameraConfig>): Promise<CameraDevice> {
|
|
80
|
-
const deviceManagerProxy = await this.#deviceManagerProxy();
|
|
81
|
-
const camera = await deviceManagerProxy.updateCamera(cameraIdOrName, cameraConfig, this.#plugin.id);
|
|
82
|
-
const cameraDevice = await this.#getCameraDevice(camera);
|
|
83
|
-
return cameraDevice;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
public async removeCamera(cameraIdOrName: string): Promise<void> {
|
|
87
|
-
const deviceManagerProxy = await this.#deviceManagerProxy();
|
|
88
|
-
const camera = await deviceManagerProxy.getCamera(cameraIdOrName, this.#plugin.id);
|
|
89
|
-
|
|
90
|
-
if (camera) {
|
|
91
|
-
await deviceManagerProxy.removeCamera(cameraIdOrName, this.#plugin.id);
|
|
92
|
-
this.#devices.delete(camera._id);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public emit(): boolean {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public async configureCameras(cameraDevices: CameraDeviceProxy[]): Promise<void> {
|
|
101
|
-
await Promise.all(cameraDevices.map((cameraDevice) => this.#getCameraDevice(cameraDevice)));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async #deviceManagerProxy(): Promise<Promisify<DeviceManagerInterface>> {
|
|
105
|
-
return await this.#proxy.createRPCProxy<DeviceManagerInterface>(this.#namespaces.deviceManagerRpc);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async #onEventMessage(event: Message<DeviceManagerListenerMessagePayload>): Promise<void> {
|
|
109
|
-
const message = event.data;
|
|
110
|
-
switch (message.type) {
|
|
111
|
-
case 'cameraSelected': {
|
|
112
|
-
const { camera, extension }: DeviceManagerProxyEvents['cameraSelected'] = message.data;
|
|
113
|
-
const cameraDevice = await this.#getCameraDevice(camera);
|
|
114
|
-
|
|
115
|
-
super.emit(message.type, cameraDevice, extension);
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
case 'cameraDeselected': {
|
|
119
|
-
const { camera, extension }: DeviceManagerProxyEvents['cameraDeselected'] = message.data;
|
|
120
|
-
super.emit(message.type, camera._id, extension);
|
|
121
|
-
|
|
122
|
-
const cameraDevice = this.#devices.get(camera._id);
|
|
123
|
-
await cameraDevice?.cleanup();
|
|
124
|
-
await this.#removeCameraStorage(camera._id);
|
|
125
|
-
this.#devices.delete(camera._id);
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
#getCameraDevice(camera: Camera): Promise<CameraDeviceProxy>;
|
|
132
|
-
#getCameraDevice(cameraDevice: CameraDeviceProxy): Promise<CameraDeviceProxy>;
|
|
133
|
-
#getCameraDevice(identifier: string): Promise<CameraDeviceProxy | undefined>;
|
|
134
|
-
async #getCameraDevice(cameraOrIdentifier: Camera | CameraDeviceProxy | string): Promise<CameraDeviceProxy | undefined> {
|
|
135
|
-
let cameraDevice: CameraDeviceProxy | undefined;
|
|
136
|
-
|
|
137
|
-
if (typeof cameraOrIdentifier === 'string') {
|
|
138
|
-
cameraDevice = Array.from(this.#devices.values()).find((cameraDevice) => cameraDevice.id === cameraOrIdentifier || cameraDevice.name === cameraOrIdentifier);
|
|
139
|
-
} else if (cameraOrIdentifier instanceof CameraDeviceProxy) {
|
|
140
|
-
cameraDevice = cameraOrIdentifier;
|
|
141
|
-
|
|
142
|
-
if (this.#devices.has(cameraDevice.id)) {
|
|
143
|
-
cameraDevice = this.#devices.get(cameraDevice.id)!;
|
|
144
|
-
} else {
|
|
145
|
-
this.#devices.set(cameraDevice.id, cameraDevice);
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
const camera = cameraOrIdentifier;
|
|
149
|
-
|
|
150
|
-
if (this.#devices.has(camera._id)) {
|
|
151
|
-
cameraDevice = this.#devices.get(camera._id)!;
|
|
152
|
-
} else {
|
|
153
|
-
const cameraLogger = this.#logger.createLogger({ suffix: camera.name, loggerId: camera._id });
|
|
154
|
-
cameraDevice = new CameraDeviceProxy(this.#proxy, this.#api, camera, this.#plugin, cameraLogger);
|
|
155
|
-
this.#devices.set(camera._id, cameraDevice);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (cameraDevice) {
|
|
160
|
-
await this.#createCameraStorage(cameraDevice.id);
|
|
161
|
-
await cameraDevice?.init();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return cameraDevice;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async #createCameraStorage(cameraId: string): Promise<void> {
|
|
168
|
-
await this.#storageController.createStorage('camera', cameraId);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async #removeCameraStorage(cameraId: string): Promise<void> {
|
|
172
|
-
await this.#storageController.removeStorage('camera', cameraId);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async #close(): Promise<void> {
|
|
176
|
-
this.#initialized = false;
|
|
177
|
-
this.removeAllListeners();
|
|
178
|
-
this.#api.removeListener('shutdown', this.#close.bind(this));
|
|
179
|
-
this.#requests?.unsubscribe();
|
|
180
|
-
this.#requests = undefined;
|
|
181
|
-
await this.#disconnectRpc();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async #disconnectRpc(): Promise<void> {
|
|
185
|
-
await this.#proxy.disconnectRPCConnection(this.#namespaces.deviceManagerRpc);
|
|
186
|
-
}
|
|
187
|
-
}
|