ekmmeters.py
def getResponse(self, context=""):
        """ Poll for finished block or first byte ACK.
        Args:
            context (str): internal serial call context.

        Returns:
            string: Response, implict cast from byte array.
        """
        waits = 0  # allowed interval counter
        response_str = ""  # returned bytes in string default
        try:
            waits = 0  # allowed interval counter
            while (waits < self.m_max_waits):
                bytes_to_read = self.m_ser.inWaiting()
                if bytes_to_read > 0:
                    next_chunk = str(self.m_ser.read(bytes_to_read)).encode('ascii', 'ignore')
                    response_str += next_chunk
                    if (len(response_str) == 255):
                        time.sleep(self.m_force_wait)
                        return response_str
                    if (len(response_str) == 1) and (response_str.encode('hex') == '06'):
                        time.sleep(self.m_force_wait)
                        return response_str
                else:  # hang out -- half shortest expected interval (50 ms)
                    waits += 1
                    time.sleep(self.m_force_wait)
            response_str = ""

        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        return response_str
def getResponse(self, context=""):
        """ Poll for finished block or first byte ACK.
        Args:
            context (str): internal serial call context.

        Returns:
            string: Response, implict cast from byte array.
        """
        waits = 0  # allowed interval counter
        response_str = ""  # returned bytes in string default
        try:
            waits = 0  # allowed interval counter
            while (waits < self.m_max_waits):
                bytes_to_read = self.m_ser.inWaiting()
                if bytes_to_read > 0:
                    next_chunk = str(self.m_ser.read(bytes_to_read)).encode('ascii', 'ignore')
                    response_str += next_chunk
                    if (len(response_str) == 255):
                        time.sleep(self.m_force_wait)
                        return response_str
                    if (len(response_str) == 1) and (response_str.encode('hex') == '06'):
                        time.sleep(self.m_force_wait)
                        return response_str
                else:  # hang out -- half shortest expected interval (50 ms)
                    waits += 1
                    time.sleep(self.m_force_wait)
            response_str = ""

        except:
            ekm_log(traceback.format_exc(sys.exc_info()))

        return response_str
Poll for finished block or first byte ACK.
        Args:
            context (str): internal serial call context.

        Returns:
            string: Response, implict cast from byte array.