How to use the read_sync function from bindings

Find comprehensive JavaScript bindings.read_sync code examples handpicked from public code repositorys.

21
22
23
24
25
26
27
28
29
30
31
    gains[i] = buf.readInt32LE(i * 4) // TODO: Endian is OS dependent
  }
  return result
}


const read_sync = rtlsdr.read_sync
rtlsdr.read_sync = function (dev, buf, len, n_read) {
  len = len || buf.length
  n_read = n_read || Buffer.allocUnsafe(4) // TODO: int size is OS dependent
  const result = read_sync(dev, buf, len, n_read)
fork icon13
star icon73
watch icon0

+ 3 other calls in file

750
751
752
753
754
755
756
757
758
759

describe('read_sync(dev_hnd, len)', () => {
	it('reads data via rtlsdr_read_sync', () => {
		rtlsdr.mock_set_rtlsdr_dev_contents(dev, 'buffer_ready', true);

		let buf = rtlsdr.read_sync(dev, 20);
		buf.toString('ascii').should.equal('dddddddddddddddddddd');

		rtlsdr.mock_set_rtlsdr_dev_contents(dev, 'mock_sync_read_discount', 5);
		buf = rtlsdr.read_sync(dev, 10);
fork icon0
star icon1
watch icon0

+ 287 other calls in file

Other functions in bindings

Sorted by popularity

function icon

bindings.createKey is the most popular function in bindings (8616 examples)