Exemple #1
0
    def specific_wait_frame(self, timeout=2):
        if not self.opened:
            raise RuntimeError("Connection is not open")

        timedout = False
        frame = None
        try:
            frame = self.fromIsoTPQueue.get(block=True, timeout=timeout)
        except queue.Empty:
            timedout = True

        if timedout:
            raise TimeoutException(
                "Did not receive frame IsoTP Transport layer in time (timeout=%s sec)"
                % timeout)

        if self.mtu is not None:
            if frame is not None and len(frame) > self.mtu:
                self.logger.warning(
                    "Truncating received payload to a length of %d" %
                    (self.mtu))
                frame = frame[0:self.mtu]

        return bytes(
            frame
        )  # isotp.protocol.TransportLayer uses bytearray. udsoncan is strict on bytes format
 def specific_wait_frame(self, timeout=None):
     timeout = 10
     if not self.opened:
         raise RuntimeError("USB-ISOTP Connection is not open")
     try:
         frame = self.rxqueue.get(block=True, timeout=timeout)
     except queue.Empty:
         raise TimeoutException(
             "Did not receive frame from user queue in time (timeout=%s sec)"
             % timeout)
         frame = None
     return frame
Exemple #3
0
    def specific_wait_frame(self, timeout=2):
        if not self.opened:
            raise RuntimeError("Connection is not open")

        timedout = False
        frame = None
        try:
            frame = self.rxqueue.get(block=True, timeout=timeout)

        except queue.Empty:
            timedout = True

        if timedout:
            raise TimeoutException("Did not received ISOTP frame in time (timeout=%s sec)" % timeout)

        return frame
Exemple #4
0
    def specific_wait_frame(self, timeout=4):
        if not self.opened:
            raise RuntimeError("Fake Connection is not open")

        timedout = False
        frame = None
        try:
            frame = self.rxqueue.get(block=True, timeout=timeout)
            # frame = self.rxqueue.get(block=True, timeout=5)

        except queue.Empty:
            timedout = True

        if timedout:
            raise TimeoutException(
                "Did not received response from J2534 RxQueue (timeout=%s sec)"
                % timeout)

        return frame
Exemple #5
0
    def specific_wait_frame(self, timeout=2):
        if not self.opened:
            raise RuntimeError("Connection is not open")

        timedout = False
        frame = None
        try:
            frame = self.fromuserqueue.get(block=True, timeout=timeout)
        except queue.Empty:
            timedout = True

        if timedout:
            raise TimeoutException("Did not receive frame from user queue in time (timeout=%s sec)" % timeout)

        if self.mtu is not None:
            if frame is not None and len(frame) > self.mtu:
                self.logger.warning("Truncating received payload to a length of %d" % (self.mtu))
                frame = frame[0:self.mtu]

        return frame