1e41f4b71Sopenharmony_ci# swtmr 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## 命令功能 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciswtmr命令用于查询系统软件定时器相关信息。 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## 命令格式 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciswtmr [_ID_] 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci## 参数说明 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci**表1** 参数说明 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci| 参数 | 参数说明 | 取值范围 | 19e41f4b71Sopenharmony_ci| -------- | -------- | -------- | 20e41f4b71Sopenharmony_ci| ID | 软件定时器ID号。 | [0, 0xFFFFFFFF] | 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci## 使用指南 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci- 参数缺省时,默认显示所有软件定时器的相关信息。 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci- swtmr后加ID号时,显示ID对应的软件定时器相关信息。 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci## 使用实例 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci举例: 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci- swtmr 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci- swtmr 1 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci## 输出说明 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci**示例1** 查询所有软件定时器相关信息 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci``` 44e41f4b71Sopenharmony_ciOHOS # swtmr 45e41f4b71Sopenharmony_ciSwTmrID State Mode Interval Count Arg handlerAddr 46e41f4b71Sopenharmony_ci---------- ------- ------- --------- ------- ---------- -------- 47e41f4b71Sopenharmony_ci0x00000000 Ticking Period 100 77 0x40802a50 0x4037b8a0 48e41f4b71Sopenharmony_ciSwTmrID State Mode Interval Count Arg handlerAddr 49e41f4b71Sopenharmony_ci---------- ------- ------- --------- ------- ---------- -------- 50e41f4b71Sopenharmony_ci0x00000001 Ticking Period 1000 876 0x00000000 0x4037fc04 51e41f4b71Sopenharmony_ciSwTmrID State Mode Interval Count Arg handlerAddr 52e41f4b71Sopenharmony_ci---------- ------- ------- --------- ------- ---------- -------- 53e41f4b71Sopenharmony_ci0x00000002 Ticking Period 100 76 0x00000000 0x403727f4 54e41f4b71Sopenharmony_ciSwTmrID State Mode Interval Count Arg handlerAddr 55e41f4b71Sopenharmony_ci---------- ------- ------- --------- ------- ---------- -------- 56e41f4b71Sopenharmony_ci0x00000016 Ticking NSD 10 6 0x8021e000 0x401fe7d8 57e41f4b71Sopenharmony_ciSwTmrID State Mode Interval Count Arg handlerAddr 58e41f4b71Sopenharmony_ci---------- ------- ------- --------- ------- ---------- -------- 59e41f4b71Sopenharmony_ci0x00000079 Ticking NSD 30000 1749 0x406189d8 0x40160e1c 60e41f4b71Sopenharmony_ci``` 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ci**示例2** 查询对应 ID 的软件定时器信息 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ci``` 65e41f4b71Sopenharmony_ciOHOS # swtmr 1 66e41f4b71Sopenharmony_ciSwTmrID State Mode Interval Count Arg handlerAddr 67e41f4b71Sopenharmony_ci---------- ------- ------- --------- ------- ---------- -------- 68e41f4b71Sopenharmony_ci0x00000001 Ticking Period 1000 841 0x00000000 0x4037fc04 69e41f4b71Sopenharmony_ci``` 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci **表2** 输出说明 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci| 输出 | 说明 | 74e41f4b71Sopenharmony_ci| -------- | -------- | 75e41f4b71Sopenharmony_ci| SwTmrID | 软件定时器ID。 | 76e41f4b71Sopenharmony_ci| State | 软件定时器状态。<br/>状态可能为:"UnUsed", "Created", "Ticking"。 | 77e41f4b71Sopenharmony_ci| Mode | 软件定时器模式。<br/>模式可能为:"Once", "Period", "NSD(单次定时器,定时结束后不会自动删除)"。 | 78e41f4b71Sopenharmony_ci| Interval | 软件定时器使用的Tick数。 | 79e41f4b71Sopenharmony_ci| Count | 软件定时器已经工作的次数。 | 80e41f4b71Sopenharmony_ci| Arg | 传入的参数。 | 81e41f4b71Sopenharmony_ci| handlerAddr | 回调函数的地址。 | 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci>  **说明:** 84e41f4b71Sopenharmony_ci> - swtmr命令的ID参数输入形式以十进制形式表示或十六进制形式表示皆可。 85e41f4b71Sopenharmony_ci> 86e41f4b71Sopenharmony_ci> - swtmr命令的ID参数在[0, 当前软件定时器个数 - 1]范围内时,返回对应ID的软件定时器的状态;其他取值时返回错误提示。 87