hardbyte / python-can

The can package provides controller area network support for Python developers
https://python-can.readthedocs.io
GNU Lesser General Public License v3.0
1.26k stars 599 forks source link

Filter messages by list of CAN-IDs #1225

Open keelung-yang opened 2 years ago

keelung-yang commented 2 years ago

Some MCUs, such as STM32 and NXP LPCxxx, support filtering messages by list or range of CAN-IDs. Some CAN devices, which using such MCUs, provide list-only or both list and mask filters in official development library.

Maybe filtering by mask is the most popular ways, but filtering by list shouldn't be ignored. In python-can, only filtering by mask is supported currently.

felixdivo commented 2 years ago

See also #1208

felixdivo commented 2 years ago

Filtering by blacklist/whitelist given by a set should be fairly efficient too even for large numbers of IDs. Maybe there is even a special data structure for integer sets outside the standard library.