# HILforWPF **Repository Path**: mtoooo/hilfor-wpf ## Basic Information - **Project Name**: HILforWPF - **Description**: HIL工具 C# WPF实现 .net8 - **Primary Language**: C# - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-10 - **Last Updated**: 2026-03-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # HILforWPF #### 介绍 HIL工具 C# WPF实现 .net8 #### 软件架构 软件架构说明 #### 故障说明 uiautomator在Android 8.0以上就不再支持 #### adb多指操作 1. 使用getevent录制屏幕操作 ```text adb shell getevent ``` - 原始数据 ```text (venv_64) PS E:\HILforWPF> adb shell getevent add device 1: /dev/input/event7 name: "sm8150-tavil-snd-card USB_3_5 Jack" add device 2: /dev/input/event6 name: "sm8150-tavil-snd-card Button Jack" add device 3: /dev/input/event5 name: "sm8150-tavil-snd-card Headset Jack" add device 4: /dev/input/event1 name: "qti-haptics" add device 5: /dev/input/event4 name: "gpio-keys" add device 6: /dev/input/event2 name: "uinput-goodix" add device 7: /dev/input/event0 name: "qpnp_pon" add device 8: /dev/input/event3 name: "goodix_ts" /dev/input/event3: 0003 0039 000000a7 /dev/input/event3: 0001 014a 00000001 /dev/input/event3: 0003 0035 000003ea /dev/input/event3: 0003 0036 000004c4 /dev/input/event3: 0000 0000 00000000 /dev/input/event3: 0003 0039 ffffffff /dev/input/event3: 0001 014a 00000000 /dev/input/event3: 0000 0000 00000000 ``` - 修正后的send_event.sh ```text #!/bin/sh echoing – drawing function /dev/input/event3 3 57 167 /dev/input/event3 1 330 1 //touch /dev/input/event3 3 53 1002 /dev/input/event3 3 54 1220 /dev/input/event3 0 0 0 //it must have /dev/input/event3 3 57 4294967295 /dev/input/event3 1 330 0 //untouch /dev/input/event3 0 0 0 //it must have ``` 1.1 getevent使用-l将type、code、value对应的常量显示 ```shell adb shell getevent -l ``` ```text add device 1: /dev/input/event4 name: "mouse" add device 2: /dev/input/event3 name: "gpio" add device 3: /dev/input/event2 name: "input" add device 4: /dev/input/event0 name: "Power Button" add device 5: /dev/input/event1 name: "Sleep Button" /dev/input/event2: EV_KEY KEY_LEFTCTRL DOWN /dev/input/event2: EV_SYN SYN_REPORT 00000000 /dev/input/event2: EV_ABS ABS_MT_TRACKING_ID 0000003b /dev/input/event2: EV_KEY BTN_TOUCH DOWN /dev/input/event2: EV_ABS ABS_MT_PRESSURE 00000002 /dev/input/event2: EV_ABS ABS_MT_POSITION_X 00000335 /dev/input/event2: EV_ABS ABS_MT_POSITION_Y 0000016b /dev/input/event2: EV_SYN SYN_REPORT 00000000 /dev/input/event2: EV_ABS ABS_MT_SLOT 00000001 ``` 2. 将录制内容在Android设备上存放成.sh文件 ```text $ adb shell getevent | grep dev/input/event2 > send_event.sh $ adb push send_event.sh /sdcard/send_event.sh ``` 3. 修改.sh文件权限为777 ```text adb shell chmod 777 /sdcard/send_event.sh ``` 4. 使用sendevent回放数据 - 命令格式2:adb shell sendevent [device] [type] [code] [value] - 需要注意的是在get中code显示的是十六进制,而send中需要用十进制 - adb执行.sh脚本 ```text $ adb shell sh /sdcard/send_event.sh ``` #### adb monkey ```text adb shell monkey -p com.huawei.maps.car.app 100 //对应用xx执行100次随机操作 adb shell monkey -p com.huawei.maps.car.app -v 100 //增加输出日志级别0 adb shell monkey -p com.huawei.maps.car.app -v -v 100 //日志级别1 adb shell monkey -p com.huawei.maps.car.app -v -v -v 100 //日志级别2 adb shell monkey -p com.huawei.maps.car.app -v 100 >./info.txt //输入级别0日志到本地info.txt文件中,没有则创建文件,log路径需要放在最后 //伪随机数生成器的send值,比如-s 20代表随机生成20个动作,执行次数100,所以相同随机动作会执行5次 adb shell monkey -p com.huawei.maps.car.app -v -s 20 100 >./info.txt //--throttle事件执行周期单位毫秒 1000毫秒执行100次随机事件 adb shell monkey -p com.huawei.maps.car.app --throttle 1000 100 //--ignore-crashes忽略崩溃 adb shell monkey -p com.huawei.maps.car.app --ignore-crashes 100 //--ignore-timeouts 忽略超时 adb shell monkey -p com.huawei.maps.car.app --ignore-timeouts 100 //--monitor-native-crashes 监视本地崩溃代码 adb shell monkey -p com.huawei.maps.car.app --monitor-native-crashes 100 //--ignore-security-exceptions 忽略安全异常 adb shell monkey -p com.huawei.maps.car.app --ignore-security-exceptions 100 //--kill-process-after-error 发生错误停止运行并保持当前状态 adb shell monkey -p com.huawei.maps.car.app --throttle 200 --kill-process-after-error 100 /*************11个概率事件需要总和小于等于100**************/ //触摸事件概率--pct-touch 20 adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-touch 20 100 //运动事件概率--pct-motion adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-motion 100 100 //轨迹球事件概率--pct-trackball adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-trackball 100 100 //系统按键概率--pct-syskeys adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-syskeys 100 100 //导航事件概率--pct-nav adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-nav 100 100 // 主要导航事件概率--pct-majornav adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-majornav 100 100 // 应用程序切换概率--pct-appswitch adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-appswitch 100 100 //键盘翻转概率--pct-flip adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-flip 100 100 //任意事件概率--pct-anyevent adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-anyevent 100 100 //缩放事件概率--pct-pinchzoom adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-pinchzoom 100 100 //权限事件概率--pct-permission adb shell monkey -p com.huawei.maps.car.app --throttle 200 --pct-permission 100 100 ``` #### 安装教程 1. xxxx 2. xxxx 3. xxxx #### 使用说明 1. xxxx 2. xxxx 3. xxxx #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)