mirror of
https://github.com/controllerzz/carbus_lib.git
synced 2026-05-22 19:51:41 +03:00
update readme.md
This commit is contained in:
13
README.md
13
README.md
@@ -107,19 +107,14 @@ ISO-TP канал строится поверх CarBusDevice:
|
|||||||
````python
|
````python
|
||||||
from isotp_async.transport import IsoTpChannel
|
from isotp_async.transport import IsoTpChannel
|
||||||
|
|
||||||
# предполагается, что dev уже открыт и канал CAN настроен
|
can_tr = CarBusCanTransport(dev, channel=1, rx_id=0x7E8)
|
||||||
isotp = IsoTpChannel(
|
isotp = IsoTpChannel(can_tr, tx_id=0x7E0, rx_id=0x7E8)
|
||||||
device=dev,
|
|
||||||
channel=1,
|
|
||||||
tx_id=0x7E0, # наш запрос
|
|
||||||
rx_id=0x7E8, # ответ ЭБУ
|
|
||||||
)
|
|
||||||
|
|
||||||
# отправить запрос ReadDataByIdentifier F190 (VIN)
|
# отправить запрос ReadDataByIdentifier F190 (VIN)
|
||||||
await isotp.send(b"\x22\xF1\x90")
|
await isotp.send_pdu(b"\x22\xF1\x90")
|
||||||
|
|
||||||
# получить полный ответ (single или multi-frame)
|
# получить полный ответ (single или multi-frame)
|
||||||
resp = await isotp.recv(timeout=1.0)
|
resp = await isotp.recv_pdu(timeout=30.0)
|
||||||
print("ISO-TP:", resp.hex())
|
print("ISO-TP:", resp.hex())
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user