
The IR transcievers recieve a BPSK signal modulated onto a sine wave. The IR transcievers demodulate this signal and output the resulting bit-stream.
Since we don't care about the information encoded in the signal we sample the signal and whenever a rising edge is seen from the IR, we start a counter. If a specified value is reached and the signal has remained high, we consider that block to be "signal present". We then wait a specified time and start checking again. If a complete cycle passes and no pulses of sufficent width are seen, we interpert that block to be "no signal present".