BMCLI gateway
命令名、参数与机器可读字段保持英文,以便直接复制到终端或交给 AI 使用;当前安装版本的精确契约请以
bmcli help ... --format=json为准。
Expose physical CAN, CAN FD, and LIN channels through the deployed GWR remote
BMAPI UDP protocol. An upper computer uses the normal public BMAPI calls
BM_EnumerateRemote, BM_OpenEx, BM_Read, and BM_Write; it does not need a
BMCLI-specific client or protocol adapter.
The initial implementation has one configured consumer IPv4 address and uses
UDP control port 3502 plus generic-I/O port 2502. The protocol has no
authentication, authorization, encryption, or replay protection. Run it only
on an isolated or otherwise trusted engineering network with host firewall
rules restricted to the intended client.
gateway start
Section titled “gateway start”# Export two cross-connected CAN FD channels to a Linux upper computerbmcli gateway start \ --channel=10356/0,10357/0 \ --target=192.168.65.129 \ --advertise=192.168.65.1 \ --nbitrate=500 --dbitrate=2000 --termination=120
# Export a LIN master/slave pairbmcli gateway start \ --channel=10356/6,10357/4 \ --target=192.168.65.129 \ --bitrate=19200 --mode=slave --power=off| Option | Default | Description |
|---|---|---|
--channel |
existing daemon channels | Physical channels to export; required when the command creates a daemon |
--target |
required | IPv4 address of the intended remote BMAPI consumer |
--advertise |
route-selected local IPv4 | Gateway address shown in remote channel names |
--name |
BMCLI Gateway |
Remote server display name |
| daemon bus options | capability defaults | Applied only when gateway start creates the daemon; query runtime Help for the exact current list |
When no daemon is running, gateway start creates one, opens the requested
channels, and owns that daemon. A later gateway stop then also stops it. If a
daemon already exists, every channel already open in it is exported and an
optional --channel list must match that complete set. The pre-existing daemon
remains running after gateway stop.
Only physical channels may be exported. Remote and virtual channels are rejected to avoid forwarding loops. Export order is deterministic: first-opened physical device order, then ascending physical port within each device. Remote clients use the returned remote channel information rather than assuming a particular numeric index.
While the gateway is active, RxBroker fans each received frame out independently
to the gateway, local message recv, and software logging. Local message send,
receive, logging, and channel status remain available and do not consume one
another’s cursor. Channel reconfiguration/close, direct ISO-TP/UDS queue
ownership, daemon restart, and other operations that can invalidate the exported
map remain blocked until the gateway stops. Automatic daemon handle recovery is
also suspended because reopening a handle would invalidate the remote channel
map.
gateway status
Section titled “gateway status”bmcli gateway status --format=jsonReturns the state, configured target and advertised addresses, exported channel
count, and cumulative local_to_remote, remote_to_local, dropped, and
errors counters.
gateway stop
Section titled “gateway stop”bmcli gateway stop --format=jsonStops forwarding and closes the server-side remote BMAPI handles. It also stops the daemon only when that daemon was auto-created by the matching gateway start.
Remote BMAPI client sequence
Section titled “Remote BMAPI client sequence”BM_Init()BM_EnumerateRemote(gateway_ipv4, channel_info_array, ...)BM_OpenEx(... remote channel info ...)BM_GetNotification() / BM_WaitForNotifications()BM_Read() and BM_Write()BM_Close()BM_UnInit()Opening a remote channel applies the client’s requested CAN or LIN mode, bitrate, termination/pull-up, and power settings to the corresponding physical channel. The gateway translates remote logical channel numbers to physical ports in both control requests and data headers.
权威来源: bmcli_reference.md in the BMCLI repository. Run bmcli help <category> <action> --format=json for the exact contract of the installed version.