Lines Matching +full:m +full:- +full:bus
3 # SPDX-License-Identifier: Apache-2.0
6 Zephyr CAN shell module support for providing a python-can bus interface for testing.
21 class CanShellBus(BusABC): # pylint: disable=abstract-method
27 can_filters: Optional[CanFilters] = None, **kwargs) -> None:
52 def _get_capabilities(self) -> list[str]:
58 m = regex_compiled.match(line)
59 if m:
60 return m.group('caps').split()
64 def _set_mode(self, mode: str) -> None:
79 def send(self, msg: Message, timeout: Optional[float] = None) -> None:
83 cmd += ' -e' if msg.is_extended_id else ''
84 cmd += ' -r' if msg.is_remote_frame else ''
85 cmd += ' -f' if msg.is_fd else ''
86 cmd += ' -b' if msg.bitrate_switch else ''
100 m = regex_compiled.match(line)
101 if m:
102 frame_num = m.group('id')
111 def _add_filter(self, can_id: int, can_mask: int, extended: bool) -> None:
114 cmd += ' -e' if extended else ''
126 m = regex_compiled.match(line)
127 if m:
128 filter_id = int(m.group('id'))
134 def _remove_filter(self, filter_id: int) -> None:
144 def _remove_all_filters(self) -> None:
149 def _apply_filters(self, filters: Optional[CanFilters]) -> None:
168 def _recv_internal(self, timeout: Optional[float]) -> Tuple[Optional[Message], bool]:
170 r'\s+(?P<brs>\S)(?P<esi>\S)\s+(?P<can_id>\d+)\s+\[(?P<dlc>\d+)\]\s*(?P<data>[a-z0-9 ]*)'
176 m = regex_compiled.match(line)
177 if m:
178 can_id = int(m.group('can_id'), 16)
179 ext = len(m.group('can_id')) == 8
180 dlc = int(m.group('dlc'))
181 fd = len(m.group('dlc')) == 2
182 brs = m.group('brs') == 'B'
183 esi = m.group('esi') == 'P'
184 data = bytearray.fromhex(m.group('data'))
193 def shutdown(self) -> None: