The working of magnetic contact sensors