Skip to content

Commit

Permalink
Merge commit 'refs/tags/Release_1.0^{}'
Browse files Browse the repository at this point in the history
  • Loading branch information
ebroecker committed Jul 19, 2023
2 parents b299064 + 3e115f8 commit 44171f2
Show file tree
Hide file tree
Showing 27 changed files with 1,102 additions and 174 deletions.
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## **Canmatrix** is a python package to read and write several CAN (Controller Area Network) database formats. ##
[![PyPI](https://img.shields.io/pypi/v/canmatrix.svg)](https://pypi.org/project/canmatrix/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/canmatrix.svg)](https://pypi.org/project/canmatrix/)
[![Build Status](https://travis-ci.org/ebroecker/canmatrix.svg?branch=development)](https://travis-ci.org/ebroecker/canmatrix)
[![Codecov branch](https://img.shields.io/codecov/c/github/ebroecker/canmatrix/development.svg)](https://codecov.io/gh/ebroecker/canmatrix/)
[![GitHub issues](https://img.shields.io/github/issues-raw/ebroecker/canmatrix.svg)](https://github.com/ebroecker/canmatrix/issues)

Expand Down
7 changes: 1 addition & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ skip_branch_with_pr: true

environment:
matrix:
- TOXENV: py27
- TOXENV: py35
- TOXENV: py36
- TOXENV: py37
- TOXENV: py38
- TOXENV: py39
- TOXENV: py310
- TOXENV: pypy
- TOXENV: pypy3
- TOXENV: py311
- TOXENV: dist

matrix:
Expand All @@ -28,7 +24,6 @@ init:
- ps: if (Get-ChildItem Env:ENABLE_RDP -ErrorAction SilentlyContinue) {iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))} else {echo RDP not enabled}

install:
- if "%TOXENV%"=="pypy" choco install python.pypy
- if "%TOXENV%"=="pypy3" choco install python.pypy3
- py -m pip install tox
- ps: Update-AppveyorBuild -Version "v$(py get_version.py) b$Env:APPVEYOR_BUILD_NUMBER"
Expand Down
16 changes: 16 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ this will remove frames ``myFrame`` and ``myFrame2`` in ``source.dbc`` and store
this will load ``source.dbc`` and rename frames ``myFrame`` in ``myNewFrame`` and ``myFrame2`` in ``myNewFrame2``.
The result is stored in ``target.dlc``.

**compress Frame:**

::

$ canconvert --compressFrame=myFrame,myFrame2,someFrames* source.dbc target.dbc

this will load ``source.dbc`` and compress frames ``myFrame`` in ``myFrame2`` and all frames starting with ``someFrames``.
compress means, it tries to fill gaps between signals.
Works only for frames which have only big_endian signals or frames which have only little_endian singals
Frame name could be * which will compress all frames
The result is stored in ``target.dlc``.


**delete Signal:**

Expand Down Expand Up @@ -365,6 +377,10 @@ ____________________

rename Frame form databases. (comma separated list) Syntax: --renameFrame=myOldFrame:myNewFrame,mySecondFrame:mySecondNewFrame

--compressFrame=FRAME

compress Frame form databases. Syntax: --compressFrame=frame1,frame2,*

--deleteSignal=DELETESIGNAL

delete Signal form databases. (comma separated list) Syntax: --deleteSignal=mySignal1,mySecondSignal
Expand Down
3 changes: 3 additions & 0 deletions docs/contents.rst
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Canmatrix Documentation
=======================


1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"click",
"enum34; python_version < '3.4'",
"future",
"importlib-metadata; python_version < '3.8'",
"six",
"typing; python_version < '3.5'",
],
Expand Down
44 changes: 44 additions & 0 deletions src/canmatrix/cancluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def __init__(self, *arg, **kw):
self._frames = [] # type: typing.List[canmatrix.Frame]
self._signals = [] # type: typing.List[canmatrix.Signal]
self._ecus = [] # type: typing.List[canmatrix.Ecu]
self._pdu_gateway_list = [] # type: typing.List[dict[str, str]]
self._signal_gateway_list = [] # type: typing.List[dict[str, str]]
self.update()

def update_frames(self): # type: () -> typing.MutableSequence[canmatrix.Frame]
Expand Down Expand Up @@ -82,3 +84,45 @@ def signals(self): # type: () -> typing.MutableSequence[canmatrix.Signal]
if not self._signals:
self.update_signals()
return self._signals

def pdu_gateway(self, pdu_gateway_list=[]):
self._pdu_gateway_list += pdu_gateway_list
return self._pdu_gateway_list

def signal_gateway(self, signal_gateway_list=[]):
self._signal_gateway_list += signal_gateway_list
return self._signal_gateway_list

def get_pdu_routing_info(self, pdu_name, strict_search=False):
routing_source = []
routing_target = []
if strict_search:
for pdu in self._pdu_gateway_list:
if pdu_name == pdu["source"]:
routing_source.append({"pdu": pdu["target"], "cluster": pdu["target_cluster"], "ecu": pdu["ecu"], "type": pdu["target_type"]})
if pdu_name == pdu["target"]:
routing_target.append({"pdu": pdu["source"], "cluster": pdu["source_cluster"], "ecu": pdu["ecu"], "type": pdu["source_type"]})
else:
for pdu in self._pdu_gateway_list:
if pdu_name in pdu["source"]:
routing_source.append({"pdu": pdu["target"], "cluster": pdu["target_cluster"], "ecu": pdu["ecu"], "type": pdu["target_type"]})
if pdu_name in pdu["target"]:
routing_target.append({"pdu": pdu["source"], "cluster": pdu["source_cluster"], "ecu": pdu["ecu"], "type": pdu["source_type"]})
return {"source": routing_source, "target": routing_target}

def get_signal_routing_info(self, signal_name, strict_search=False):
routing_source = []
routing_target = []
if strict_search:
for signal_gw in self._signal_gateway_list:
if signal_name == signal_gw["source"]:
routing_source.append({"signal": signal_gw["target"], "cluster": signal_gw["target_cluster"], "ecu": signal_gw["ecu"], "type": signal_gw["target_type"]})
if signal_name == signal_gw["target"]:
routing_target.append({"signal": signal_gw["source"], "cluster": signal_gw["source_cluster"], "ecu": signal_gw["ecu"], "type": signal_gw["source_type"]})
else:
for signal_gw in self._signal_gateway_list:
if signal_name in signal_gw["source"]:
routing_source.append({"signal": signal_gw["target"], "cluster": signal_gw["target_cluster"], "ecu": signal_gw["ecu"], "type": signal_gw["target_type"]})
if signal_name in signal_gw["target"]:
routing_target.append({"signal": signal_gw["source"], "cluster": signal_gw["source_cluster"], "ecu": signal_gw["ecu"], "type": signal_gw["source_type"]})
return {"source": routing_source, "target": routing_target}
Loading

0 comments on commit 44171f2

Please sign in to comment.