src/comm2checker.py
def sendAddInfo(self, sermsg: str, addmsg: str, waittime: float):
        """
        send additional message to checkers

        Parameters
        ----------
            port: object
                Serial
            sermsg: str
                message to checker (only from bit assign)
            addmsg: str
                additional message (not only from bit assign)
        Returns
        ----------
            rx: str
                return message from checker
        """
        # comm
        rx = self.sendMsg(sermsg, waittime)
        if rx == 'timeout':
            return 'order send error'
        if rx != ba.posRes:
            return 'additional info send error'
        else:
            # send msg as string
            self.port.write(addmsg.encode('utf-8'))
            # waiting rx
            start = time.time()
            elapsedTime = 0
            while elapsedTime<5:
                # read rx
                rxRaw = self.port.readline()
                # convert rx from bytes to string
                rx = ''.join(rxRaw.decode('utf-8').splitlines())
                if rx !='':
                    return rx
                time.sleep(waittime)
                elapsedTime = time.time()-start
            if elapsedTime >= 5:
                return 'timeout'

        send additional message to checkers

        Parameters
        ----------
            port: object
                Serial
            sermsg: str
                message to checker (only from bit assign)
            addmsg: str
                additional message (not only from bit assign)
        Returns
        ----------
            rx: str
                return message from checker
        
send additional message to checkers
Parameters

object
Serial
sermsg: str
message to checker (only from bit assign)
addmsg: str
additional message (not only from bit assign)
Returns

str
return message from checker
send additional message to checkers Parameters object Serial sermsg : str message to checker ( only from bit assign ) addmsg : str additional message ( not only from bit assign ) Returns str return message from checker
def sendAddInfo(self, sermsg: str, addmsg: str, waittime: float):
        rx = self.sendMsg(sermsg, waittime)
        if rx == 'timeout':
            return 'order send error'
        if rx != ba.posRes:
            return 'additional info send error'
        else:
            self.port.write(addmsg.encode('utf-8'))
            start = time.time()
            elapsedTime = 0
            while elapsedTime<5:
                rxRaw = self.port.readline()
                rx = ''.join(rxRaw.decode('utf-8').splitlines())
                if rx !='':
                    return rx
                time.sleep(waittime)
                elapsedTime = time.time()-start
            if elapsedTime >= 5:
                return 'timeout'
def sendAddInfo ( self , sermsg : str , addmsg : str , waittime : float ) : rx = self . sendMsg ( sermsg , waittime ) if rx == 'timeout' : return 'order send error' if rx != ba . posRes : return 'additional info send error' else : self . port . write ( addmsg . encode ( 'utf-8' ) ) start = time . time ( ) elapsedTime = 0 while elapsedTime < 5 : rxRaw = self . port . readline ( ) rx = '' . join ( rxRaw . decode ( 'utf-8' ) . splitlines ( ) ) if rx != '' : return rx time . sleep ( waittime ) elapsedTime = time . time ( ) - start if elapsedTime >= 5 : return 'timeout'
send additional message to checkers
Parameters
send additional message to checkers Parameters
"""
        send additional message to checkers

        Parameters
        ----------
            port: object
                Serial
            sermsg: str
                message to checker (only from bit assign)
            addmsg: str
                additional message (not only from bit assign)
        Returns
        ----------
            rx: str
                return message from checker
        """ # comm # send msg as string # waiting rx # read rx # convert rx from bytes to string
self
sermsg
str
addmsg
str
waittime
float