EgDeviceAdbProperties.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package com.usky.eg.adb;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. /**
  4. * 服务端调用官方 platform-tools adb(需在 PATH 或可执行路径配置)。
  5. */
  6. @ConfigurationProperties(prefix = "eg.adb")
  7. public class EgDeviceAdbProperties {
  8. /**
  9. * adb 可执行文件名或绝对路径,默认依赖系统 PATH 中的 adb
  10. */
  11. private String executable = "adb";
  12. /**
  13. * connect / disconnect / tcpip 等命令超时(秒)
  14. */
  15. private long commandTimeoutSeconds = 45L;
  16. /**
  17. * screencap 超时(秒)
  18. */
  19. private long screenshotTimeoutSeconds = 60L;
  20. /**
  21. * tcpip 失败时是否先执行一次 adb connect 再重试 tcpip
  22. */
  23. private boolean tcpipRetryAfterConnect = true;
  24. /**
  25. * 截屏前是否先执行 adb connect(避免仅调 screenshot 时 adb 侧尚无该 serial,报 device not found)
  26. */
  27. private boolean screenshotConnectFirst = true;
  28. public String getExecutable() {
  29. return executable;
  30. }
  31. public void setExecutable(String executable) {
  32. this.executable = executable;
  33. }
  34. public long getCommandTimeoutSeconds() {
  35. return commandTimeoutSeconds;
  36. }
  37. public void setCommandTimeoutSeconds(long commandTimeoutSeconds) {
  38. this.commandTimeoutSeconds = commandTimeoutSeconds;
  39. }
  40. public long getScreenshotTimeoutSeconds() {
  41. return screenshotTimeoutSeconds;
  42. }
  43. public void setScreenshotTimeoutSeconds(long screenshotTimeoutSeconds) {
  44. this.screenshotTimeoutSeconds = screenshotTimeoutSeconds;
  45. }
  46. public boolean isTcpipRetryAfterConnect() {
  47. return tcpipRetryAfterConnect;
  48. }
  49. public void setTcpipRetryAfterConnect(boolean tcpipRetryAfterConnect) {
  50. this.tcpipRetryAfterConnect = tcpipRetryAfterConnect;
  51. }
  52. public boolean isScreenshotConnectFirst() {
  53. return screenshotConnectFirst;
  54. }
  55. public void setScreenshotConnectFirst(boolean screenshotConnectFirst) {
  56. this.screenshotConnectFirst = screenshotConnectFirst;
  57. }
  58. }