@devicefarmer/adbkit 2.11.3 → 3.2.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/.github/dependabot.yml +46 -0
- package/CONTRIBUTING.md +28 -0
- package/README.md +749 -759
- package/bin/adbkit +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/package.json +84 -0
- package/dist/src/Callback.d.ts +2 -0
- package/dist/src/Callback.d.ts.map +1 -0
- package/dist/src/Callback.js +3 -0
- package/dist/src/Callback.js.map +1 -0
- package/dist/src/ClientOptions.d.ts +6 -0
- package/dist/src/ClientOptions.d.ts.map +1 -0
- package/dist/src/ClientOptions.js +3 -0
- package/dist/src/ClientOptions.js.map +1 -0
- package/dist/src/CpuStats.d.ts +17 -0
- package/dist/src/CpuStats.d.ts.map +1 -0
- package/dist/src/CpuStats.js +3 -0
- package/dist/src/CpuStats.js.map +1 -0
- package/dist/src/Device.d.ts +5 -0
- package/dist/src/Device.d.ts.map +1 -0
- package/dist/src/Device.js +3 -0
- package/dist/src/Device.js.map +1 -0
- package/dist/src/DeviceWithPath.d.ts +9 -0
- package/dist/src/DeviceWithPath.d.ts.map +1 -0
- package/dist/src/DeviceWithPath.js +3 -0
- package/dist/src/DeviceWithPath.js.map +1 -0
- package/dist/src/ExtendedPublicKey.d.ts +7 -0
- package/dist/src/ExtendedPublicKey.d.ts.map +1 -0
- package/dist/src/ExtendedPublicKey.js +3 -0
- package/dist/src/ExtendedPublicKey.js.map +1 -0
- package/dist/src/Features.d.ts +2 -0
- package/dist/src/Features.d.ts.map +1 -0
- package/dist/src/Features.js +3 -0
- package/dist/src/Features.js.map +1 -0
- package/dist/src/Forward.d.ts +6 -0
- package/dist/src/Forward.d.ts.map +1 -0
- package/dist/src/Forward.js +3 -0
- package/dist/src/Forward.js.map +1 -0
- package/dist/src/FramebufferMeta.d.ts +60 -0
- package/dist/src/FramebufferMeta.d.ts.map +1 -0
- package/dist/src/FramebufferMeta.js +3 -0
- package/dist/src/FramebufferMeta.js.map +1 -0
- package/dist/src/FramebufferStreamWithMeta.d.ts +10 -0
- package/dist/src/FramebufferStreamWithMeta.d.ts.map +1 -0
- package/dist/src/FramebufferStreamWithMeta.js +3 -0
- package/dist/src/FramebufferStreamWithMeta.js.map +1 -0
- package/dist/src/Properties.d.ts +2 -0
- package/dist/src/Properties.d.ts.map +1 -0
- package/dist/src/Properties.js +3 -0
- package/dist/src/Properties.js.map +1 -0
- package/dist/src/Reverse.d.ts +5 -0
- package/dist/src/Reverse.d.ts.map +1 -0
- package/dist/src/Reverse.js +3 -0
- package/dist/src/Reverse.js.map +1 -0
- package/dist/src/SocketOptions.d.ts +6 -0
- package/dist/src/SocketOptions.d.ts.map +1 -0
- package/dist/src/SocketOptions.js +3 -0
- package/dist/src/SocketOptions.js.map +1 -0
- package/dist/src/StartActivityOptions.d.ts +12 -0
- package/dist/src/StartActivityOptions.d.ts.map +1 -0
- package/dist/src/StartActivityOptions.js +3 -0
- package/dist/src/StartActivityOptions.js.map +1 -0
- package/dist/src/StartServiceOptions.d.ts +57 -0
- package/dist/src/StartServiceOptions.d.ts.map +1 -0
- package/dist/src/StartServiceOptions.js +3 -0
- package/dist/src/StartServiceOptions.js.map +1 -0
- package/dist/src/TrackerChangeSet.d.ts +7 -0
- package/dist/src/TrackerChangeSet.d.ts.map +1 -0
- package/dist/src/TrackerChangeSet.js +3 -0
- package/dist/src/TrackerChangeSet.js.map +1 -0
- package/dist/src/WithToString.d.ts +4 -0
- package/dist/src/WithToString.d.ts.map +1 -0
- package/dist/src/WithToString.js +3 -0
- package/dist/src/WithToString.js.map +1 -0
- package/dist/src/adb/DeviceClient.d.ts +376 -0
- package/dist/src/adb/DeviceClient.d.ts.map +1 -0
- package/dist/src/adb/DeviceClient.js +517 -0
- package/dist/src/adb/DeviceClient.js.map +1 -0
- package/dist/src/adb/auth.d.ts +8 -0
- package/dist/src/adb/auth.d.ts.map +1 -0
- package/dist/src/adb/auth.js +87 -0
- package/dist/src/adb/auth.js.map +1 -0
- package/dist/src/adb/client.d.ts +29 -0
- package/dist/src/adb/client.d.ts.map +1 -0
- package/dist/src/adb/client.js +73 -0
- package/dist/src/adb/client.js.map +1 -0
- package/dist/src/adb/command/host/connect.d.ts +6 -0
- package/dist/src/adb/command/host/connect.d.ts.map +1 -0
- package/dist/src/adb/command/host/connect.js +36 -0
- package/dist/src/adb/command/host/connect.js.map +1 -0
- package/dist/src/adb/command/host/devices.d.ts +10 -0
- package/dist/src/adb/command/host/devices.d.ts.map +1 -0
- package/dist/src/adb/command/host/devices.js +40 -0
- package/dist/src/adb/command/host/devices.js.map +1 -0
- package/dist/src/adb/command/host/deviceswithpaths.d.ts +9 -0
- package/dist/src/adb/command/host/deviceswithpaths.d.ts.map +1 -0
- package/dist/src/adb/command/host/deviceswithpaths.js +46 -0
- package/dist/src/adb/command/host/deviceswithpaths.js.map +1 -0
- package/dist/src/adb/command/host/disconnect.d.ts +6 -0
- package/dist/src/adb/command/host/disconnect.d.ts.map +1 -0
- package/dist/src/adb/command/host/disconnect.js +35 -0
- package/dist/src/adb/command/host/disconnect.js.map +1 -0
- package/dist/src/adb/command/host/index.d.ts +9 -0
- package/dist/src/adb/command/host/index.d.ts.map +1 -0
- package/dist/src/adb/command/host/index.js +23 -0
- package/dist/src/adb/command/host/index.js.map +1 -0
- package/dist/src/adb/command/host/kill.d.ts +6 -0
- package/dist/src/adb/command/host/kill.d.ts.map +1 -0
- package/dist/src/adb/command/host/kill.js +24 -0
- package/dist/src/adb/command/host/kill.js.map +1 -0
- package/dist/src/adb/command/host/trackdevices.d.ts +6 -0
- package/dist/src/adb/command/host/trackdevices.d.ts.map +1 -0
- package/dist/src/adb/command/host/trackdevices.js +27 -0
- package/dist/src/adb/command/host/trackdevices.js.map +1 -0
- package/dist/src/adb/command/host/transport.d.ts +6 -0
- package/dist/src/adb/command/host/transport.d.ts.map +1 -0
- package/dist/src/adb/command/host/transport.js +24 -0
- package/dist/src/adb/command/host/transport.js.map +1 -0
- package/dist/src/adb/command/host/version.d.ts +7 -0
- package/dist/src/adb/command/host/version.d.ts.map +1 -0
- package/dist/src/adb/command/host/version.js +29 -0
- package/dist/src/adb/command/host/version.js.map +1 -0
- package/dist/src/adb/command/host-serial/forward.d.ts +6 -0
- package/dist/src/adb/command/host-serial/forward.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/forward.js +33 -0
- package/dist/src/adb/command/host-serial/forward.js.map +1 -0
- package/dist/src/adb/command/host-serial/getdevicepath.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getdevicepath.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getdevicepath.js +26 -0
- package/dist/src/adb/command/host-serial/getdevicepath.js.map +1 -0
- package/dist/src/adb/command/host-serial/getserialno.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getserialno.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getserialno.js +24 -0
- package/dist/src/adb/command/host-serial/getserialno.js.map +1 -0
- package/dist/src/adb/command/host-serial/getstate.d.ts +6 -0
- package/dist/src/adb/command/host-serial/getstate.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/getstate.js +24 -0
- package/dist/src/adb/command/host-serial/getstate.js.map +1 -0
- package/dist/src/adb/command/host-serial/index.d.ts +7 -0
- package/dist/src/adb/command/host-serial/index.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/index.js +19 -0
- package/dist/src/adb/command/host-serial/index.js.map +1 -0
- package/dist/src/adb/command/host-serial/listforwards.d.ts +8 -0
- package/dist/src/adb/command/host-serial/listforwards.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/listforwards.js +34 -0
- package/dist/src/adb/command/host-serial/listforwards.js.map +1 -0
- package/dist/src/adb/command/host-serial/waitfordevice.d.ts +6 -0
- package/dist/src/adb/command/host-serial/waitfordevice.d.ts.map +1 -0
- package/dist/src/adb/command/host-serial/waitfordevice.js +33 -0
- package/dist/src/adb/command/host-serial/waitfordevice.js.map +1 -0
- package/dist/src/adb/command/host-transport/clear.d.ts +6 -0
- package/dist/src/adb/command/host-transport/clear.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/clear.js +39 -0
- package/dist/src/adb/command/host-transport/clear.js.map +1 -0
- package/dist/src/adb/command/host-transport/framebuffer.d.ts +12 -0
- package/dist/src/adb/command/host-transport/framebuffer.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/framebuffer.js +113 -0
- package/dist/src/adb/command/host-transport/framebuffer.js.map +1 -0
- package/dist/src/adb/command/host-transport/getfeatures.d.ts +8 -0
- package/dist/src/adb/command/host-transport/getfeatures.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getfeatures.js +35 -0
- package/dist/src/adb/command/host-transport/getfeatures.js.map +1 -0
- package/dist/src/adb/command/host-transport/getpackages.d.ts +7 -0
- package/dist/src/adb/command/host-transport/getpackages.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getpackages.js +45 -0
- package/dist/src/adb/command/host-transport/getpackages.js.map +1 -0
- package/dist/src/adb/command/host-transport/getproperties.d.ts +8 -0
- package/dist/src/adb/command/host-transport/getproperties.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/getproperties.js +37 -0
- package/dist/src/adb/command/host-transport/getproperties.js.map +1 -0
- package/dist/src/adb/command/host-transport/index.d.ts +28 -0
- package/dist/src/adb/command/host-transport/index.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/index.js +61 -0
- package/dist/src/adb/command/host-transport/index.js.map +1 -0
- package/dist/src/adb/command/host-transport/install.d.ts +6 -0
- package/dist/src/adb/command/host-transport/install.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/install.js +42 -0
- package/dist/src/adb/command/host-transport/install.js.map +1 -0
- package/dist/src/adb/command/host-transport/isinstalled.d.ts +6 -0
- package/dist/src/adb/command/host-transport/isinstalled.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/isinstalled.js +37 -0
- package/dist/src/adb/command/host-transport/isinstalled.js.map +1 -0
- package/dist/src/adb/command/host-transport/listreverses.d.ts +8 -0
- package/dist/src/adb/command/host-transport/listreverses.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/listreverses.js +38 -0
- package/dist/src/adb/command/host-transport/listreverses.js.map +1 -0
- package/dist/src/adb/command/host-transport/local.d.ts +8 -0
- package/dist/src/adb/command/host-transport/local.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/local.js +24 -0
- package/dist/src/adb/command/host-transport/local.js.map +1 -0
- package/dist/src/adb/command/host-transport/log.d.ts +8 -0
- package/dist/src/adb/command/host-transport/log.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/log.js +24 -0
- package/dist/src/adb/command/host-transport/log.js.map +1 -0
- package/dist/src/adb/command/host-transport/logcat.d.ts +9 -0
- package/dist/src/adb/command/host-transport/logcat.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/logcat.js +37 -0
- package/dist/src/adb/command/host-transport/logcat.js.map +1 -0
- package/dist/src/adb/command/host-transport/monkey.d.ts +8 -0
- package/dist/src/adb/command/host-transport/monkey.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/monkey.js +50 -0
- package/dist/src/adb/command/host-transport/monkey.js.map +1 -0
- package/dist/src/adb/command/host-transport/reboot.d.ts +6 -0
- package/dist/src/adb/command/host-transport/reboot.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/reboot.js +24 -0
- package/dist/src/adb/command/host-transport/reboot.js.map +1 -0
- package/dist/src/adb/command/host-transport/remount.d.ts +6 -0
- package/dist/src/adb/command/host-transport/remount.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/remount.js +24 -0
- package/dist/src/adb/command/host-transport/remount.js.map +1 -0
- package/dist/src/adb/command/host-transport/reverse.d.ts +6 -0
- package/dist/src/adb/command/host-transport/reverse.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/reverse.js +33 -0
- package/dist/src/adb/command/host-transport/reverse.js.map +1 -0
- package/dist/src/adb/command/host-transport/root.d.ts +6 -0
- package/dist/src/adb/command/host-transport/root.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/root.js +32 -0
- package/dist/src/adb/command/host-transport/root.js.map +1 -0
- package/dist/src/adb/command/host-transport/screencap.d.ts +8 -0
- package/dist/src/adb/command/host-transport/screencap.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/screencap.js +36 -0
- package/dist/src/adb/command/host-transport/screencap.js.map +1 -0
- package/dist/src/adb/command/host-transport/shell.d.ts +9 -0
- package/dist/src/adb/command/host-transport/shell.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/shell.js +27 -0
- package/dist/src/adb/command/host-transport/shell.js.map +1 -0
- package/dist/src/adb/command/host-transport/startactivity.d.ts +13 -0
- package/dist/src/adb/command/host-transport/startactivity.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/startactivity.js +166 -0
- package/dist/src/adb/command/host-transport/startactivity.js.map +1 -0
- package/dist/src/adb/command/host-transport/startservice.d.ts +7 -0
- package/dist/src/adb/command/host-transport/startservice.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/startservice.js +17 -0
- package/dist/src/adb/command/host-transport/startservice.js.map +1 -0
- package/dist/src/adb/command/host-transport/sync.d.ts +7 -0
- package/dist/src/adb/command/host-transport/sync.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/sync.js +25 -0
- package/dist/src/adb/command/host-transport/sync.js.map +1 -0
- package/dist/src/adb/command/host-transport/tcp.d.ts +8 -0
- package/dist/src/adb/command/host-transport/tcp.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/tcp.js +24 -0
- package/dist/src/adb/command/host-transport/tcp.js.map +1 -0
- package/dist/src/adb/command/host-transport/tcpip.d.ts +6 -0
- package/dist/src/adb/command/host-transport/tcpip.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/tcpip.js +32 -0
- package/dist/src/adb/command/host-transport/tcpip.js.map +1 -0
- package/dist/src/adb/command/host-transport/trackjdwp.d.ts +7 -0
- package/dist/src/adb/command/host-transport/trackjdwp.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/trackjdwp.js +25 -0
- package/dist/src/adb/command/host-transport/trackjdwp.js.map +1 -0
- package/dist/src/adb/command/host-transport/uninstall.d.ts +6 -0
- package/dist/src/adb/command/host-transport/uninstall.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/uninstall.js +40 -0
- package/dist/src/adb/command/host-transport/uninstall.js.map +1 -0
- package/dist/src/adb/command/host-transport/usb.d.ts +6 -0
- package/dist/src/adb/command/host-transport/usb.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/usb.js +32 -0
- package/dist/src/adb/command/host-transport/usb.js.map +1 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.d.ts +6 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.d.ts.map +1 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.js +27 -0
- package/dist/src/adb/command/host-transport/waitbootcomplete.js.map +1 -0
- package/dist/src/adb/command.d.ts +17 -0
- package/dist/src/adb/command.d.ts.map +1 -0
- package/dist/src/adb/command.js +43 -0
- package/dist/src/adb/command.js.map +1 -0
- package/dist/src/adb/connection.d.ts +24 -0
- package/dist/src/adb/connection.d.ts.map +1 -0
- package/dist/src/adb/connection.js +115 -0
- package/dist/src/adb/connection.js.map +1 -0
- package/dist/src/adb/dump.d.ts +4 -0
- package/dist/src/adb/dump.d.ts.map +1 -0
- package/dist/src/adb/dump.js +38 -0
- package/dist/src/adb/dump.js.map +1 -0
- package/dist/src/adb/framebuffer/rgbtransform.d.ts +16 -0
- package/dist/src/adb/framebuffer/rgbtransform.d.ts.map +1 -0
- package/dist/src/adb/framebuffer/rgbtransform.js +47 -0
- package/dist/src/adb/framebuffer/rgbtransform.js.map +1 -0
- package/dist/src/adb/jdwptracker.d.ts +41 -0
- package/dist/src/adb/jdwptracker.d.ts.map +1 -0
- package/dist/src/adb/jdwptracker.js +85 -0
- package/dist/src/adb/jdwptracker.js.map +1 -0
- package/dist/src/adb/keycode.d.ts +292 -0
- package/dist/src/adb/keycode.d.ts.map +1 -0
- package/dist/src/adb/keycode.js +298 -0
- package/dist/src/adb/keycode.js.map +1 -0
- package/dist/src/adb/linetransform.d.ts +17 -0
- package/dist/src/adb/linetransform.d.ts.map +1 -0
- package/dist/src/adb/linetransform.js +93 -0
- package/dist/src/adb/linetransform.js.map +1 -0
- package/dist/src/adb/parser.d.ts +37 -0
- package/dist/src/adb/parser.d.ts.map +1 -0
- package/dist/src/adb/parser.js +269 -0
- package/dist/src/adb/parser.js.map +1 -0
- package/dist/src/adb/proc/stat.d.ts +30 -0
- package/dist/src/adb/proc/stat.d.ts.map +1 -0
- package/dist/src/adb/proc/stat.js +131 -0
- package/dist/src/adb/proc/stat.js.map +1 -0
- package/dist/src/adb/protocol.d.ts +17 -0
- package/dist/src/adb/protocol.d.ts.map +1 -0
- package/dist/src/adb/protocol.js +29 -0
- package/dist/src/adb/protocol.js.map +1 -0
- package/dist/src/adb/sync/entry.d.ts +8 -0
- package/dist/src/adb/sync/entry.d.ts.map +1 -0
- package/dist/src/adb/sync/entry.js +16 -0
- package/dist/src/adb/sync/entry.js.map +1 -0
- package/dist/src/adb/sync/pulltransfer.d.ts +10 -0
- package/dist/src/adb/sync/pulltransfer.d.ts.map +1 -0
- package/dist/src/adb/sync/pulltransfer.js +24 -0
- package/dist/src/adb/sync/pulltransfer.js.map +1 -0
- package/dist/src/adb/sync/pushtransfer.d.ts +13 -0
- package/dist/src/adb/sync/pushtransfer.d.ts.map +1 -0
- package/dist/src/adb/sync/pushtransfer.js +30 -0
- package/dist/src/adb/sync/pushtransfer.js.map +1 -0
- package/dist/src/adb/sync/stats.d.ts +23 -0
- package/dist/src/adb/sync/stats.d.ts.map +1 -0
- package/dist/src/adb/sync/stats.js +54 -0
- package/dist/src/adb/sync/stats.js.map +1 -0
- package/dist/src/adb/sync.d.ts +31 -0
- package/dist/src/adb/sync.d.ts.map +1 -0
- package/dist/src/adb/sync.js +322 -0
- package/dist/src/adb/sync.js.map +1 -0
- package/dist/src/adb/tcpusb/packet.d.ts +27 -0
- package/dist/src/adb/tcpusb/packet.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/packet.js +94 -0
- package/dist/src/adb/tcpusb/packet.js.map +1 -0
- package/dist/src/adb/tcpusb/packetreader.d.ts +26 -0
- package/dist/src/adb/tcpusb/packetreader.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/packetreader.js +100 -0
- package/dist/src/adb/tcpusb/packetreader.js.map +1 -0
- package/dist/src/adb/tcpusb/rollingcounter.d.ts +8 -0
- package/dist/src/adb/tcpusb/rollingcounter.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/rollingcounter.js +17 -0
- package/dist/src/adb/tcpusb/rollingcounter.js.map +1 -0
- package/dist/src/adb/tcpusb/server.d.ts +19 -0
- package/dist/src/adb/tcpusb/server.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/server.js +78 -0
- package/dist/src/adb/tcpusb/server.js.map +1 -0
- package/dist/src/adb/tcpusb/service.d.ts +37 -0
- package/dist/src/adb/tcpusb/service.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/service.js +173 -0
- package/dist/src/adb/tcpusb/service.js.map +1 -0
- package/dist/src/adb/tcpusb/servicemap.d.ts +10 -0
- package/dist/src/adb/tcpusb/servicemap.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/servicemap.js +42 -0
- package/dist/src/adb/tcpusb/servicemap.js.map +1 -0
- package/dist/src/adb/tcpusb/socket.d.ts +45 -0
- package/dist/src/adb/tcpusb/socket.d.ts.map +1 -0
- package/dist/src/adb/tcpusb/socket.js +284 -0
- package/dist/src/adb/tcpusb/socket.js.map +1 -0
- package/dist/src/adb/tracker.d.ts +17 -0
- package/dist/src/adb/tracker.d.ts.map +1 -0
- package/dist/src/adb/tracker.js +72 -0
- package/dist/src/adb/tracker.js.map +1 -0
- package/dist/src/adb/util.d.ts +10 -0
- package/dist/src/adb/util.d.ts.map +1 -0
- package/dist/src/adb/util.js +17 -0
- package/dist/src/adb/util.js.map +1 -0
- package/dist/src/adb.d.ts +13 -0
- package/dist/src/adb.d.ts.map +1 -0
- package/dist/src/adb.js +28 -0
- package/dist/src/adb.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +86 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/package.json +53 -33
- package/.semaphore/publish.yml +0 -19
- package/.semaphore/semaphore.yml +0 -27
- package/index.js +0 -4
- package/lib/adb/auth.js +0 -78
- package/lib/adb/client.js +0 -576
- package/lib/adb/command/host/connect.js +0 -46
- package/lib/adb/command/host/devices.js +0 -64
- package/lib/adb/command/host/deviceswithpaths.js +0 -70
- package/lib/adb/command/host/disconnect.js +0 -46
- package/lib/adb/command/host/kill.js +0 -36
- package/lib/adb/command/host/trackdevices.js +0 -40
- package/lib/adb/command/host/transport.js +0 -36
- package/lib/adb/command/host/version.js +0 -42
- package/lib/adb/command/host-serial/forward.js +0 -45
- package/lib/adb/command/host-serial/getdevicepath.js +0 -38
- package/lib/adb/command/host-serial/getserialno.js +0 -38
- package/lib/adb/command/host-serial/getstate.js +0 -38
- package/lib/adb/command/host-serial/listforwards.js +0 -56
- package/lib/adb/command/host-serial/waitfordevice.js +0 -45
- package/lib/adb/command/host-transport/clear.js +0 -45
- package/lib/adb/command/host-transport/framebuffer.js +0 -114
- package/lib/adb/command/host-transport/getfeatures.js +0 -51
- package/lib/adb/command/host-transport/getpackages.js +0 -51
- package/lib/adb/command/host-transport/getproperties.js +0 -51
- package/lib/adb/command/host-transport/install.js +0 -48
- package/lib/adb/command/host-transport/isinstalled.js +0 -47
- package/lib/adb/command/host-transport/listreverses.js +0 -55
- package/lib/adb/command/host-transport/local.js +0 -36
- package/lib/adb/command/host-transport/log.js +0 -36
- package/lib/adb/command/host-transport/logcat.js +0 -48
- package/lib/adb/command/host-transport/monkey.js +0 -42
- package/lib/adb/command/host-transport/reboot.js +0 -36
- package/lib/adb/command/host-transport/remount.js +0 -36
- package/lib/adb/command/host-transport/reverse.js +0 -45
- package/lib/adb/command/host-transport/root.js +0 -46
- package/lib/adb/command/host-transport/screencap.js +0 -52
- package/lib/adb/command/host-transport/shell.js +0 -39
- package/lib/adb/command/host-transport/startactivity.js +0 -184
- package/lib/adb/command/host-transport/startservice.js +0 -33
- package/lib/adb/command/host-transport/sync.js +0 -38
- package/lib/adb/command/host-transport/tcp.js +0 -36
- package/lib/adb/command/host-transport/tcpip.js +0 -46
- package/lib/adb/command/host-transport/trackjdwp.js +0 -120
- package/lib/adb/command/host-transport/uninstall.js +0 -44
- package/lib/adb/command/host-transport/usb.js +0 -46
- package/lib/adb/command/host-transport/waitbootcomplete.js +0 -42
- package/lib/adb/command.js +0 -56
- package/lib/adb/connection.js +0 -117
- package/lib/adb/dump.js +0 -15
- package/lib/adb/framebuffer/rgbtransform.js +0 -55
- package/lib/adb/keycode.js +0 -225
- package/lib/adb/linetransform.js +0 -87
- package/lib/adb/parser.js +0 -291
- package/lib/adb/proc/stat.js +0 -137
- package/lib/adb/protocol.js +0 -45
- package/lib/adb/sync/entry.js +0 -23
- package/lib/adb/sync/pulltransfer.js +0 -31
- package/lib/adb/sync/pushtransfer.js +0 -40
- package/lib/adb/sync/stats.js +0 -54
- package/lib/adb/sync.js +0 -343
- package/lib/adb/tcpusb/packet.js +0 -112
- package/lib/adb/tcpusb/packetreader.js +0 -121
- package/lib/adb/tcpusb/rollingcounter.js +0 -21
- package/lib/adb/tcpusb/server.js +0 -79
- package/lib/adb/tcpusb/service.js +0 -203
- package/lib/adb/tcpusb/servicemap.js +0 -48
- package/lib/adb/tcpusb/socket.js +0 -312
- package/lib/adb/tracker.js +0 -89
- package/lib/adb/util.js +0 -13
- package/lib/adb.js +0 -29
- package/lib/cli.js +0 -66
package/lib/adb/sync.js
DELETED
|
@@ -1,343 +0,0 @@
|
|
|
1
|
-
var Entry, EventEmitter, Fs, Parser, Path, Promise, Protocol, PullTransfer, PushTransfer, Stats, Sync, debug,
|
|
2
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
3
|
-
hasProp = {}.hasOwnProperty;
|
|
4
|
-
|
|
5
|
-
Fs = require('fs');
|
|
6
|
-
|
|
7
|
-
Path = require('path');
|
|
8
|
-
|
|
9
|
-
Promise = require('bluebird');
|
|
10
|
-
|
|
11
|
-
EventEmitter = require('events').EventEmitter;
|
|
12
|
-
|
|
13
|
-
debug = require('debug')('adb:sync');
|
|
14
|
-
|
|
15
|
-
Parser = require('./parser');
|
|
16
|
-
|
|
17
|
-
Protocol = require('./protocol');
|
|
18
|
-
|
|
19
|
-
Stats = require('./sync/stats');
|
|
20
|
-
|
|
21
|
-
Entry = require('./sync/entry');
|
|
22
|
-
|
|
23
|
-
PushTransfer = require('./sync/pushtransfer');
|
|
24
|
-
|
|
25
|
-
PullTransfer = require('./sync/pulltransfer');
|
|
26
|
-
|
|
27
|
-
Sync = (function(superClass) {
|
|
28
|
-
var DATA_MAX_LENGTH, DEFAULT_CHMOD, TEMP_PATH;
|
|
29
|
-
|
|
30
|
-
extend(Sync, superClass);
|
|
31
|
-
|
|
32
|
-
TEMP_PATH = '/data/local/tmp';
|
|
33
|
-
|
|
34
|
-
DEFAULT_CHMOD = 0x1a4;
|
|
35
|
-
|
|
36
|
-
DATA_MAX_LENGTH = 65536;
|
|
37
|
-
|
|
38
|
-
Sync.temp = function(path) {
|
|
39
|
-
return TEMP_PATH + "/" + (Path.basename(path));
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
function Sync(connection) {
|
|
43
|
-
this.connection = connection;
|
|
44
|
-
this.parser = this.connection.parser;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Sync.prototype.stat = function(path, callback) {
|
|
48
|
-
this._sendCommandWithArg(Protocol.STAT, path);
|
|
49
|
-
return this.parser.readAscii(4).then((function(_this) {
|
|
50
|
-
return function(reply) {
|
|
51
|
-
switch (reply) {
|
|
52
|
-
case Protocol.STAT:
|
|
53
|
-
return _this.parser.readBytes(12).then(function(stat) {
|
|
54
|
-
var mode, mtime, size;
|
|
55
|
-
mode = stat.readUInt32LE(0);
|
|
56
|
-
size = stat.readUInt32LE(4);
|
|
57
|
-
mtime = stat.readUInt32LE(8);
|
|
58
|
-
if (mode === 0) {
|
|
59
|
-
return _this._enoent(path);
|
|
60
|
-
} else {
|
|
61
|
-
return new Stats(mode, size, mtime);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
case Protocol.FAIL:
|
|
65
|
-
return _this._readError();
|
|
66
|
-
default:
|
|
67
|
-
return _this.parser.unexpected(reply, 'STAT or FAIL');
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
})(this)).nodeify(callback);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
Sync.prototype.readdir = function(path, callback) {
|
|
74
|
-
var files, readNext;
|
|
75
|
-
files = [];
|
|
76
|
-
readNext = (function(_this) {
|
|
77
|
-
return function() {
|
|
78
|
-
return _this.parser.readAscii(4).then(function(reply) {
|
|
79
|
-
switch (reply) {
|
|
80
|
-
case Protocol.DENT:
|
|
81
|
-
return _this.parser.readBytes(16).then(function(stat) {
|
|
82
|
-
var mode, mtime, namelen, size;
|
|
83
|
-
mode = stat.readUInt32LE(0);
|
|
84
|
-
size = stat.readUInt32LE(4);
|
|
85
|
-
mtime = stat.readUInt32LE(8);
|
|
86
|
-
namelen = stat.readUInt32LE(12);
|
|
87
|
-
return _this.parser.readBytes(namelen).then(function(name) {
|
|
88
|
-
name = name.toString();
|
|
89
|
-
if (!(name === '.' || name === '..')) {
|
|
90
|
-
files.push(new Entry(name, mode, size, mtime));
|
|
91
|
-
}
|
|
92
|
-
return readNext();
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
case Protocol.DONE:
|
|
96
|
-
return _this.parser.readBytes(16).then(function(zero) {
|
|
97
|
-
return files;
|
|
98
|
-
});
|
|
99
|
-
case Protocol.FAIL:
|
|
100
|
-
return _this._readError();
|
|
101
|
-
default:
|
|
102
|
-
return _this.parser.unexpected(reply, 'DENT, DONE or FAIL');
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
})(this);
|
|
107
|
-
this._sendCommandWithArg(Protocol.LIST, path);
|
|
108
|
-
return readNext().nodeify(callback);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
Sync.prototype.push = function(contents, path, mode) {
|
|
112
|
-
if (typeof contents === 'string') {
|
|
113
|
-
return this.pushFile(contents, path, mode);
|
|
114
|
-
} else {
|
|
115
|
-
return this.pushStream(contents, path, mode);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
Sync.prototype.pushFile = function(file, path, mode) {
|
|
120
|
-
if (mode == null) {
|
|
121
|
-
mode = DEFAULT_CHMOD;
|
|
122
|
-
}
|
|
123
|
-
mode || (mode = DEFAULT_CHMOD);
|
|
124
|
-
return this.pushStream(Fs.createReadStream(file), path, mode);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
Sync.prototype.pushStream = function(stream, path, mode) {
|
|
128
|
-
if (mode == null) {
|
|
129
|
-
mode = DEFAULT_CHMOD;
|
|
130
|
-
}
|
|
131
|
-
mode |= Stats.S_IFREG;
|
|
132
|
-
this._sendCommandWithArg(Protocol.SEND, path + "," + mode);
|
|
133
|
-
return this._writeData(stream, Math.floor(Date.now() / 1000));
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
Sync.prototype.pull = function(path) {
|
|
137
|
-
this._sendCommandWithArg(Protocol.RECV, "" + path);
|
|
138
|
-
return this._readData();
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
Sync.prototype.end = function() {
|
|
142
|
-
this.connection.end();
|
|
143
|
-
return this;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
Sync.prototype.tempFile = function(path) {
|
|
147
|
-
return Sync.temp(path);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
Sync.prototype._writeData = function(stream, timeStamp) {
|
|
151
|
-
var readReply, reader, transfer, writeData, writer;
|
|
152
|
-
transfer = new PushTransfer;
|
|
153
|
-
writeData = (function(_this) {
|
|
154
|
-
return function() {
|
|
155
|
-
var connErrorListener, endListener, errorListener, readableListener, resolver, track, waitForDrain, writeNext, writer;
|
|
156
|
-
resolver = Promise.defer();
|
|
157
|
-
writer = Promise.resolve().cancellable();
|
|
158
|
-
stream.on('end', endListener = function() {
|
|
159
|
-
return writer.then(function() {
|
|
160
|
-
_this._sendCommandWithLength(Protocol.DONE, timeStamp);
|
|
161
|
-
return resolver.resolve();
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
waitForDrain = function() {
|
|
165
|
-
var drainListener;
|
|
166
|
-
resolver = Promise.defer();
|
|
167
|
-
_this.connection.on('drain', drainListener = function() {
|
|
168
|
-
return resolver.resolve();
|
|
169
|
-
});
|
|
170
|
-
return resolver.promise["finally"](function() {
|
|
171
|
-
return _this.connection.removeListener('drain', drainListener);
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
track = function() {
|
|
175
|
-
return transfer.pop();
|
|
176
|
-
};
|
|
177
|
-
writeNext = function() {
|
|
178
|
-
var chunk;
|
|
179
|
-
if (chunk = stream.read(DATA_MAX_LENGTH) || stream.read()) {
|
|
180
|
-
_this._sendCommandWithLength(Protocol.DATA, chunk.length);
|
|
181
|
-
transfer.push(chunk.length);
|
|
182
|
-
if (_this.connection.write(chunk, track)) {
|
|
183
|
-
return writeNext();
|
|
184
|
-
} else {
|
|
185
|
-
return waitForDrain().then(writeNext);
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
return Promise.resolve();
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
stream.on('readable', readableListener = function() {
|
|
192
|
-
return writer.then(writeNext);
|
|
193
|
-
});
|
|
194
|
-
stream.on('error', errorListener = function(err) {
|
|
195
|
-
return resolver.reject(err);
|
|
196
|
-
});
|
|
197
|
-
_this.connection.on('error', connErrorListener = function(err) {
|
|
198
|
-
stream.destroy(err);
|
|
199
|
-
_this.connection.end();
|
|
200
|
-
return resolver.reject(err);
|
|
201
|
-
});
|
|
202
|
-
return resolver.promise["finally"](function() {
|
|
203
|
-
stream.removeListener('end', endListener);
|
|
204
|
-
stream.removeListener('readable', readableListener);
|
|
205
|
-
stream.removeListener('error', errorListener);
|
|
206
|
-
_this.connection.removeListener('error', connErrorListener);
|
|
207
|
-
return writer.cancel();
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
})(this);
|
|
211
|
-
readReply = (function(_this) {
|
|
212
|
-
return function() {
|
|
213
|
-
return _this.parser.readAscii(4).then(function(reply) {
|
|
214
|
-
switch (reply) {
|
|
215
|
-
case Protocol.OKAY:
|
|
216
|
-
return _this.parser.readBytes(4).then(function(zero) {
|
|
217
|
-
return true;
|
|
218
|
-
});
|
|
219
|
-
case Protocol.FAIL:
|
|
220
|
-
return _this._readError();
|
|
221
|
-
default:
|
|
222
|
-
return _this.parser.unexpected(reply, 'OKAY or FAIL');
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
})(this);
|
|
227
|
-
writer = writeData().cancellable()["catch"](Promise.CancellationError, (function(_this) {
|
|
228
|
-
return function(err) {
|
|
229
|
-
return _this.connection.end();
|
|
230
|
-
};
|
|
231
|
-
})(this))["catch"](function(err) {
|
|
232
|
-
transfer.emit('error', err);
|
|
233
|
-
return reader.cancel();
|
|
234
|
-
});
|
|
235
|
-
reader = readReply().cancellable()["catch"](Promise.CancellationError, function(err) {
|
|
236
|
-
return true;
|
|
237
|
-
})["catch"](function(err) {
|
|
238
|
-
transfer.emit('error', err);
|
|
239
|
-
return writer.cancel();
|
|
240
|
-
})["finally"](function() {
|
|
241
|
-
return transfer.end();
|
|
242
|
-
});
|
|
243
|
-
transfer.on('cancel', function() {
|
|
244
|
-
writer.cancel();
|
|
245
|
-
return reader.cancel();
|
|
246
|
-
});
|
|
247
|
-
return transfer;
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
Sync.prototype._readData = function() {
|
|
251
|
-
var cancelListener, readNext, reader, transfer;
|
|
252
|
-
transfer = new PullTransfer;
|
|
253
|
-
readNext = (function(_this) {
|
|
254
|
-
return function() {
|
|
255
|
-
return _this.parser.readAscii(4).cancellable().then(function(reply) {
|
|
256
|
-
switch (reply) {
|
|
257
|
-
case Protocol.DATA:
|
|
258
|
-
return _this.parser.readBytes(4).then(function(lengthData) {
|
|
259
|
-
var length;
|
|
260
|
-
length = lengthData.readUInt32LE(0);
|
|
261
|
-
return _this.parser.readByteFlow(length, transfer).then(readNext);
|
|
262
|
-
});
|
|
263
|
-
case Protocol.DONE:
|
|
264
|
-
return _this.parser.readBytes(4).then(function(zero) {
|
|
265
|
-
return true;
|
|
266
|
-
});
|
|
267
|
-
case Protocol.FAIL:
|
|
268
|
-
return _this._readError();
|
|
269
|
-
default:
|
|
270
|
-
return _this.parser.unexpected(reply, 'DATA, DONE or FAIL');
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
};
|
|
274
|
-
})(this);
|
|
275
|
-
reader = readNext()["catch"](Promise.CancellationError, (function(_this) {
|
|
276
|
-
return function(err) {
|
|
277
|
-
return _this.connection.end();
|
|
278
|
-
};
|
|
279
|
-
})(this))["catch"](function(err) {
|
|
280
|
-
return transfer.emit('error', err);
|
|
281
|
-
})["finally"](function() {
|
|
282
|
-
transfer.removeListener('cancel', cancelListener);
|
|
283
|
-
return transfer.end();
|
|
284
|
-
});
|
|
285
|
-
transfer.on('cancel', cancelListener = function() {
|
|
286
|
-
return reader.cancel();
|
|
287
|
-
});
|
|
288
|
-
return transfer;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
Sync.prototype._readError = function() {
|
|
292
|
-
return this.parser.readBytes(4).then((function(_this) {
|
|
293
|
-
return function(length) {
|
|
294
|
-
return _this.parser.readBytes(length.readUInt32LE(0)).then(function(buf) {
|
|
295
|
-
return Promise.reject(new Parser.FailError(buf.toString()));
|
|
296
|
-
});
|
|
297
|
-
};
|
|
298
|
-
})(this))["finally"]((function(_this) {
|
|
299
|
-
return function() {
|
|
300
|
-
return _this.parser.end();
|
|
301
|
-
};
|
|
302
|
-
})(this));
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
Sync.prototype._sendCommandWithLength = function(cmd, length) {
|
|
306
|
-
var payload;
|
|
307
|
-
if (cmd !== Protocol.DATA) {
|
|
308
|
-
debug(cmd);
|
|
309
|
-
}
|
|
310
|
-
payload = new Buffer(cmd.length + 4);
|
|
311
|
-
payload.write(cmd, 0, cmd.length);
|
|
312
|
-
payload.writeUInt32LE(length, cmd.length);
|
|
313
|
-
return this.connection.write(payload);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
Sync.prototype._sendCommandWithArg = function(cmd, arg) {
|
|
317
|
-
var arglen, payload, pos;
|
|
318
|
-
debug(cmd + " " + arg);
|
|
319
|
-
arglen = Buffer.byteLength(arg, 'utf-8');
|
|
320
|
-
payload = new Buffer(cmd.length + 4 + arglen);
|
|
321
|
-
pos = 0;
|
|
322
|
-
payload.write(cmd, pos, cmd.length);
|
|
323
|
-
pos += cmd.length;
|
|
324
|
-
payload.writeUInt32LE(arglen, pos);
|
|
325
|
-
pos += 4;
|
|
326
|
-
payload.write(arg, pos);
|
|
327
|
-
return this.connection.write(payload);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
Sync.prototype._enoent = function(path) {
|
|
331
|
-
var err;
|
|
332
|
-
err = new Error("ENOENT, no such file or directory '" + path + "'");
|
|
333
|
-
err.errno = 34;
|
|
334
|
-
err.code = 'ENOENT';
|
|
335
|
-
err.path = path;
|
|
336
|
-
return Promise.reject(err);
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
return Sync;
|
|
340
|
-
|
|
341
|
-
})(EventEmitter);
|
|
342
|
-
|
|
343
|
-
module.exports = Sync;
|
package/lib/adb/tcpusb/packet.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
var Packet;
|
|
2
|
-
|
|
3
|
-
Packet = (function() {
|
|
4
|
-
Packet.A_SYNC = 0x434e5953;
|
|
5
|
-
|
|
6
|
-
Packet.A_CNXN = 0x4e584e43;
|
|
7
|
-
|
|
8
|
-
Packet.A_OPEN = 0x4e45504f;
|
|
9
|
-
|
|
10
|
-
Packet.A_OKAY = 0x59414b4f;
|
|
11
|
-
|
|
12
|
-
Packet.A_CLSE = 0x45534c43;
|
|
13
|
-
|
|
14
|
-
Packet.A_WRTE = 0x45545257;
|
|
15
|
-
|
|
16
|
-
Packet.A_AUTH = 0x48545541;
|
|
17
|
-
|
|
18
|
-
Packet.checksum = function(data) {
|
|
19
|
-
var char, i, len, sum;
|
|
20
|
-
sum = 0;
|
|
21
|
-
if (data) {
|
|
22
|
-
for (i = 0, len = data.length; i < len; i++) {
|
|
23
|
-
char = data[i];
|
|
24
|
-
sum += char;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return sum;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
Packet.magic = function(command) {
|
|
31
|
-
return (command ^ 0xffffffff) >>> 0;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
Packet.assemble = function(command, arg0, arg1, data) {
|
|
35
|
-
var chunk;
|
|
36
|
-
if (data) {
|
|
37
|
-
chunk = new Buffer(24 + data.length);
|
|
38
|
-
chunk.writeUInt32LE(command, 0);
|
|
39
|
-
chunk.writeUInt32LE(arg0, 4);
|
|
40
|
-
chunk.writeUInt32LE(arg1, 8);
|
|
41
|
-
chunk.writeUInt32LE(data.length, 12);
|
|
42
|
-
chunk.writeUInt32LE(Packet.checksum(data), 16);
|
|
43
|
-
chunk.writeUInt32LE(Packet.magic(command), 20);
|
|
44
|
-
data.copy(chunk, 24);
|
|
45
|
-
return chunk;
|
|
46
|
-
} else {
|
|
47
|
-
chunk = new Buffer(24);
|
|
48
|
-
chunk.writeUInt32LE(command, 0);
|
|
49
|
-
chunk.writeUInt32LE(arg0, 4);
|
|
50
|
-
chunk.writeUInt32LE(arg1, 8);
|
|
51
|
-
chunk.writeUInt32LE(0, 12);
|
|
52
|
-
chunk.writeUInt32LE(0, 16);
|
|
53
|
-
chunk.writeUInt32LE(Packet.magic(command), 20);
|
|
54
|
-
return chunk;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
Packet.swap32 = function(n) {
|
|
59
|
-
var buffer;
|
|
60
|
-
buffer = new Buffer(4);
|
|
61
|
-
buffer.writeUInt32LE(n, 0);
|
|
62
|
-
return buffer.readUInt32BE(0);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
function Packet(command1, arg01, arg11, length, check, magic, data1) {
|
|
66
|
-
this.command = command1;
|
|
67
|
-
this.arg0 = arg01;
|
|
68
|
-
this.arg1 = arg11;
|
|
69
|
-
this.length = length;
|
|
70
|
-
this.check = check;
|
|
71
|
-
this.magic = magic;
|
|
72
|
-
this.data = data1;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Packet.prototype.verifyChecksum = function() {
|
|
76
|
-
return this.check === Packet.checksum(this.data);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Packet.prototype.verifyMagic = function() {
|
|
80
|
-
return this.magic === Packet.magic(this.command);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
Packet.prototype.toString = function() {
|
|
84
|
-
var type;
|
|
85
|
-
type = (function() {
|
|
86
|
-
switch (this.command) {
|
|
87
|
-
case Packet.A_SYNC:
|
|
88
|
-
return "SYNC";
|
|
89
|
-
case Packet.A_CNXN:
|
|
90
|
-
return "CNXN";
|
|
91
|
-
case Packet.A_OPEN:
|
|
92
|
-
return "OPEN";
|
|
93
|
-
case Packet.A_OKAY:
|
|
94
|
-
return "OKAY";
|
|
95
|
-
case Packet.A_CLSE:
|
|
96
|
-
return "CLSE";
|
|
97
|
-
case Packet.A_WRTE:
|
|
98
|
-
return "WRTE";
|
|
99
|
-
case Packet.A_AUTH:
|
|
100
|
-
return "AUTH";
|
|
101
|
-
default:
|
|
102
|
-
throw new Error("Unknown command {@command}");
|
|
103
|
-
}
|
|
104
|
-
}).call(this);
|
|
105
|
-
return type + " arg0=" + this.arg0 + " arg1=" + this.arg1 + " length=" + this.length;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return Packet;
|
|
109
|
-
|
|
110
|
-
})();
|
|
111
|
-
|
|
112
|
-
module.exports = Packet;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var EventEmitter, Packet, PacketReader,
|
|
2
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
3
|
-
hasProp = {}.hasOwnProperty;
|
|
4
|
-
|
|
5
|
-
EventEmitter = require('events').EventEmitter;
|
|
6
|
-
|
|
7
|
-
Packet = require('./packet');
|
|
8
|
-
|
|
9
|
-
PacketReader = (function(superClass) {
|
|
10
|
-
extend(PacketReader, superClass);
|
|
11
|
-
|
|
12
|
-
function PacketReader(stream) {
|
|
13
|
-
this.stream = stream;
|
|
14
|
-
PacketReader.__super__.constructor.call(this);
|
|
15
|
-
this.inBody = false;
|
|
16
|
-
this.buffer = null;
|
|
17
|
-
this.packet = null;
|
|
18
|
-
this.stream.on('readable', this._tryRead.bind(this));
|
|
19
|
-
this.stream.on('error', (function(_this) {
|
|
20
|
-
return function(err) {
|
|
21
|
-
return _this.emit('error', err);
|
|
22
|
-
};
|
|
23
|
-
})(this));
|
|
24
|
-
this.stream.on('end', (function(_this) {
|
|
25
|
-
return function() {
|
|
26
|
-
return _this.emit('end');
|
|
27
|
-
};
|
|
28
|
-
})(this));
|
|
29
|
-
setImmediate(this._tryRead.bind(this));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
PacketReader.prototype._tryRead = function() {
|
|
33
|
-
var header;
|
|
34
|
-
while (this._appendChunk()) {
|
|
35
|
-
while (this.buffer) {
|
|
36
|
-
if (this.inBody) {
|
|
37
|
-
if (!(this.buffer.length >= this.packet.length)) {
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
this.packet.data = this._consume(this.packet.length);
|
|
41
|
-
if (!this.packet.verifyChecksum()) {
|
|
42
|
-
this.emit('error', new PacketReader.ChecksumError(this.packet));
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
this.emit('packet', this.packet);
|
|
46
|
-
this.inBody = false;
|
|
47
|
-
} else {
|
|
48
|
-
if (!(this.buffer.length >= 24)) {
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
header = this._consume(24);
|
|
52
|
-
this.packet = new Packet(header.readUInt32LE(0), header.readUInt32LE(4), header.readUInt32LE(8), header.readUInt32LE(12), header.readUInt32LE(16), header.readUInt32LE(20), new Buffer(0));
|
|
53
|
-
if (!this.packet.verifyMagic()) {
|
|
54
|
-
this.emit('error', new PacketReader.MagicError(this.packet));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (this.packet.length === 0) {
|
|
58
|
-
this.emit('packet', this.packet);
|
|
59
|
-
} else {
|
|
60
|
-
this.inBody = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
PacketReader.prototype._appendChunk = function() {
|
|
68
|
-
var chunk;
|
|
69
|
-
if (chunk = this.stream.read()) {
|
|
70
|
-
if (this.buffer) {
|
|
71
|
-
return this.buffer = Buffer.concat([this.buffer, chunk], this.buffer.length + chunk.length);
|
|
72
|
-
} else {
|
|
73
|
-
return this.buffer = chunk;
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
PacketReader.prototype._consume = function(length) {
|
|
81
|
-
var chunk;
|
|
82
|
-
chunk = this.buffer.slice(0, length);
|
|
83
|
-
this.buffer = length === this.buffer.length ? null : this.buffer.slice(length);
|
|
84
|
-
return chunk;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return PacketReader;
|
|
88
|
-
|
|
89
|
-
})(EventEmitter);
|
|
90
|
-
|
|
91
|
-
PacketReader.ChecksumError = (function(superClass) {
|
|
92
|
-
extend(ChecksumError, superClass);
|
|
93
|
-
|
|
94
|
-
function ChecksumError(packet) {
|
|
95
|
-
this.packet = packet;
|
|
96
|
-
Error.call(this);
|
|
97
|
-
this.name = 'ChecksumError';
|
|
98
|
-
this.message = "Checksum mismatch";
|
|
99
|
-
Error.captureStackTrace(this, PacketReader.ChecksumError);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return ChecksumError;
|
|
103
|
-
|
|
104
|
-
})(Error);
|
|
105
|
-
|
|
106
|
-
PacketReader.MagicError = (function(superClass) {
|
|
107
|
-
extend(MagicError, superClass);
|
|
108
|
-
|
|
109
|
-
function MagicError(packet) {
|
|
110
|
-
this.packet = packet;
|
|
111
|
-
Error.call(this);
|
|
112
|
-
this.name = 'MagicError';
|
|
113
|
-
this.message = "Magic value mismatch";
|
|
114
|
-
Error.captureStackTrace(this, PacketReader.MagicError);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return MagicError;
|
|
118
|
-
|
|
119
|
-
})(Error);
|
|
120
|
-
|
|
121
|
-
module.exports = PacketReader;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var RollingCounter;
|
|
2
|
-
|
|
3
|
-
RollingCounter = (function() {
|
|
4
|
-
function RollingCounter(max, min) {
|
|
5
|
-
this.max = max;
|
|
6
|
-
this.min = min != null ? min : 1;
|
|
7
|
-
this.now = this.min;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
RollingCounter.prototype.next = function() {
|
|
11
|
-
if (!(this.now < this.max)) {
|
|
12
|
-
this.now = this.min;
|
|
13
|
-
}
|
|
14
|
-
return ++this.now;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return RollingCounter;
|
|
18
|
-
|
|
19
|
-
})();
|
|
20
|
-
|
|
21
|
-
module.exports = RollingCounter;
|
package/lib/adb/tcpusb/server.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
var EventEmitter, Net, Server, Socket,
|
|
2
|
-
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
|
3
|
-
hasProp = {}.hasOwnProperty;
|
|
4
|
-
|
|
5
|
-
Net = require('net');
|
|
6
|
-
|
|
7
|
-
EventEmitter = require('events').EventEmitter;
|
|
8
|
-
|
|
9
|
-
Socket = require('./socket');
|
|
10
|
-
|
|
11
|
-
Server = (function(superClass) {
|
|
12
|
-
extend(Server, superClass);
|
|
13
|
-
|
|
14
|
-
function Server(client, serial, options) {
|
|
15
|
-
this.client = client;
|
|
16
|
-
this.serial = serial;
|
|
17
|
-
this.options = options;
|
|
18
|
-
this.connections = [];
|
|
19
|
-
this.server = Net.createServer({
|
|
20
|
-
allowHalfOpen: true
|
|
21
|
-
});
|
|
22
|
-
this.server.on('error', (function(_this) {
|
|
23
|
-
return function(err) {
|
|
24
|
-
return _this.emit('error', err);
|
|
25
|
-
};
|
|
26
|
-
})(this));
|
|
27
|
-
this.server.on('listening', (function(_this) {
|
|
28
|
-
return function() {
|
|
29
|
-
return _this.emit('listening');
|
|
30
|
-
};
|
|
31
|
-
})(this));
|
|
32
|
-
this.server.on('close', (function(_this) {
|
|
33
|
-
return function() {
|
|
34
|
-
return _this.emit('close');
|
|
35
|
-
};
|
|
36
|
-
})(this));
|
|
37
|
-
this.server.on('connection', (function(_this) {
|
|
38
|
-
return function(conn) {
|
|
39
|
-
var socket;
|
|
40
|
-
socket = new Socket(_this.client, _this.serial, conn, _this.options);
|
|
41
|
-
_this.connections.push(socket);
|
|
42
|
-
socket.on('error', function(err) {
|
|
43
|
-
return _this.emit('error', err);
|
|
44
|
-
});
|
|
45
|
-
socket.once('end', function() {
|
|
46
|
-
return _this.connections = _this.connections.filter(function(val) {
|
|
47
|
-
return val !== socket;
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
return _this.emit('connection', socket);
|
|
51
|
-
};
|
|
52
|
-
})(this));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Server.prototype.listen = function() {
|
|
56
|
-
this.server.listen.apply(this.server, arguments);
|
|
57
|
-
return this;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
Server.prototype.close = function() {
|
|
61
|
-
this.server.close();
|
|
62
|
-
return this;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
Server.prototype.end = function() {
|
|
66
|
-
var conn, i, len, ref;
|
|
67
|
-
ref = this.connections;
|
|
68
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
|
69
|
-
conn = ref[i];
|
|
70
|
-
conn.end();
|
|
71
|
-
}
|
|
72
|
-
return this;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return Server;
|
|
76
|
-
|
|
77
|
-
})(EventEmitter);
|
|
78
|
-
|
|
79
|
-
module.exports = Server;
|