Skip to content

Conversation

@markCSDP
Copy link

@markCSDP markCSDP commented Aug 7, 2019

Here is a new interface for the DG BEACON tool from DG Technologies, Inc. (www.dgtech.com).
Note: we changed the version to 3.2.2, but you will need set it the correct version.

Copy link
Collaborator

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You committed a pyc file instead of the source file. Is this intentional?

@codecov
Copy link

codecov bot commented Aug 13, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@5ea5cfc). Click here to learn what that means.
The diff coverage is 1.95%.

@@            Coverage Diff            @@
##             develop    #677   +/-   ##
=========================================
  Coverage           ?   2.72%           
=========================================
  Files              ?      71           
  Lines              ?    6717           
  Branches           ?       0           
=========================================
  Hits               ?     183           
  Misses             ?    6534           
  Partials           ?       0

@mikado98765
Copy link

We are aware we missed the 'dgBus' in can/interfaces/init.py. We'll fix that.

@zariiii9003
Copy link
Collaborator

Maybe it would make sense to export most of the code to an external package and import it as an optional dependency.
Right now your code is almost as big as all the other interfaces combined. Who is going to maintain that?

@markCSDP
Copy link
Author

markCSDP commented Aug 22, 2019

Maybe it would make sense to export most of the code to an external package and import it as an optional dependency.
Right now your code is almost as big as all the other interfaces combined. Who is going to maintain that?

You are correct. I will pull out the module for the BEACON tool into an external package.

@markCSDP
Copy link
Author

I am still having an issue getting this pull request to complete the testing. As requested by zariiii9003, I have removed the files. Should I just open a new pull request?

@zariiii9003
Copy link
Collaborator

The log file says you have to fix the syntax in the setup.py:

Processing /home/travis/build/hardbyte/python-can
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-x978ibe6/setup.py", line 36
        <<<<<<< HEAD
         ^
    SyntaxError: invalid syntax

@mergify mergify bot requested a review from hardbyte November 16, 2020 00:19
Copy link
Owner

@hardbyte hardbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, everything is looking pretty good. I've left comments inline.
How did you get on splitting out a new Python library implementing the DG Gryphon Protocol?

I'd like to see tests for the utility functions _dict_to_msg and _list_to_int and their inverse.

There is still a .pyc file which should be removed.

Comment on lines +7 to +14
# **********************************************************************
# File Name: test_dg.py
# Author(s): mohtake <mohtake@dgtech.com>
# Target Project: python-can
# Description:
# Notes:
# **********************************************************************
#
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# **********************************************************************
# File Name: test_dg.py
# Author(s): mohtake <mohtake@dgtech.com>
# Target Project: python-can
# Description:
# Notes:
# **********************************************************************
#

Comment on lines +59 to +66
self.ip = kwargs["ip"] if "ip" in kwargs else "localhost"
self.is_fd = kwargs["is_fd"] if "is_fd" in kwargs else False
self.bitrate = kwargs["bitrate"] if "bitrate" in kwargs else 500000
self.termination = kwargs["termination"] if "termination" in kwargs else True
self.pre_iso = kwargs["pre_iso"] if "pre_iso" in kwargs else False
self.data_bitrate = (
kwargs["data_bitrate"] if "data_bitrate" in kwargs else 2000000
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more idiomatic to have kwargs.get("ip", "localhost") for all of these.

Comment on lines +1 to +16
#!/usr/bin/python
#
# ----------------------------------------------------------------------
# pylint: disable=invalid-name
# ----------------------------------------------------------------------
#
# **********************************************************************
#
# File Name: dg.py
# Author(s): mohtake <mohtake@dgtech.com>
# Target Project: python-can
# Description:
# Notes:
# **********************************************************************
#

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#!/usr/bin/python
#
# ----------------------------------------------------------------------
# pylint: disable=invalid-name
# ----------------------------------------------------------------------
#
# **********************************************************************
#
# File Name: dg.py
# Author(s): mohtake <mohtake@dgtech.com>
# Target Project: python-can
# Description:
# Notes:
# **********************************************************************
#

# ----------------------------------------------------------------------
import weakref
from can import BusABC, Message
from can.interfaces.dg.dg_gryphon_protocol import server_commands
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new dependency needs to be added and this import updated?



class DGBus(BusABC):
""" Beacon python-can backend API """
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any other backend specific notes aimed at developer users should go here. For instance I'd assume the messages are timestamped in hardware?

It also looks like you aren't supporting in hardware filtering? Is that a limitation of the gryphon protocol?

Comment on lines +101 to +103
self.beacon.CMD_CARD_SET_FILTER_MODE(
self.channel, self.beacon.FILTER_OFF_PASS_ALL
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume there isn't any downside to calling this, and then a few lines down via the super calling set_filters?

self.channel, self.beacon.FILTER_OFF_PASS_ALL
)
self.channel_info = ("dg channel '%s' on " + self.mode) % self.channel
super(DGBus, self).__init__(self.channel, None)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems fishy here. Can you please explicitly deal with can_filters
As written I think they are just being dropped?

Comment on lines +267 to +280
for item in filters:
dataFil["filter_blocks"].append({})
dataFil["filter_blocks"][counter]["byte_offset"] = 0
dataFil["filter_blocks"][counter][
"data_type"
] = self.beacon.FILTER_DATA_TYPE_HEADER
dataFil["filter_blocks"][counter]["operator"] = self.beacon.BIT_FIELD_CHECK
dataFil["filter_blocks"][counter]["mask"] = self._int_to_list(
item["can_mask"]
)
dataFil["filter_blocks"][counter]["pattern"] = self._int_to_list(
item["can_id"]
)
counter += 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for item in filters:
dataFil["filter_blocks"].append({})
dataFil["filter_blocks"][counter]["byte_offset"] = 0
dataFil["filter_blocks"][counter][
"data_type"
] = self.beacon.FILTER_DATA_TYPE_HEADER
dataFil["filter_blocks"][counter]["operator"] = self.beacon.BIT_FIELD_CHECK
dataFil["filter_blocks"][counter]["mask"] = self._int_to_list(
item["can_mask"]
)
dataFil["filter_blocks"][counter]["pattern"] = self._int_to_list(
item["can_id"]
)
counter += 1
for item in filters:
dataFil["filter_blocks"].append({
"byte_offset": 0,
"data_type": self.beacon.FILTER_DATA_TYPE_HEADER,
"operator": self.beacon.BIT_FIELD_CHECK,
"mask": self._int_to_list(item["can_mask"]),
"pattern": self._int_to_list(item["can_id"])
})

)

def stop(self):
self.beaconref().CMD_SCHED_KILL_TX(self.channel, self.idIn)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.beaconref().CMD_SCHED_KILL_TX(self.channel, self.idIn)
self.beaconref().CMD_SCHED_KILL_TX(self.channel, self.idIn)

================

Interface to `DG Technologies <http://dgtech.com>`__ Beacon

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any extra drivers required for this? What platforms (operating systems) does it run on?

Comment on lines +15 to +17
The ``DGBus`` class implements several python-can methods::

send, send_periodic, recv, set_filters, flush_tx_buffer, _detect_available_configs, shutdown
Copy link
Collaborator

@felixdivo felixdivo Nov 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no need to mention the methods which definitely need to be implemented anyways. It raises the question if other interfaces do it even if they do not mention it. I'd suggest including these:

Suggested change
The ``DGBus`` class implements several python-can methods::
send, send_periodic, recv, set_filters, flush_tx_buffer, _detect_available_configs, shutdown
The ``DGBus`` class implements several optional methods: ``send_periodic`` and ``set_filters`` within the driver, as well as ``flush_tx_buffer`` and ``_detect_available_configs``.

@felixdivo
Copy link
Collaborator

Cool mocking tests!

@felixdivo
Copy link
Collaborator

@markcdg Do you plan on working further on this PR? It looks like a neat addition to the library!

@felixdivo
Copy link
Collaborator

I opened #1132 to track this topic and will close this one as there is apparently no development effort going on.

@felixdivo felixdivo closed this Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants