Add API to set detection window