Factor the code that listens for upower sleeping and resuming signals out into a class code NMSleepMonitor.