Changeset 0c6fd4c in ammosreader
- Timestamp:
- 05/28/23 09:52:29 (2 years ago)
- Branches:
- AmmosSource
- Children:
- 0fcd6da
- Parents:
- 008dcb7
- Location:
- ammosreader
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ammosreader/AbstractAmmosReader.py
r008dcb7 r0c6fd4c 20 20 21 21 :param source: The source to read Ammos data from 22 :type source: AmmosSource 22 :type source: AmmosSource 23 23 """ 24 24 self.__source = source … … 92 92 """My descendents have to implement this.""" 93 93 return self.__source.read_bytes(bytes_to_read) 94 94 95 95 @abstractmethod 96 96 def read_next_global_frame_body(self, data_header_length): … … 106 106 """ 107 107 global_frame_header = self.read_next_global_frame_header() 108 109 if global_frame_header is None:110 return None111 108 112 109 if global_frame_header is None: … … 136 133 global_frame_body = self.read_next_global_frame_body(global_frame_header.data_header_length) 137 134 if global_frame_body is None: 135 logger.info("Can not read global frame body for audio data stream") 138 136 return None 139 137 return AmmosSingleFrame(global_frame_header, global_frame_body) … … 143 141 global_frame_body = self.read_next_global_frame_body(global_frame_header.data_header_length) 144 142 if global_frame_body is None: 143 logger.info("Can not read global frame body for IF data stream") 145 144 return None 146 145 return AmmosSingleFrame(global_frame_header, global_frame_body) 147 146 148 147 if global_frame_body is None: 148 logger.info("Can not read global frame body") 149 149 return None 150 150 -
ammosreader/AmmosSocketSource.py
r008dcb7 r0c6fd4c 1 """I provide a source to read AMMOS data from a socket.""" 2 1 3 import socket 2 4 3 5 from ammosreader.AmmosSource import AmmosSource 6 from ammosreader import logger 7 4 8 5 9 class AmmosSocketSource(AmmosSource): 10 """I implement a descendent of AmmosSource that reads from a socket.""" 6 11 7 12 def read_bytes(self, bytes_to_read): … … 18 23 logger.info("Got %s bytes of %s remaining", len(new_bytes), bytes_to_read - len(b''.join(byte_array))) 19 24 byte_array.append(new_bytes) 20 except : TimeOutError:25 except TimeoutError: 21 26 return None 22 27 return b''.join(byte_array)
Note:
See TracChangeset
for help on using the changeset viewer.