(
meta: SigMFMetadata,
indexes: number[],
blockSize: number,
signal: AbortSignal
)
| 43 | } |
| 44 | |
| 45 | getIQDataBlocks( |
| 46 | meta: SigMFMetadata, |
| 47 | indexes: number[], |
| 48 | blockSize: number, |
| 49 | signal: AbortSignal |
| 50 | ): Promise<IQDataSlice[]> { |
| 51 | |
| 52 | const localDirectory: FileWithDirectoryAndFileHandle[] = this.files; |
| 53 | if (!localDirectory) { |
| 54 | return Promise.reject('No local directory found'); |
| 55 | } |
| 56 | |
| 57 | const filePath = meta.getOrigin().file_path; |
| 58 | const dataFile = localDirectory.find((file) => { |
| 59 | return file.webkitRelativePath === filePath + '.sigmf-data' || file.name === filePath + '.sigmf-data'; |
| 60 | }); |
| 61 | if (!dataFile) { |
| 62 | return Promise.reject('No data file found'); |
| 63 | } |
| 64 | |
| 65 | return Promise.all(indexes.map(async (index) => { |
| 66 | const bytesPerIQSample = meta.getBytesPerIQSample(); |
| 67 | const countBytes = blockSize * bytesPerIQSample; |
| 68 | const offsetBytes = index * countBytes; |
| 69 | const slice = dataFile.slice(offsetBytes, offsetBytes + countBytes); |
| 70 | const buffer = await slice.arrayBuffer(); |
| 71 | const iqArray = convertToFloat32(buffer, meta.getDataType()); |
| 72 | return { index, iqArray }; |
| 73 | })); |
| 74 | } |
| 75 | } |
nothing calls this directly
no test coverage detected