Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Jul 8, 2024
1 parent 71533c0 commit 63aff05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion fr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
async def main() -> None:
url = TargetURI("flexray://?slot_id=0x42")
tp = await RawFlexrayTransport.connect(url, None)
await tp.write(b"fefefefefefe")
data = await tp.read(timeout=5)
print(data)

Expand Down
6 changes: 2 additions & 4 deletions src/gallia/transports/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ async def write(
# event.tagData.frTxFrame.data = ctypes.create_string_buffer(data, 254)
event.tagData.frTxFrame.data = data

print("writing")
await asyncio.to_thread(
vector_ctypes.xlFrTransmit,
self.port_handle,
Expand All @@ -135,7 +134,6 @@ async def read(self, timeout: float | None = None, tags: list[str] | None = None
end_time = time.time() + timeout if timeout is not None else None

while True:
print("reading")
if end_time is not None and time.time() > end_time:
raise TimeoutError()

Expand All @@ -154,8 +152,8 @@ async def read(self, timeout: float | None = None, tags: list[str] | None = None
event = vector_ctypes.XLfrEvent()
vector_ctypes.xlFrReceive(self.port_handle, ctypes.byref(event))

print(event)
print(event.tagData)
if event.tagData.slotID != self.config.slot_id:
continue

# TODO: slicing is correct?
return bytes(event.tagData.raw)[: int(event.size)]
Expand Down

0 comments on commit 63aff05

Please sign in to comment.