控制Kenwood TMV71收音机的工具

tm-v71-tools的Python项目详细描述


用于管理TM-V71无线电的CLI和PythonAPI

要求

您将需要Python3.7(或更高版本)和setuptools包的最新版本(可能还有pip)。在

安装

您可以使用pip从PyPI安装:

pip install tm-v71-tools

也可以直接从GitHub存储库安装:

^{pr2}$

配置

配置文件

Tmv71将读取配置~/.config/tmv71.json(如果存在)。此文件可以指定以下配置密钥:

  • port=<device>
  • speed=<bps>
  • no_clear=(true|false)
  • clear_retries=<n>
  • ^{cd9}

例如:

{
  "port": "/dev/ttyKEYSPAN",
  "speed": 57600,
  "verbose": 1
}

环境变量

可以从名为TMV71_<option>的环境变量设置任何命令行选项。例如,可以设置TMV71_PORT和{}环境变量,而不是在命令行上传递--port和{}。在

对于子命令,需要将子命令名称作为变量名的一部分。例如,要将--channels 1:10选项传递给tmv71 channel export,可以设置:

TMV71_CHANNEL_EXPORT_CHANNELS=1:10

可用命令

常见选项

Usage: tmv71 [OPTIONS] COMMAND [ARGS]...

Options:
  -f, --config-file TEXT          Path to a JSON configuration file  [default:
                                  /home/lars/.config/tmv71.json]
  --no-config                     Do not attempt to read any configuration
                                  file
  -p, --port TEXT                 Path to a serial device
  -s, --speed [9600|19200|38400|57600]
                                  Set the port speed
  -K, --no-clear                  Skip initial clear operation before running
                                  command
  -R, --clear-retries INTEGER     Number of times to retry clear operation
                                  before failing
  -v, --verbose                   Increase verbosity. May be specified
                                  multiple times.
  --help                          Show this message and exit.

Commands:
  band             Commands for controlling the dual bands
  channel          Commands for interacting with memory channels
  info             Commands for getting information about the radio
  lock             Lock or unlock the key lock
  memory           Commands for reading and modifying memory
  op-mode          Control the radio operating mode.
  port-speed       Get or set the PC port speed.
  poweron-message  Get or set the power on message.
  ptt              Activate or deactivate transmitter.
  raw              Send a raw command to the radio and display the response.
  remote-id        Get or set the remote id.
  send-dtmf        Send DTMF tones
  set              Get or set various configuration options.
  version          Print the software version
  vfo              Commands for interacting with the VFO

开机信息

Usage: tmv71 poweron-message [OPTIONS] [MESSAGE]

  Get or set the power on message.

Options:
  --help  Show this message and exit.

速度

Usage: tmv71 port-speed [OPTIONS] [[9600|19200|38400|57600]]

  Get or set the PC port speed.

  Note that because this command involves reading from/writing to memory
  directly, it will briefly reset the radio.

  Valid port speeds are 9600, 19200, 38400, and 57600.

Options:
  --help  Show this message and exit.

ptt

Usage: tmv71 ptt [OPTIONS]

  Activate or deactivate transmitter.

Options:
  --on
  --off
  --help  Show this message and exit.

设置

Usage: tmv71 set [OPTIONS]

  Get or set various configuration options.

Options:
  --beep / --no-beep
  --beep-volume INTEGER
  --external-speaker-mode INTEGER
  --announce [OFF|AUTO|MANUAL]
  --language [English|Japanese]
  --voice-volume INTEGER
  --voice-speed INTEGER
  --playback-repeat / --no-playback-repeat
  --playback-repeat-interval INTEGER
  --continous-recording / --no-continous-recording
  --vhf-aip / --no-vhf-aip
  --uhf-aip / --no-uhf-aip
  --s-meter-sql-hang-time [OFF|125|250|500]
  --mute-hang-time [OFF|125|250|500|750|1000]
  --beatshift / --no-beatshift
  --timeout-timer INTEGER
  --recall-method [ALL|CURRENT]
  --echolink-speed [FAST|SLOW]
  --dtmf-hold / --no-dtmf-hold
  --dtmf-speed [FAST|SLOW]
  --dtmf-pause [100|250|500|750|1000|1500|2000]
  --dtmf-key-lock / --no-dtmf-key-lock
  --auto-repeater-offset / --no-auto-repeater-offset
  --hold-1750hz / --no-hold-1750hz
  --brightness-level INTEGER
  --auto-brightness / --no-auto-brightness
  --backlight-color [AMBER|GREEN]
  --pf1-key [WX|FREQBAND|CTRL|MONITOR|VGS|VOICE|GROUP_UP|MENU|MUTE|SHIFT|DUAL|MEM_TO_VFO|VFO|MR|CALL|MHZ|TONE|REV|LOW|LOCK|A_B|ENTER|1750HZ]
  --pf2-key [WX|FREQBAND|CTRL|MONITOR|VGS|VOICE|GROUP_UP|MENU|MUTE|SHIFT|DUAL|MEM_TO_VFO|VFO|MR|CALL|MHZ|TONE|REV|LOW|LOCK|A_B|ENTER|1750HZ]
  --mic-pf1-key [WX|FREQBAND|CTRL|MONITOR|VGS|VOICE|GROUP_UP|MENU|MUTE|SHIFT|DUAL|MEM_TO_VFO|VFO|MR|CALL|MHZ|TONE|REV|LOW|LOCK|A_B|ENTER|1750HZ]
  --mic-pf2-key [WX|FREQBAND|CTRL|MONITOR|VGS|VOICE|GROUP_UP|MENU|MUTE|SHIFT|DUAL|MEM_TO_VFO|VFO|MR|CALL|MHZ|TONE|REV|LOW|LOCK|A_B|ENTER|1750HZ]
  --mic-pf3-key [WX|FREQBAND|CTRL|MONITOR|VGS|VOICE|GROUP_UP|MENU|MUTE|SHIFT|DUAL|MEM_TO_VFO|VFO|MR|CALL|MHZ|TONE|REV|LOW|LOCK|A_B|ENTER|1750HZ]
  --mic-pf4-key [WX|FREQBAND|CTRL|MONITOR|VGS|VOICE|GROUP_UP|MENU|MUTE|SHIFT|DUAL|MEM_TO_VFO|VFO|MR|CALL|MHZ|TONE|REV|LOW|LOCK|A_B|ENTER|1750HZ]
  --mic-key-lock / --no-mic-key-lock
  --scan-resume [TIME|CARRIER|SEEK]
  --apo [OFF|30|60|90|120|180]
  --ext-data-band [A|B|TXA_RXB|TXB_RXA]
  --ext-data-speed [1200|9600]
  --sqc-source [OFF|BUSY|SQL|TX|BUSY_TX|SQL_TX]
  --auto-pm-store / --no-auto-pm-store
  --display-partition-bar / --no-display-partition-bar
  --reset                         Some options (e.g. brightness-level) require
                                  a reset before they will take effect
  -F, --format [shell|table|json]
  -T, --table-format [fancy_grid|github|grid|html|jira|latex|latex_booktabs|latex_raw|mediawiki|moinmoin|orgtbl|pipe|plain|presto|psql|rst|simple|textile|tsv|youtrack]
  -K, --key TEXT                  Limit output to the specified key (may be
                                  specified multiple times)
  --help                          Show this message and exit.

发送dtmf

Usage: tmv71 send-dtmf [OPTIONS] [TONES]...

  Send DTMF tones

Options:
  -w, --wait
  --slow / --fast
  --help           Show this message and exit.

波段模式

Usage: tmv71 band mode [OPTIONS] [A|B|0|1]

  Set selected band to VFO, MEM, call channel, or weather.

Options:
  --vfo
  --mem, --memory
  --call
  --wx, --weather
  --help           Show this message and exit.

波段选择

Usage: tmv71 band select [OPTIONS] [BAND]

  Select control and ptt band, and select single or dual-band mode

  Use band A as control band and band B as ptt band:

      tmv71 band select A --control     tmv71 band select B --ptt

  Use band B for both control and ptt:

      tmv71 band select B

  Use band B in single band mode:

      tmv71 band select B -1

  Place radio back into dual-band mode:

      tmv71 band select -2

Options:
  -1, --single
  -2, --dual
  -c, --control
  -p, --ptt
  -F, --format [shell|table|json]
  -T, --table-format [fancy_grid|github|grid|html|jira|latex|latex_booktabs|latex_raw|mediawiki|moinmoin|orgtbl|pipe|plain|presto|psql|rst|simple|textile|tsv|youtrack]
  -K, --key TEXT                  Limit output to the specified key (may be
                                  specified multiple times)
  --help                          Show this message and exit.

波段反向

Usage: tmv71 band reverse [OPTIONS] [A|B|0|1]

  Activate reverse on the specified band

Options:
  --on / --off
  --help        Show this message and exit.

频带静噪

Usage: tmv71 band squelch [OPTIONS] [A|B|0|1]

  Get current squelch setting for the specified band.

Options:
  --help  Show this message and exit.

频带静噪状态

Usage: tmv71 band squelch-state [OPTIONS] [A|B|0|1]

  Report whether squelch is open on the specified band

Options:
  --help  Show this message and exit.

波段txpower

Usage: tmv71 band txpower [OPTIONS] [A|B|0|1]

  Set tx power for the selected band.

Options:
  --low
  --medium, --med
  --high
  --help           Show this message and exit.

通道入口

Usage: tmv71 channel entry [OPTIONS] CHANNEL

  View or edit memory channels.

Options:
  --channel INTEGER
  --rx-freq FLOAT
  --rx-step [5|6.25|28.33|10|12.5|15|20|25|30|50|100]
  --shift [SIMPLEX|UP|DOWN|SPLIT]
  --reverse / --no-reverse
  --tone-status / --no-tone-status
  --ctcss-status / --no-ctcss-status
  --dcs-status / --no-dcs-status
  --tone-freq [67.0|69.3|71.9|74.4|77.0|79.7|82.5|85.4|88.5|91.5|94.8|97.4|100.0|103.5|107.2|110.9|114.8|118.8|123.0|127.3|131.8|136.5|141.3|146.2|151.4|156.7|162.2|167.9|173.8|179.9|186.2|192.8|203.5|240.7|210.7|218.1|225.7|229.1|233.6|241.8|250.3|254.1]
  --ctcss-freq [67.0|69.3|71.9|74.4|77.0|79.7|82.5|85.4|88.5|91.5|94.8|97.4|100.0|103.5|107.2|110.9|114.8|118.8|123.0|127.3|131.8|136.5|141.3|146.2|151.4|156.7|162.2|167.9|173.8|179.9|186.2|192.8|203.5|240.7|210.7|218.1|225.7|229.1|233.6|241.8|250.3|254.1]
  --dcs-code [23|25|26|31|32|36|43|47|51|53|54|65|71|72|73|74|114|115|116|122|125|131|132|134|143|145|152|155|156|162|165|172|174|205|212|223|225|226|243|244|245|246|251|252|255|261|263|265|266|271|274|306|311|315|325|331|332|343|346|351|356|364|365|371|411|412|413|423|431|432|445|446|452|454|455|462|464|465|466|503|506|516|523|565|532|546|565|606|612|624|627|631|632|654|662|664|703|712|723|731|732|734|743|754]
  --offset FLOAT
  --mode [FM|NFM|AM]
  --tx-freq FLOAT
  --tx-step [5|6.25|28.33|10|12.5|15|20|25|30|50|100]
  --lockout / --no-lockout
  -n, --name TEXT
  -F, --format [shell|table|json]
  -T, --table-format [fancy_grid|github|grid|html|jira|latex|latex_booktabs|latex_raw|mediawiki|moinmoin|orgtbl|pipe|plain|presto|psql|rst|simple|textile|tsv|youtrack]
  -K, --key TEXT                  Limit output to the specified key (may be
                                  specified multiple times)
  --help                          Show this message and exit.

频道导出

Usage: tmv71 channel export [OPTIONS]

  Export channels to a CSV document

Options:
  -o, --output FILENAME
  -c, --channels TEXT    Specify a single chanel (-c 1) or a range of channels
                         (-c 1:10)
  -s, --skip-deleted     Do not export deleted channels
  --help                 Show this message and exit.

频道导入

Usage: tmv71 channel import [OPTIONS]

  Import channels from a CSV document

Options:
  -i, --input FILENAME
  -s, --sync            Delete channels from the radio that do not exist in
                        input
  -c, --channels TEXT   Specify a single chanel (-c 1) or a range of channels
                        (-c 1:10)
  -I, --ignore-errors   Continue to import channels if there is an error
  --help                Show this message and exit.

频道调谐

Usage: tmv71 channel tune [OPTIONS] [A|B|0|1] [CHANNEL]

  Get or set the memory channel for the selected band.

Options:
  --help  Show this message and exit.

信息固件

^{pr21}$

信息id

Usage: tmv71 info id [OPTIONS]

  Return the radio model.

Options:
  --help  Show this message and exit.

信息序列

Usage: tmv71 info serial [OPTIONS]

  Return information about the radio firmware.

Options:
  -F, --format [shell|table|json]
  -T, --table-format [fancy_grid|github|grid|html|jira|latex|latex_booktabs|latex_raw|mediawiki|moinmoin|orgtbl|pipe|plain|presto|psql|rst|simple|textile|tsv|youtrack]
  -K, --key TEXT                  Limit output to the specified key (may be
                                  specified multiple times)
  --help                          Show this message and exit.

信息类型

Usage: tmv71 info type [OPTIONS]

  Return the radio type.

Options:
  -F, --format [shell|table|json]
  -T, --table-format [fancy_grid|github|grid|html|jira|latex|latex_booktabs|latex_raw|mediawiki|moinmoin|orgtbl|pipe|plain|presto|psql|rst|simple|textile|tsv|youtrack]
  -K, --key TEXT                  Limit output to the specified key (may be
                                  specified multiple times)
  --help                          Show this message and exit.

内存转储

Usage: tmv71 memory dump [OPTIONS]

  Read entire radio memory and write it to a file.

Options:
  -o, --output FILENAME
  --help                 Show this message and exit.

内存恢复

Usage: tmv71 memory restore [OPTIONS]

  Read memory dump from a file and write it to the radio.

Options:
  -i, --input FILENAME
  --help                Show this message and exit.

内存读取块

Usage: tmv71 memory read-block [OPTIONS] ADDRESS

  Read one or more memory blocks from the radio.

  This command will by default output the binary data to stdout. Use the
  '-o' option to write to a file instead. Use the '--hexdump' option to
  output the data as a formatted hexdump instead.

  You can read a range of addresses by specifying the start and end
  (inclusive) of the range separated by a colon.  E.g., to read addresses
  0x1700 through 0x557f, you could use `tmv71 memory read-block
  0x1700:0x557f`.

  Examples:

  1. Read 16 bytes from address 0x1700, version 1:

     tmv71 memory read-block 0x1700 -l 16 -h

  2. Read 16 bytes from address 0x1700, version 2:

     tmv71 memory read-block 0x1700:0x1710 -h

Options:
  -o, --output FILENAME
  -h, --hexdump
  -l, --length FLEXINT
  --help                 Show this message and exit.

内存写入块

Usage: tmv71 memory write-block [OPTIONS] ADDRESS

  Write data to radio memory.

  This command will by default read data from stdin. Use the --input (-i)
  option to read data from a file instead, or --hexdata (-d) to provide
  hexadecimal data on the command line.

  Examples:

  1. Write four bytes to address 0x1700

     tmv71 memory write-block 0x1700 -d 'F0 15 AB 08'

  2. Open 'backup.dat', seek to position 0x1700, read 16 bytes, and    write
  them to address 0x1700:

     tmv71 memory write-block 0x1700 -i backup.dat -s 0x1700 -l 16

Options:
  -i, --input FILENAME
  -d, --hexdata TEXT
  -s, --seek FLEXINT
  -l, --length FLEXINT
  --help                Show this message and exit.

vfo波段

Usage: tmv71 vfo band [OPTIONS] [A|B|0|1] [[118|144|220|300|430|1200]]

  Get or set the frequency band for the selected radio band.

  Frequency bands are named using the names from "SELECTING A FREQUENCY
  BAND" in the TM-V71 manual. Note that band A and band B support a
  different subset of the available frequencies.

Options:
  --help  Show this message and exit.

vfo调谐

Usage: tmv71 vfo tune [OPTIONS] [A|B|0|1]

  Get or set VFO frequency and other settings.

  You can only tune to frequencies on the current band. Use the frequency-
  band command to change bands.

Options:
  --rx-freq FLOAT
  --rx-step [5|6.25|28.33|10|12.5|15|20|25|30|50|100]
  --shift [SIMPLEX|UP|DOWN|SPLIT]
  --reverse / --no-reverse
  --tone-status / --no-tone-status
  --ctcss-status / --no-ctcss-status
  --dcs-status / --no-dcs-status
  --tone-freq [67.0|69.3|71.9|74.4|77.0|79.7|82.5|85.4|88.5|91.5|94.8|97.4|100.0|103.5|107.2|110.9|114.8|118.8|123.0|127.3|131.8|136.5|141.3|146.2|151.4|156.7|162.2|167.9|173.8|179.9|186.2|192.8|203.5|240.7|210.7|218.1|225.7|229.1|233.6|241.8|250.3|254.1]
  --ctcss-freq [67.0|69.3|71.9|74.4|77.0|79.7|82.5|85.4|88.5|91.5|94.8|97.4|100.0|103.5|107.2|110.9|114.8|118.8|123.0|127.3|131.8|136.5|141.3|146.2|151.4|156.7|162.2|167.9|173.8|179.9|186.2|192.8|203.5|240.7|210.7|218.1|225.7|229.1|233.6|241.8|250.3|254.1]
  --dcs-code [23|25|26|31|32|36|43|47|51|53|54|65|71|72|73|74|114|115|116|122|125|131|132|134|143|145|152|155|156|162|165|172|174|205|212|223|225|226|243|244|245|246|251|252|255|261|263|265|266|271|274|306|311|315|325|331|332|343|346|351|356|364|365|371|411|412|413|423|431|432|445|446|452|454|455|462|464|465|466|503|506|516|523|565|532|546|565|606|612|624|627|631|632|654|662|664|703|712|723|731|732|734|743|754]
  --offset FLOAT
  --mode [FM|NFM|AM]
  -F, --format [shell|table|json]
  -T, --table-format [fancy_grid|github|grid|html|jira|latex|latex_booktabs|latex_raw|mediawiki|moinmoin|orgtbl|pipe|plain|presto|psql|rst|simple|textile|tsv|youtrack]
  -K, --key TEXT                  Limit output to the specified key (may be
                                  specified multiple times)
  --help                          Show this message and exit.

原始

^{pr31}$

CLI示例

在命令行上指定端口和速度

tmv71 --port /dev/ttyS0 --speed 9600 id

将频道导出到CSV

tmv71 channel export -o channels.csv

从CSV导入频道

tmv71 channel import -i channels.csv

仅导出通道1-10

^{pr35}$

备份收音机

tmv71 memory dump -o backup.dat

从备份还原

tmv71 memory restore -i backup.dat

从内存读取并将二进制数据写入文件

tmv71 memory read-block -o data.bin 0

从内存读取并显示hexdump

tmv71 memory read-block --hexdump 0

使用写块设置端口速度

PC端口速度以字节的形式存储在地址33(0x21)。以下命令将PC端口速度设置为57600 bps:

tmv71 memory write-block -d '03' 0x21

API示例

以下示例假定:

>>> from tmv71 import api
>>> radio = api.TMV71(port='/dev/ttyUSB0', speed=57600)

获取无线电ID

>>> radio.radio_id()
'TM-V71'

获取频道条目

>>> import pprint
>>> pprint.pprint(radio.get_channel_entry(0), indent=2)
{ 'channel': 0,
  'ctcss_freq': 146.2,
  'ctcss_status': True,
  'dcs_code': 23,
  'dcs_status': False,
  'lockout': False,
  'mode': 'FM',
  'name': 'MRABEL',
  'offset': 0.6,
  'reverse': False,
  'rx_freq': 145.43,
  'shift': 'DOWN',
  'step': 5.0,
  'tone_freq': 67.0,
  'tone_status': False,
  'tx_freq': 0.0,
  'tx_step': 5.0}

设置频道条目

>>> entry = radio.get_channel_entry(0)
>>> entry['rx_freq'] = 145.43
>>> radio.set_channel_entry(0, entry)
>>>

获取端口速度

获取/设置端口速度方法依赖于直接内存访问,这意味着无线电必须处于编程模式才能使用它们。{or>退出程序时,{或退出}命令时需要注意。在

>>> with radio.programming_mode():
...   radio.get_port_speed()
...
'57600'

作者

拉尔斯·凯洛格·斯特德曼

如果你在波士顿附近,有时你可以在MMRABARC中继器上找到我。在

许可证

tm-v71-tools-适用于Kenwood tm-v71的api和cli
版权所有(C)2019 Lars Kellogg Stedman

这个程序是免费软件:你可以重新发布和/或修改 根据GNU通用公共许可证的条款 自由软件基金会许可证第3版,或 (由您选择)任何更高版本。在

分发这个程序是希望它能有用, 但没有任何保证;甚至没有 适销性或对特定目的的适用性。见 GNU通用公共许可证获取更多详细信息。在

您应该已经收到了GNU通用公共许可证的副本 和这个节目一起。如果没有,请参见https://www.gnu.org/licenses/。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JavaFX 2.2字体呈现有问题   java如何从html文本中获取img url   java Spring数据REST存储库404   java从jar文件复制目录   java Spring引导无法满足自定义JPA请求   hadoop将值从Java操作传递到Oozie工作流中的下一个Java操作   java如何修复“Android资源链接失败”?使用NavigationView和片段   c3p0数据源的java独立日志文件   java如何从BufferImage生成图像   java JDBC SQL SELECT查询和方法运行不正常   从Android Studio中的java类获取资源   java EclipseLink MySQLSyntaxErrorException找不到错误   java我应该如何在mysql数据库中自动存储我的gps坐标?   ApacheFlex应该为BlazeDS实现Java DTO的可序列化   java为什么我的组件彼此相邻?   java在dao层中的多种方法   具有可配置凭据的java Spring WebServiceClient   java如何在Spring Boot中获取每个请求中的当前用户?