@yume-chan/adb 0.0.9 → 0.0.12
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/CHANGELOG.json +55 -0
- package/CHANGELOG.md +35 -0
- package/LICENSE +21 -21
- package/README.md +240 -257
- package/esm/adb.d.ts +48 -0
- package/esm/adb.d.ts.map +1 -0
- package/esm/adb.js +141 -145
- package/esm/adb.js.map +1 -1
- package/{dts → esm}/auth.d.ts +17 -7
- package/esm/auth.d.ts.map +1 -0
- package/esm/auth.js +69 -109
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +9 -0
- package/esm/backend.d.ts.map +1 -0
- package/{dts → esm}/commands/base.d.ts +1 -1
- package/esm/commands/base.d.ts.map +1 -0
- package/esm/commands/base.js +1 -0
- package/esm/commands/base.js.map +1 -1
- package/{dts → esm}/commands/framebuffer.d.ts +3 -3
- package/esm/commands/framebuffer.d.ts.map +1 -0
- package/esm/commands/framebuffer.js +15 -18
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +9 -0
- package/esm/commands/index.d.ts.map +1 -0
- package/esm/commands/index.js +8 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/install.d.ts +4 -0
- package/esm/commands/install.d.ts.map +1 -0
- package/esm/commands/install.js +21 -13
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/power.d.ts +23 -0
- package/esm/commands/power.d.ts.map +1 -0
- package/esm/commands/power.js +45 -0
- package/esm/commands/power.js.map +1 -0
- package/{dts → esm}/commands/reverse.d.ts +3 -3
- package/esm/commands/reverse.d.ts.map +1 -0
- package/esm/commands/reverse.js +50 -60
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +57 -0
- package/esm/commands/subprocess/index.d.ts.map +1 -0
- package/esm/commands/subprocess/index.js +83 -0
- package/esm/commands/subprocess/index.js.map +1 -0
- package/esm/commands/subprocess/legacy.d.ts +28 -0
- package/esm/commands/subprocess/legacy.d.ts.map +1 -0
- package/esm/commands/subprocess/legacy.js +44 -0
- package/esm/commands/subprocess/legacy.js.map +1 -0
- package/esm/commands/subprocess/protocol.d.ts +38 -0
- package/esm/commands/subprocess/protocol.d.ts.map +1 -0
- package/esm/commands/subprocess/protocol.js +155 -0
- package/esm/commands/subprocess/protocol.js.map +1 -0
- package/esm/commands/subprocess/types.d.ts +47 -0
- package/esm/commands/subprocess/types.d.ts.map +1 -0
- package/esm/commands/{shell → subprocess}/types.js +0 -0
- package/{cjs/commands/shell → esm/commands/subprocess}/types.js.map +1 -1
- package/{dts/commands/shell → esm/commands/subprocess}/utils.d.ts +0 -0
- package/esm/commands/subprocess/utils.d.ts.map +1 -0
- package/esm/commands/{shell → subprocess}/utils.js +0 -0
- package/esm/commands/subprocess/utils.js.map +1 -0
- package/esm/commands/sync/index.d.ts +8 -0
- package/esm/commands/sync/index.d.ts.map +1 -0
- package/esm/commands/sync/index.js +7 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/{dts → esm}/commands/sync/list.d.ts +4 -4
- package/esm/commands/sync/list.d.ts.map +1 -0
- package/esm/commands/sync/list.js +16 -19
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +11 -0
- package/esm/commands/sync/pull.d.ts.map +1 -0
- package/esm/commands/sync/pull.js +17 -11
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +8 -0
- package/esm/commands/sync/push.d.ts.map +1 -0
- package/esm/commands/sync/push.js +19 -37
- package/esm/commands/sync/push.js.map +1 -1
- package/{dts → esm}/commands/sync/request.d.ts +3 -3
- package/esm/commands/sync/request.d.ts.map +1 -0
- package/esm/commands/sync/request.js +24 -26
- package/esm/commands/sync/request.js.map +1 -1
- package/{dts → esm}/commands/sync/response.d.ts +3 -3
- package/esm/commands/sync/response.d.ts.map +1 -0
- package/esm/commands/sync/response.js +16 -19
- package/esm/commands/sync/response.js.map +1 -1
- package/{dts → esm}/commands/sync/stat.d.ts +4 -4
- package/esm/commands/sync/stat.d.ts.map +1 -0
- package/esm/commands/sync/stat.js +22 -27
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +83 -0
- package/esm/commands/sync/sync.d.ts.map +1 -0
- package/esm/commands/sync/sync.js +92 -89
- package/esm/commands/sync/sync.js.map +1 -1
- package/{dts → esm}/commands/tcpip.d.ts +1 -1
- package/{dts → esm}/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +14 -19
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/crypto.d.ts +24 -0
- package/esm/crypto.d.ts.map +1 -0
- package/esm/crypto.js +33 -31
- package/esm/crypto.js.map +1 -1
- package/{dts → esm}/features.d.ts +0 -0
- package/{dts → esm}/features.d.ts.map +0 -0
- package/esm/features.js +1 -1
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +11 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +10 -10
- package/esm/index.js.map +1 -1
- package/esm/packet.d.ts +28 -0
- package/esm/packet.d.ts.map +1 -0
- package/esm/packet.js +26 -53
- package/esm/packet.js.map +1 -1
- package/esm/socket/controller.d.ts +37 -0
- package/esm/socket/controller.d.ts.map +1 -0
- package/esm/socket/controller.js +52 -66
- package/esm/socket/controller.js.map +1 -1
- package/{dts → esm}/socket/dispatcher.d.ts +10 -23
- package/esm/socket/dispatcher.d.ts.map +1 -0
- package/esm/socket/dispatcher.js +148 -164
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/index.d.ts +3 -0
- package/esm/socket/index.d.ts.map +1 -0
- package/esm/socket/index.js +2 -6
- package/esm/socket/index.js.map +1 -1
- package/esm/socket/socket.d.ts +34 -0
- package/esm/socket/socket.d.ts.map +1 -0
- package/esm/socket/socket.js +69 -14
- package/esm/socket/socket.js.map +1 -1
- package/esm/stream/buffered.d.ts +35 -0
- package/esm/stream/buffered.d.ts.map +1 -0
- package/esm/stream/buffered.js +123 -0
- package/esm/stream/buffered.js.map +1 -0
- package/esm/stream/detect.bak.d.ts +240 -0
- package/esm/stream/detect.bak.d.ts.map +1 -0
- package/esm/stream/detect.bak.js +60 -0
- package/esm/stream/detect.bak.js.map +1 -0
- package/esm/stream/detect.d.ts +18 -0
- package/esm/stream/detect.d.ts.map +1 -0
- package/esm/stream/detect.js +6 -0
- package/esm/stream/detect.js.map +1 -0
- package/esm/stream/detect.native.d.ts +240 -0
- package/esm/stream/detect.native.d.ts.map +1 -0
- package/esm/stream/detect.native.js +60 -0
- package/esm/stream/detect.native.js.map +1 -0
- package/esm/stream/detect.polyfill.d.ts +18 -0
- package/esm/stream/detect.polyfill.d.ts.map +1 -0
- package/esm/stream/detect.polyfill.js +6 -0
- package/esm/stream/detect.polyfill.js.map +1 -0
- package/esm/stream/index.d.ts +4 -0
- package/esm/stream/index.d.ts.map +1 -0
- package/esm/stream/index.js +3 -2
- package/esm/stream/index.js.map +1 -1
- package/esm/stream/transform.d.ts +98 -0
- package/esm/stream/transform.d.ts.map +1 -0
- package/esm/stream/transform.js +352 -0
- package/esm/stream/transform.js.map +1 -0
- package/{dts → esm}/utils/auto-reset-event.d.ts +1 -1
- package/esm/utils/auto-reset-event.d.ts.map +1 -0
- package/esm/utils/auto-reset-event.js +2 -1
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +5 -0
- package/esm/utils/base64.d.ts.map +1 -0
- package/esm/utils/base64.js +116 -80
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/encoding.d.ts +3 -0
- package/esm/utils/encoding.d.ts.map +1 -0
- package/esm/utils/encoding.js +11 -0
- package/esm/utils/encoding.js.map +1 -0
- package/esm/utils/index.d.ts +4 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +3 -4
- package/esm/utils/index.js.map +1 -1
- package/package.json +49 -50
- package/src/adb.ts +247 -242
- package/src/auth.ts +170 -156
- package/src/backend.ts +11 -24
- package/src/commands/base.ts +11 -11
- package/src/commands/framebuffer.ts +73 -73
- package/src/commands/index.ts +8 -8
- package/src/commands/install.ts +32 -21
- package/src/commands/power.ts +54 -0
- package/src/commands/reverse.ts +136 -133
- package/src/commands/subprocess/index.ts +124 -0
- package/src/commands/subprocess/legacy.ts +58 -0
- package/src/commands/subprocess/protocol.ts +185 -0
- package/src/commands/subprocess/types.ts +55 -0
- package/src/commands/{shell → subprocess}/utils.ts +20 -20
- package/src/commands/sync/index.ts +7 -7
- package/src/commands/sync/list.ts +40 -39
- package/src/commands/sync/pull.ts +43 -34
- package/src/commands/sync/push.ts +41 -46
- package/src/commands/sync/request.ts +49 -48
- package/src/commands/sync/response.ts +58 -57
- package/src/commands/sync/stat.ts +123 -121
- package/src/commands/sync/sync.ts +145 -113
- package/src/commands/tcpip.ts +21 -21
- package/src/crypto.ts +280 -280
- package/src/features.ts +5 -5
- package/src/index.ts +11 -10
- package/src/packet.ts +69 -89
- package/src/socket/dispatcher.ts +256 -269
- package/src/socket/index.ts +2 -6
- package/src/socket/socket.ts +129 -28
- package/src/stream/buffered.ts +147 -0
- package/src/stream/detect.native.ts +362 -0
- package/src/stream/detect.polyfill.ts +25 -0
- package/src/stream/detect.ts +25 -0
- package/src/stream/index.ts +3 -2
- package/src/stream/transform.ts +427 -0
- package/src/utils/auto-reset-event.ts +41 -41
- package/src/utils/base64.ts +306 -274
- package/src/utils/encoding.ts +13 -0
- package/src/utils/index.ts +3 -4
- package/tsconfig.build.json +3 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.test.json +10 -0
- package/cjs/adb.js +0 -205
- package/cjs/adb.js.map +0 -1
- package/cjs/auth.js +0 -141
- package/cjs/auth.js.map +0 -1
- package/cjs/backend.js +0 -3
- package/cjs/backend.js.map +0 -1
- package/cjs/commands/base.js +0 -12
- package/cjs/commands/base.js.map +0 -1
- package/cjs/commands/demo-mode.js +0 -174
- package/cjs/commands/demo-mode.js.map +0 -1
- package/cjs/commands/framebuffer.js +0 -66
- package/cjs/commands/framebuffer.js.map +0 -1
- package/cjs/commands/index.js +0 -12
- package/cjs/commands/index.js.map +0 -1
- package/cjs/commands/install.js +0 -20
- package/cjs/commands/install.js.map +0 -1
- package/cjs/commands/reverse.js +0 -105
- package/cjs/commands/reverse.js.map +0 -1
- package/cjs/commands/shell/index.js +0 -56
- package/cjs/commands/shell/index.js.map +0 -1
- package/cjs/commands/shell/legacy.js +0 -37
- package/cjs/commands/shell/legacy.js.map +0 -1
- package/cjs/commands/shell/protocol.js +0 -83
- package/cjs/commands/shell/protocol.js.map +0 -1
- package/cjs/commands/shell/types.js +0 -3
- package/cjs/commands/shell/utils.js +0 -23
- package/cjs/commands/shell/utils.js.map +0 -1
- package/cjs/commands/sync/index.js +0 -11
- package/cjs/commands/sync/index.js.map +0 -1
- package/cjs/commands/sync/list.js +0 -36
- package/cjs/commands/sync/list.js.map +0 -1
- package/cjs/commands/sync/pull.js +0 -34
- package/cjs/commands/sync/pull.js.map +0 -1
- package/cjs/commands/sync/push.js +0 -49
- package/cjs/commands/sync/push.js.map +0 -1
- package/cjs/commands/sync/request.js +0 -48
- package/cjs/commands/sync/request.js.map +0 -1
- package/cjs/commands/sync/response.js +0 -53
- package/cjs/commands/sync/response.js.map +0 -1
- package/cjs/commands/sync/stat.js +0 -109
- package/cjs/commands/sync/stat.js.map +0 -1
- package/cjs/commands/sync/sync.js +0 -118
- package/cjs/commands/sync/sync.js.map +0 -1
- package/cjs/commands/tcpip.js +0 -28
- package/cjs/commands/tcpip.js.map +0 -1
- package/cjs/crypto.js +0 -231
- package/cjs/crypto.js.map +0 -1
- package/cjs/features.js +0 -10
- package/cjs/features.js.map +0 -1
- package/cjs/index.js +0 -14
- package/cjs/index.js.map +0 -1
- package/cjs/packet.js +0 -77
- package/cjs/packet.js.map +0 -1
- package/cjs/socket/close-event-emitter.js +0 -32
- package/cjs/socket/close-event-emitter.js.map +0 -1
- package/cjs/socket/controller.js +0 -84
- package/cjs/socket/controller.js.map +0 -1
- package/cjs/socket/data-event-emitter.js +0 -29
- package/cjs/socket/data-event-emitter.js.map +0 -1
- package/cjs/socket/dispatcher.js +0 -219
- package/cjs/socket/dispatcher.js.map +0 -1
- package/cjs/socket/index.js +0 -10
- package/cjs/socket/index.js.map +0 -1
- package/cjs/socket/logger.js +0 -3
- package/cjs/socket/logger.js.map +0 -1
- package/cjs/socket/socket.js +0 -24
- package/cjs/socket/socket.js.map +0 -1
- package/cjs/stream/buffered-stream.js +0 -78
- package/cjs/stream/buffered-stream.js.map +0 -1
- package/cjs/stream/index.js +0 -6
- package/cjs/stream/index.js.map +0 -1
- package/cjs/stream/stream.js +0 -45
- package/cjs/stream/stream.js.map +0 -1
- package/cjs/utils/auto-reset-event.js +0 -37
- package/cjs/utils/auto-reset-event.js.map +0 -1
- package/cjs/utils/base64.js +0 -210
- package/cjs/utils/base64.js.map +0 -1
- package/cjs/utils/chunk.js +0 -75
- package/cjs/utils/chunk.js.map +0 -1
- package/cjs/utils/event-queue.js +0 -108
- package/cjs/utils/event-queue.js.map +0 -1
- package/cjs/utils/index.js +0 -8
- package/cjs/utils/index.js.map +0 -1
- package/dts/adb.d.ts +0 -46
- package/dts/adb.d.ts.map +0 -1
- package/dts/auth.d.ts.map +0 -1
- package/dts/backend.d.ts +0 -15
- package/dts/backend.d.ts.map +0 -1
- package/dts/commands/base.d.ts.map +0 -1
- package/dts/commands/demo-mode.d.ts +0 -41
- package/dts/commands/demo-mode.d.ts.map +0 -1
- package/dts/commands/framebuffer.d.ts.map +0 -1
- package/dts/commands/index.d.ts +0 -9
- package/dts/commands/index.d.ts.map +0 -1
- package/dts/commands/install.d.ts +0 -3
- package/dts/commands/install.d.ts.map +0 -1
- package/dts/commands/reverse.d.ts.map +0 -1
- package/dts/commands/shell/index.d.ts +0 -20
- package/dts/commands/shell/index.d.ts.map +0 -1
- package/dts/commands/shell/legacy.d.ts +0 -27
- package/dts/commands/shell/legacy.d.ts.map +0 -1
- package/dts/commands/shell/protocol.d.ts +0 -37
- package/dts/commands/shell/protocol.d.ts.map +0 -1
- package/dts/commands/shell/types.d.ts +0 -15
- package/dts/commands/shell/types.d.ts.map +0 -1
- package/dts/commands/shell/utils.d.ts.map +0 -1
- package/dts/commands/sync/index.d.ts +0 -8
- package/dts/commands/sync/index.d.ts.map +0 -1
- package/dts/commands/sync/list.d.ts.map +0 -1
- package/dts/commands/sync/pull.d.ts +0 -11
- package/dts/commands/sync/pull.d.ts.map +0 -1
- package/dts/commands/sync/push.d.ts +0 -8
- package/dts/commands/sync/push.d.ts.map +0 -1
- package/dts/commands/sync/request.d.ts.map +0 -1
- package/dts/commands/sync/response.d.ts.map +0 -1
- package/dts/commands/sync/stat.d.ts.map +0 -1
- package/dts/commands/sync/sync.d.ts +0 -68
- package/dts/commands/sync/sync.d.ts.map +0 -1
- package/dts/crypto.d.ts +0 -17
- package/dts/crypto.d.ts.map +0 -1
- package/dts/index.d.ts +0 -11
- package/dts/index.d.ts.map +0 -1
- package/dts/packet.d.ts +0 -27
- package/dts/packet.d.ts.map +0 -1
- package/dts/socket/close-event-emitter.d.ts +0 -8
- package/dts/socket/close-event-emitter.d.ts.map +0 -1
- package/dts/socket/controller.d.ts +0 -43
- package/dts/socket/controller.d.ts.map +0 -1
- package/dts/socket/data-event-emitter.d.ts +0 -10
- package/dts/socket/data-event-emitter.d.ts.map +0 -1
- package/dts/socket/dispatcher.d.ts.map +0 -1
- package/dts/socket/index.d.ts +0 -7
- package/dts/socket/index.d.ts.map +0 -1
- package/dts/socket/logger.d.ts +0 -9
- package/dts/socket/logger.d.ts.map +0 -1
- package/dts/socket/socket.d.ts +0 -22
- package/dts/socket/socket.d.ts.map +0 -1
- package/dts/stream/buffered-stream.d.ts +0 -30
- package/dts/stream/buffered-stream.d.ts.map +0 -1
- package/dts/stream/index.d.ts +0 -3
- package/dts/stream/index.d.ts.map +0 -1
- package/dts/stream/stream.d.ts +0 -15
- package/dts/stream/stream.d.ts.map +0 -1
- package/dts/utils/auto-reset-event.d.ts.map +0 -1
- package/dts/utils/base64.d.ts +0 -7
- package/dts/utils/base64.d.ts.map +0 -1
- package/dts/utils/chunk.d.ts +0 -3
- package/dts/utils/chunk.d.ts.map +0 -1
- package/dts/utils/event-queue.d.ts +0 -35
- package/dts/utils/event-queue.d.ts.map +0 -1
- package/dts/utils/index.d.ts +0 -5
- package/dts/utils/index.d.ts.map +0 -1
- package/esm/commands/demo-mode.js +0 -170
- package/esm/commands/demo-mode.js.map +0 -1
- package/esm/commands/shell/index.js +0 -52
- package/esm/commands/shell/index.js.map +0 -1
- package/esm/commands/shell/legacy.js +0 -33
- package/esm/commands/shell/legacy.js.map +0 -1
- package/esm/commands/shell/protocol.js +0 -79
- package/esm/commands/shell/protocol.js.map +0 -1
- package/esm/commands/shell/types.js.map +0 -1
- package/esm/commands/shell/utils.js.map +0 -1
- package/esm/socket/close-event-emitter.js +0 -28
- package/esm/socket/close-event-emitter.js.map +0 -1
- package/esm/socket/data-event-emitter.js +0 -25
- package/esm/socket/data-event-emitter.js.map +0 -1
- package/esm/socket/logger.js +0 -2
- package/esm/socket/logger.js.map +0 -1
- package/esm/stream/buffered-stream.js +0 -73
- package/esm/stream/buffered-stream.js.map +0 -1
- package/esm/stream/stream.js +0 -41
- package/esm/stream/stream.js.map +0 -1
- package/esm/utils/chunk.js +0 -70
- package/esm/utils/chunk.js.map +0 -1
- package/esm/utils/event-queue.js +0 -104
- package/esm/utils/event-queue.js.map +0 -1
- package/src/commands/demo-mode.ts +0 -160
- package/src/commands/shell/index.ts +0 -68
- package/src/commands/shell/legacy.ts +0 -42
- package/src/commands/shell/protocol.ts +0 -94
- package/src/commands/shell/types.ts +0 -21
- package/src/socket/close-event-emitter.ts +0 -28
- package/src/socket/controller.ts +0 -105
- package/src/socket/data-event-emitter.ts +0 -27
- package/src/socket/logger.ts +0 -12
- package/src/stream/buffered-stream.ts +0 -100
- package/src/stream/stream.ts +0 -50
- package/src/utils/chunk.ts +0 -70
- package/src/utils/event-queue.ts +0 -145
- package/tsconfig.cjs.json +0 -11
- package/tsconfig.esm.json +0 -28
- package/tsconfig.esm.tsbuildinfo +0 -1305
- package/tsconfig.json +0 -18
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
import { AutoDisposable } from '@yume-chan/event';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { AdbSocket } from './socket';
|
|
6
|
-
export interface AdbPacketReceivedEventArgs {
|
|
7
|
-
handled: boolean;
|
|
8
|
-
packet: AdbPacket;
|
|
9
|
-
}
|
|
2
|
+
import { AdbCommand, type AdbPacketCore, type AdbPacketInit } from '../packet.js';
|
|
3
|
+
import { type ReadableWritablePair } from '../stream/index.js';
|
|
4
|
+
import { AdbSocket } from './socket.js';
|
|
10
5
|
export interface AdbIncomingSocketEventArgs {
|
|
11
6
|
handled: boolean;
|
|
12
|
-
packet:
|
|
7
|
+
packet: AdbPacketCore;
|
|
13
8
|
serviceString: string;
|
|
14
9
|
socket: AdbSocket;
|
|
15
10
|
}
|
|
16
11
|
export declare class AdbPacketDispatcher extends AutoDisposable {
|
|
17
12
|
private readonly initializers;
|
|
18
13
|
private readonly sockets;
|
|
19
|
-
private
|
|
20
|
-
private readonly logger;
|
|
21
|
-
readonly backend: AdbBackend;
|
|
14
|
+
private _writer;
|
|
22
15
|
maxPayloadSize: number;
|
|
23
16
|
calculateChecksum: boolean;
|
|
24
17
|
appendNullToServiceString: boolean;
|
|
25
|
-
private
|
|
26
|
-
get
|
|
27
|
-
(listener: import("@yume-chan/event").EventListener<AdbPacketReceivedEventArgs, unknown, [], unknown>): import("@yume-chan/event").RemoveEventListener;
|
|
28
|
-
<TThis, TArgs extends unknown[]>(listener: import("@yume-chan/event").EventListener<AdbPacketReceivedEventArgs, TThis, TArgs, unknown>, thisArg: TThis, ...args: TArgs): import("@yume-chan/event").RemoveEventListener;
|
|
29
|
-
};
|
|
18
|
+
private _disconnected;
|
|
19
|
+
get disconnected(): Promise<void>;
|
|
30
20
|
private readonly incomingSocketEvent;
|
|
31
21
|
get onIncomingSocket(): {
|
|
32
22
|
(listener: import("@yume-chan/event").EventListener<AdbIncomingSocketEventArgs, unknown, [], unknown>): import("@yume-chan/event").RemoveEventListener;
|
|
@@ -37,17 +27,14 @@ export declare class AdbPacketDispatcher extends AutoDisposable {
|
|
|
37
27
|
(listener: import("@yume-chan/event").EventListener<Error, unknown, [], unknown>): import("@yume-chan/event").RemoveEventListener;
|
|
38
28
|
<TThis, TArgs extends unknown[]>(listener: import("@yume-chan/event").EventListener<Error, TThis, TArgs, unknown>, thisArg: TThis, ...args: TArgs): import("@yume-chan/event").RemoveEventListener;
|
|
39
29
|
};
|
|
40
|
-
private
|
|
41
|
-
|
|
42
|
-
constructor(backend: AdbBackend, logger?: AdbLogger);
|
|
43
|
-
private receiveLoop;
|
|
30
|
+
private _abortController;
|
|
31
|
+
constructor(connection: ReadableWritablePair<AdbPacketCore, AdbPacketInit>);
|
|
44
32
|
private handleOk;
|
|
45
33
|
private handleClose;
|
|
46
34
|
private handleOpen;
|
|
47
|
-
start(): void;
|
|
48
35
|
createSocket(serviceString: string): Promise<AdbSocket>;
|
|
49
36
|
sendPacket(packet: AdbPacketInit): Promise<void>;
|
|
50
|
-
sendPacket(command: AdbCommand, arg0: number, arg1: number, payload?: string |
|
|
37
|
+
sendPacket(command: AdbCommand, arg0: number, arg1: number, payload?: string | Uint8Array): Promise<void>;
|
|
51
38
|
dispose(): void;
|
|
52
39
|
}
|
|
53
40
|
//# sourceMappingURL=dispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/socket/dispatcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAqB,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAgE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE7H,OAAO,EAA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yume-chan/async';
|
|
3
2
|
import { AutoDisposable, EventEmitter } from '@yume-chan/event';
|
|
4
|
-
import { AdbCommand,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { AdbSocket } from './socket';
|
|
8
|
-
const
|
|
3
|
+
import { AdbCommand, calculateChecksum } from '../packet.js';
|
|
4
|
+
import { AbortController, WritableStream } from '../stream/index.js';
|
|
5
|
+
import { decodeUtf8, encodeUtf8 } from '../utils/index.js';
|
|
6
|
+
import { AdbSocket } from './socket.js';
|
|
7
|
+
const EmptyUint8Array = new Uint8Array(0);
|
|
9
8
|
export class AdbPacketDispatcher extends AutoDisposable {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.incomingSocketEvent = this.addDisposable(new EventEmitter());
|
|
22
|
-
this.errorEvent = this.addDisposable(new EventEmitter());
|
|
23
|
-
this._running = false;
|
|
24
|
-
this.backend = backend;
|
|
25
|
-
this.logger = logger;
|
|
26
|
-
}
|
|
27
|
-
get onPacket() { return this.packetEvent.event; }
|
|
9
|
+
// ADB socket id starts from 1
|
|
10
|
+
// (0 means open failed)
|
|
11
|
+
initializers = new AsyncOperationManager(1);
|
|
12
|
+
sockets = new Map();
|
|
13
|
+
_writer;
|
|
14
|
+
maxPayloadSize = 0;
|
|
15
|
+
calculateChecksum = true;
|
|
16
|
+
appendNullToServiceString = true;
|
|
17
|
+
_disconnected = new PromiseResolver();
|
|
18
|
+
get disconnected() { return this._disconnected.promise; }
|
|
19
|
+
incomingSocketEvent = this.addDisposable(new EventEmitter());
|
|
28
20
|
get onIncomingSocket() { return this.incomingSocketEvent.event; }
|
|
21
|
+
errorEvent = this.addDisposable(new EventEmitter());
|
|
29
22
|
get onError() { return this.errorEvent.event; }
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(_b = (_a = this.logger) === null || _a === void 0 ? void 0 : _a.onIncomingPacket) === null || _b === void 0 ? void 0 : _b.call(_a, packet);
|
|
23
|
+
_abortController = new AbortController();
|
|
24
|
+
constructor(connection) {
|
|
25
|
+
super();
|
|
26
|
+
connection.readable
|
|
27
|
+
.pipeTo(new WritableStream({
|
|
28
|
+
write: async (packet) => {
|
|
29
|
+
try {
|
|
38
30
|
switch (packet.command) {
|
|
39
31
|
case AdbCommand.OK:
|
|
40
32
|
this.handleOk(packet);
|
|
41
|
-
|
|
33
|
+
return;
|
|
42
34
|
case AdbCommand.Close:
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
await this.handleClose(packet);
|
|
36
|
+
return;
|
|
45
37
|
case AdbCommand.Write:
|
|
46
38
|
if (this.sockets.has(packet.arg1)) {
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
await this.sockets.get(packet.arg1).enqueue(packet.payload);
|
|
40
|
+
await this.sendPacket(AdbCommand.OK, packet.arg1, packet.arg0);
|
|
49
41
|
}
|
|
50
42
|
// Maybe the device is responding to a packet of last connection
|
|
51
43
|
// Just ignore it
|
|
52
|
-
|
|
44
|
+
return;
|
|
53
45
|
case AdbCommand.Open:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
const args = {
|
|
58
|
-
handled: false,
|
|
59
|
-
packet,
|
|
60
|
-
};
|
|
61
|
-
this.packetEvent.fire(args);
|
|
62
|
-
if (!args.handled) {
|
|
63
|
-
this.dispose();
|
|
64
|
-
throw new Error(`Unhandled packet with command '${packet.command}'`);
|
|
46
|
+
await this.handleOpen(packet);
|
|
47
|
+
return;
|
|
65
48
|
}
|
|
66
49
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
50
|
+
catch (e) {
|
|
51
|
+
this.errorEvent.fire(e);
|
|
52
|
+
// Throw error here will stop the pipe
|
|
53
|
+
// But won't close `readable` because of `preventCancel: true`
|
|
54
|
+
throw e;
|
|
72
55
|
}
|
|
73
|
-
|
|
74
|
-
|
|
56
|
+
},
|
|
57
|
+
}), {
|
|
58
|
+
preventCancel: false,
|
|
59
|
+
signal: this._abortController.signal,
|
|
60
|
+
})
|
|
61
|
+
.then(() => {
|
|
62
|
+
this.dispose();
|
|
63
|
+
}, () => {
|
|
64
|
+
// TODO: AdbPacketDispatcher: reject `_disconnected` when pipe errored?
|
|
65
|
+
this.dispose();
|
|
75
66
|
});
|
|
67
|
+
this._writer = connection.writable.getWriter();
|
|
76
68
|
}
|
|
77
69
|
handleOk(packet) {
|
|
78
70
|
if (this.initializers.resolve(packet.arg1, packet.arg0)) {
|
|
@@ -89,126 +81,118 @@ export class AdbPacketDispatcher extends AutoDisposable {
|
|
|
89
81
|
// Tell the device to close the socket
|
|
90
82
|
this.sendPacket(AdbCommand.Close, packet.arg1, packet.arg0);
|
|
91
83
|
}
|
|
92
|
-
handleClose(packet) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
yield this.sendPacket(AdbCommand.Close, packet.arg1, packet.arg0);
|
|
111
|
-
}
|
|
112
|
-
socket.dispose();
|
|
113
|
-
this.sockets.delete(packet.arg1);
|
|
114
|
-
return;
|
|
84
|
+
async handleClose(packet) {
|
|
85
|
+
// From https://android.googlesource.com/platform/packages/modules/adb/+/65d18e2c1cc48b585811954892311b28a4c3d188/adb.cpp#459
|
|
86
|
+
/* According to protocol.txt, p->msg.arg0 might be 0 to indicate
|
|
87
|
+
* a failed OPEN only. However, due to a bug in previous ADB
|
|
88
|
+
* versions, CLOSE(0, remote-id, "") was also used for normal
|
|
89
|
+
* CLOSE() operations.
|
|
90
|
+
*/
|
|
91
|
+
// So don't return if `reject` didn't find a pending socket
|
|
92
|
+
if (packet.arg0 === 0 &&
|
|
93
|
+
this.initializers.reject(packet.arg1, new Error('Socket open failed'))) {
|
|
94
|
+
// Device failed to create the socket
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const socket = this.sockets.get(packet.arg1);
|
|
98
|
+
if (socket) {
|
|
99
|
+
// The device want to close the socket
|
|
100
|
+
if (!socket.closed) {
|
|
101
|
+
await this.sendPacket(AdbCommand.Close, packet.arg1, packet.arg0);
|
|
115
102
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
socket.dispose();
|
|
104
|
+
this.sockets.delete(packet.arg1);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// Maybe the device is responding to a packet of last connection
|
|
108
|
+
// Just ignore it
|
|
119
109
|
}
|
|
120
|
-
handleOpen(packet) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
serviceString,
|
|
134
|
-
});
|
|
135
|
-
const socket = new AdbSocket(controller);
|
|
136
|
-
const args = {
|
|
137
|
-
handled: false,
|
|
138
|
-
packet,
|
|
139
|
-
serviceString,
|
|
140
|
-
socket,
|
|
141
|
-
};
|
|
142
|
-
this.incomingSocketEvent.fire(args);
|
|
143
|
-
if (args.handled) {
|
|
144
|
-
this.sockets.set(localId, controller);
|
|
145
|
-
yield this.sendPacket(AdbCommand.OK, localId, remoteId);
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
yield this.sendPacket(AdbCommand.Close, 0, remoteId);
|
|
149
|
-
}
|
|
110
|
+
async handleOpen(packet) {
|
|
111
|
+
// AsyncOperationManager doesn't support get and skip an ID
|
|
112
|
+
// Use `add` + `resolve` to simulate this behavior
|
|
113
|
+
const [localId] = this.initializers.add();
|
|
114
|
+
this.initializers.resolve(localId, undefined);
|
|
115
|
+
const remoteId = packet.arg0;
|
|
116
|
+
const serviceString = decodeUtf8(packet.payload);
|
|
117
|
+
const socket = new AdbSocket({
|
|
118
|
+
dispatcher: this,
|
|
119
|
+
localId,
|
|
120
|
+
remoteId,
|
|
121
|
+
localCreated: false,
|
|
122
|
+
serviceString,
|
|
150
123
|
});
|
|
124
|
+
const args = {
|
|
125
|
+
handled: false,
|
|
126
|
+
packet,
|
|
127
|
+
serviceString,
|
|
128
|
+
socket,
|
|
129
|
+
};
|
|
130
|
+
this.incomingSocketEvent.fire(args);
|
|
131
|
+
if (args.handled) {
|
|
132
|
+
this.sockets.set(localId, socket);
|
|
133
|
+
await this.sendPacket(AdbCommand.OK, localId, remoteId);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
await this.sendPacket(AdbCommand.Close, 0, remoteId);
|
|
137
|
+
}
|
|
151
138
|
}
|
|
152
|
-
|
|
153
|
-
this.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
dispatcher: this,
|
|
166
|
-
localId,
|
|
167
|
-
remoteId,
|
|
168
|
-
localCreated: true,
|
|
169
|
-
serviceString,
|
|
170
|
-
});
|
|
171
|
-
this.sockets.set(controller.localId, controller);
|
|
172
|
-
return new AdbSocket(controller);
|
|
139
|
+
async createSocket(serviceString) {
|
|
140
|
+
if (this.appendNullToServiceString) {
|
|
141
|
+
serviceString += '\0';
|
|
142
|
+
}
|
|
143
|
+
const [localId, initializer] = this.initializers.add();
|
|
144
|
+
await this.sendPacket(AdbCommand.Open, localId, 0, serviceString);
|
|
145
|
+
const remoteId = await initializer;
|
|
146
|
+
const socket = new AdbSocket({
|
|
147
|
+
dispatcher: this,
|
|
148
|
+
localId,
|
|
149
|
+
remoteId,
|
|
150
|
+
localCreated: true,
|
|
151
|
+
serviceString,
|
|
173
152
|
});
|
|
153
|
+
this.sockets.set(localId, socket);
|
|
154
|
+
return socket;
|
|
174
155
|
}
|
|
175
|
-
sendPacket(packetOrCommand, arg0, arg1, payload =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
init = {
|
|
184
|
-
command: packetOrCommand,
|
|
185
|
-
arg0: arg0,
|
|
186
|
-
arg1: arg1,
|
|
187
|
-
payload: typeof payload === 'string' ? this.backend.encodeUtf8(payload) : payload,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
if (init.payload &&
|
|
191
|
-
init.payload.byteLength > this.maxPayloadSize) {
|
|
192
|
-
throw new Error('payload too large');
|
|
193
|
-
}
|
|
194
|
-
try {
|
|
195
|
-
// `AdbPacket.write` writes each packet in two parts
|
|
196
|
-
// Use a lock to prevent packets been interlaced
|
|
197
|
-
yield this.sendLock.wait();
|
|
198
|
-
(_b = (_a = this.logger) === null || _a === void 0 ? void 0 : _a.onOutgoingPacket) === null || _b === void 0 ? void 0 : _b.call(_a, init);
|
|
199
|
-
yield AdbPacket.write(init, this.calculateChecksum, this.backend);
|
|
200
|
-
}
|
|
201
|
-
finally {
|
|
202
|
-
this.sendLock.notify();
|
|
156
|
+
async sendPacket(packetOrCommand, arg0, arg1, payload = EmptyUint8Array) {
|
|
157
|
+
let init;
|
|
158
|
+
if (arg0 === undefined) {
|
|
159
|
+
init = packetOrCommand;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
if (typeof payload === 'string') {
|
|
163
|
+
payload = encodeUtf8(payload);
|
|
203
164
|
}
|
|
204
|
-
|
|
165
|
+
init = {
|
|
166
|
+
command: packetOrCommand,
|
|
167
|
+
arg0: arg0,
|
|
168
|
+
arg1: arg1,
|
|
169
|
+
payload,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (init.payload &&
|
|
173
|
+
init.payload.byteLength > this.maxPayloadSize) {
|
|
174
|
+
throw new Error('payload too large');
|
|
175
|
+
}
|
|
176
|
+
if (this.calculateChecksum) {
|
|
177
|
+
calculateChecksum(init);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
init.checksum = 0;
|
|
181
|
+
}
|
|
182
|
+
await this._writer.write(init);
|
|
205
183
|
}
|
|
206
184
|
dispose() {
|
|
207
|
-
this._running = false;
|
|
208
185
|
for (const socket of this.sockets.values()) {
|
|
209
186
|
socket.dispose();
|
|
210
187
|
}
|
|
211
188
|
this.sockets.clear();
|
|
189
|
+
try {
|
|
190
|
+
// Stop pipes
|
|
191
|
+
this._abortController.abort();
|
|
192
|
+
}
|
|
193
|
+
catch { }
|
|
194
|
+
this._writer.releaseLock();
|
|
195
|
+
this._disconnected.resolve();
|
|
212
196
|
super.dispose();
|
|
213
197
|
}
|
|
214
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/socket/dispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../../src/socket/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAA0C,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,cAAc,EAA0D,MAAM,oBAAoB,CAAC;AAC7H,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAYxC,MAAM,eAAe,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,OAAO,mBAAoB,SAAQ,c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+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/socket/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
package/esm/socket/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './data-event-emitter';
|
|
4
|
-
export * from './dispatcher';
|
|
5
|
-
export * from './logger';
|
|
6
|
-
export * from './socket';
|
|
1
|
+
export * from './socket.js';
|
|
2
|
+
export * from './dispatcher.js';
|
|
7
3
|
//# sourceMappingURL=index.js.map
|
package/esm/socket/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/socket/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/socket/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReadableStream, WritableStream } from '../stream/index.js';
|
|
2
|
+
import type { AdbPacketDispatcher } from './dispatcher.js';
|
|
3
|
+
export interface AdbSocketInfo {
|
|
4
|
+
localId: number;
|
|
5
|
+
remoteId: number;
|
|
6
|
+
localCreated: boolean;
|
|
7
|
+
serviceString: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AdbSocketConstructionOptions {
|
|
10
|
+
dispatcher: AdbPacketDispatcher;
|
|
11
|
+
localId: number;
|
|
12
|
+
remoteId: number;
|
|
13
|
+
localCreated: boolean;
|
|
14
|
+
serviceString: string;
|
|
15
|
+
highWaterMark?: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare class AdbSocket implements AdbSocketInfo {
|
|
18
|
+
private readonly dispatcher;
|
|
19
|
+
readonly localId: number;
|
|
20
|
+
readonly remoteId: number;
|
|
21
|
+
readonly localCreated: boolean;
|
|
22
|
+
readonly serviceString: string;
|
|
23
|
+
private _factory;
|
|
24
|
+
private _readable;
|
|
25
|
+
private _readableController;
|
|
26
|
+
get readable(): ReadableStream<Uint8Array>;
|
|
27
|
+
private _writePromise;
|
|
28
|
+
readonly writable: WritableStream<Uint8Array>;
|
|
29
|
+
private _closed;
|
|
30
|
+
get closed(): boolean;
|
|
31
|
+
constructor(options: AdbSocketConstructionOptions);
|
|
32
|
+
close(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=socket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8C,cAAc,EAAE,cAAc,EAAqC,MAAM,oBAAoB,CAAC;AACnJ,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,EAAE,OAAO,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IACzC,UAAU,EAAE,mBAAmB,CAAC;IAEhC,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,EAAE,OAAO,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,qBAAa,SAAU,YAAW,aAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuB;IAElD,SAAgB,OAAO,EAAG,MAAM,CAAC;IACjC,SAAgB,QAAQ,EAAG,MAAM,CAAC;IAClC,SAAgB,YAAY,EAAG,OAAO,CAAC;IACvC,SAAgB,aAAa,EAAG,MAAM,CAAC;IAEvC,OAAO,CAAC,QAAQ,CAA8C;IAE9D,OAAO,CAAC,SAAS,CAA6B;IAC9C,OAAO,CAAC,mBAAmB,CAA4C;IACvE,IAAW,QAAQ,+BAA6B;IAEhD,OAAO,CAAC,aAAa,CAAoC;IACzD,SAAgB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAErD,OAAO,CAAC,OAAO,CAAS;IACxB,IAAW,MAAM,YAA2B;gBAEzB,OAAO,EAAE,4BAA4B;IAoD3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA4BtC"}
|
package/esm/socket/socket.js
CHANGED
|
@@ -1,20 +1,75 @@
|
|
|
1
|
+
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
+
import { AdbCommand } from '../packet.js';
|
|
3
|
+
import { ChunkStream, DuplexStreamFactory, pipeFrom } from '../stream/index.js';
|
|
1
4
|
export class AdbSocket {
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
dispatcher;
|
|
6
|
+
localId;
|
|
7
|
+
remoteId;
|
|
8
|
+
localCreated;
|
|
9
|
+
serviceString;
|
|
10
|
+
_factory;
|
|
11
|
+
_readable;
|
|
12
|
+
_readableController;
|
|
13
|
+
get readable() { return this._readable; }
|
|
14
|
+
_writePromise;
|
|
15
|
+
writable;
|
|
16
|
+
_closed = false;
|
|
17
|
+
get closed() { return this._closed; }
|
|
18
|
+
constructor(options) {
|
|
19
|
+
Object.assign(this, options);
|
|
20
|
+
// Check this image to help you understand the stream graph
|
|
21
|
+
// cspell: disable-next-line
|
|
22
|
+
// https://www.plantuml.com/plantuml/png/TL0zoeGm4ErpYc3l5JxyS0yWM6mX5j4C6p4cxcJ25ejttuGX88ZftizxUKmJI275pGhXl0PP_UkfK_CAz5Z2hcWsW9Ny2fdU4C1f5aSchFVxA8vJjlTPRhqZzDQMRB7AklwJ0xXtX0ZSKH1h24ghoKAdGY23FhxC4nS2pDvxzIvxb-8THU0XlEQJ-ZB7SnXTAvc_LhOckhMdLBnbtndpb-SB7a8q2SRD_W00
|
|
23
|
+
this._factory = new DuplexStreamFactory({
|
|
24
|
+
close: async () => {
|
|
25
|
+
await this.close();
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
this._readable = this._factory.createPushReadable(controller => {
|
|
29
|
+
this._readableController = controller;
|
|
30
|
+
}, {
|
|
31
|
+
highWaterMark: options.highWaterMark ?? 16 * 1024,
|
|
32
|
+
size(chunk) { return chunk.byteLength; }
|
|
33
|
+
});
|
|
34
|
+
this.writable = pipeFrom(this._factory.createWritable({
|
|
35
|
+
write: async (chunk) => {
|
|
36
|
+
// Wait for an ack packet
|
|
37
|
+
this._writePromise = new PromiseResolver();
|
|
38
|
+
await this.dispatcher.sendPacket(AdbCommand.Write, this.localId, this.remoteId, chunk);
|
|
39
|
+
await this._writePromise.promise;
|
|
40
|
+
},
|
|
41
|
+
}), new ChunkStream(this.dispatcher.maxPayloadSize));
|
|
4
42
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
get closed() { return this.controller.closed; }
|
|
11
|
-
get onData() { return this.controller.dataEvent.event; }
|
|
12
|
-
get onClose() { return this.controller.onClose; }
|
|
13
|
-
write(data) {
|
|
14
|
-
return this.controller.write(data);
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
async enqueue(packet) {
|
|
47
|
+
await this._readableController.enqueue(packet);
|
|
15
48
|
}
|
|
16
|
-
|
|
17
|
-
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
ack() {
|
|
53
|
+
this._writePromise?.resolve();
|
|
54
|
+
}
|
|
55
|
+
async close() {
|
|
56
|
+
// Error out the pending writes
|
|
57
|
+
this._writePromise?.reject(new Error('Socket closed'));
|
|
58
|
+
if (!this._closed) {
|
|
59
|
+
this._closed = true;
|
|
60
|
+
// Only send close packet when `close` is called before `dispose`
|
|
61
|
+
// (the client initiated the close)
|
|
62
|
+
await this.dispatcher.sendPacket(AdbCommand.Close, this.localId, this.remoteId);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
dispose() {
|
|
69
|
+
this._closed = true;
|
|
70
|
+
this._factory.close();
|
|
71
|
+
// Close `writable` side
|
|
72
|
+
this.close();
|
|
18
73
|
}
|
|
19
74
|
}
|
|
20
75
|
//# sourceMappingURL=socket.js.map
|
package/esm/socket/socket.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/socket/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAqE,MAAM,oBAAoB,CAAC;AA0BnJ,MAAM,OAAO,SAAS;IACD,UAAU,CAAuB;IAElC,OAAO,CAAU;IACjB,QAAQ,CAAU;IAClB,YAAY,CAAW;IACvB,aAAa,CAAU;IAE/B,QAAQ,CAA8C;IAEtD,SAAS,CAA6B;IACtC,mBAAmB,CAA4C;IACvE,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAExC,aAAa,CAAoC;IACzC,QAAQ,CAA6B;IAE7C,OAAO,GAAG,KAAK,CAAC;IACxB,IAAW,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5C,YAAmB,OAAqC;QACpD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE7B,2DAA2D;QAC3D,4BAA4B;QAC5B,6QAA6Q;QAE7Q,IAAI,CAAC,QAAQ,GAAG,IAAI,mBAAmB,CAAyB;YAC5D,KAAK,EAAE,KA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