@@ -57,11 +57,6 @@ def __init__(self, channel=None, can_filters=None, **config):
5757
5858 :param int channel:
5959 The Channel id to create this bus with.
60- :param list can_filters:
61- A list of dictionaries each containing a "can_id" and a "can_mask".
62-
63- >>> [{"can_id": 0x11, "can_mask": 0x21}]
64-
6560 """
6661 type_filter = config .get ('type_filter' , neovi .NEODEVICE_ALL )
6762 neodevice .init_api ()
@@ -73,8 +68,6 @@ def __init__(self, channel=None, can_filters=None, **config):
7368 channel
7469 )
7570
76- self .sw_filters = None
77- self .set_filters (can_filters )
7871 self .rx_buffer = queue .Queue ()
7972
8073 self .network = int (channel ) if channel is not None else None
@@ -91,28 +84,6 @@ def shutdown(self):
9184 def _rx_buffer (self , msg , user_data ):
9285 self .rx_buffer .put_nowait (msg )
9386
94- def _is_filter_match (self , arb_id ):
95- """
96- If SW filtering is used, checks if the `arb_id` matches any of
97- the filters setup.
98-
99- :param int arb_id:
100- CAN ID to check against.
101-
102- :return:
103- True if `arb_id` matches any filters
104- (or if SW filtering is not used).
105- """
106- if not self .sw_filters :
107- # Filtering done on HW or driver level or no filtering
108- return True
109- for can_filter in self .sw_filters :
110- if not (arb_id ^ can_filter ['can_id' ]) & can_filter ['can_mask' ]:
111- return True
112-
113- logging .info ("%s not matching" % arb_id )
114- return False
115-
11687 def _ics_msg_to_message (self , ics_msg ):
11788 return Message (
11889 timestamp = neovi .GetTimeStampForMsg (self .device .handle , ics_msg )[1 ],
@@ -131,8 +102,7 @@ def recv(self, timeout=None):
131102 except queue .Empty :
132103 pass
133104 else :
134- if ics_msg .NetworkID == self .network and \
135- self ._is_filter_match (ics_msg .ArbIDOrHeader ):
105+ if ics_msg .NetworkID == self .network :
136106 return self ._ics_msg_to_message (ics_msg )
137107
138108 def send (self , msg , timeout = None ):
@@ -150,27 +120,3 @@ def send(self, msg, timeout=None):
150120 ics_msg .DescriptionID = self .device .tx_id
151121 self .device .tx_id += 1
152122 self .device .tx_raw_message (ics_msg , self .network )
153-
154- def set_filters (self , can_filters = None ):
155- """Apply filtering to all messages received by this Bus.
156-
157- Calling without passing any filters will reset the applied filters.
158-
159- :param list can_filters:
160- A list of dictionaries each containing a "can_id" and a "can_mask".
161-
162- >>> [{"can_id": 0x11, "can_mask": 0x21}]
163-
164- A filter matches, when
165- ``<received_can_id> & can_mask == can_id & can_mask``
166-
167- """
168- self .sw_filters = can_filters
169-
170- if self .sw_filters is None :
171- logger .info ("Filtering has been disabled" )
172- else :
173- for can_filter in can_filters :
174- can_id = can_filter ["can_id" ]
175- can_mask = can_filter ["can_mask" ]
176- logger .info ("Filtering on ID 0x%X, mask 0x%X" , can_id , can_mask )
0 commit comments