The CPAP device is used to treat sleep apnea. The continuous positive pressure of the CPAP machine prevents the airways from collapsing during sleep by detecting the breathing pattern through a special algorithm and proactively adjusting the pressure automatically. Air is delivered under pressure from the CPAP through a specially designed tube to the nose or mouth, using an appropriate nasal or oronasal mask, respectively.