parameters: (self, data: str, retries: int = 0)
docstring: Send data and return the response.
  
          Args:
              data: The data to send.
              retries: number of times to retry in case of timeout
  
          Returns: The command response
  
          Raises: SerialException
docstring_summary: Send data and return the response.
docstring_tokens: Send data and return the response .
function: async def _send_data(self, data: str, retries: int = 0) -> str:
          """
          Send data and return the response.
  
          Args:
              data: The data to send.
              retries: number of times to retry in case of timeout
  
          Returns: The command response
  
          Raises: SerialException
          """
          data_encode = data.encode()
  
          for retry in range(retries + 1):
              log.debug(f"{self.name}: Write -> {data_encode!r}")
              await self._serial.write(data=data_encode)
  
              response = await self._serial.read_until(match=self._ack)
              log.debug(f"{self.name}: Read <- {response!r}")
  
              if self._ack in response:
                  # Remove ack from response
                  response = response.replace(self._ack, b"")
                  str_response = self.process_raw_response(
                      command=data, response=response.decode()
                  )
                  self.raise_on_error(response=str_response)
                  return str_response
  
              log.info(f"{self.name}: retry number {retry}/{retries}")
  
              await self.on_retry()
  
          raise NoResponse(port=self._port, command=data)
function_tokens: async def _send_data ( self , data : str , retries : int = 0 ) -> str : data_encode = data . encode ( ) for retry in range ( retries + 1 ) : log . debug ( f"{self.name}: Write -> {data_encode!r}" ) await self . _serial . write ( data = data_encode ) response = await self . _serial . read_until ( match = self . _ack ) log . debug ( f"{self.name}: Read <- {response!r}" ) if self . _ack in response : # Remove ack from response response = response . replace ( self . _ack , b"" ) str_response = self . process_raw_response ( command = data , response = response . decode ( ) ) self . raise_on_error ( response = str_response ) return str_response log . info ( f"{self.name}: retry number {retry}/{retries}" ) await self . on_retry ( ) raise NoResponse ( port = self . _port , command = data )