%% Decode BLE Waveform Using Default Settings
% Create an input message column vector of length 1000 containing random binary values. Generate a BLE transmit waveform from the transmission bits by using the bleWaveformGenerator function.

txBits = randi([0 1],1000,1);
txWaveform = bleWaveformGenerator(txBits);

% Pass the transmit waveform through a noisy channel and obtain the received waveform.

snr = 30; % specified in dB
rxWaveform = awgn(txWaveform,snr);

% Recover data bits from the received BLE waveform using bleIdealReceiver. Check for the number of bit errors in the recovered bits. The returned value indicates that the BLE waveform was successfully decoded.

[rxBits,accessAddr] = bleIdealReceiver(rxWaveform);
numErr = biterr(txBits,rxBits)

% Copyright 2018 The MathWorks, Inc.