func Start() { mac_switch_watch.SetHandler(mac_switch_watch.KeyOnSystemWillSleep, OnSleep) mac_switch_watch.SetHandler(mac_switch_watch.KeyOnSystemWillPowerOn, OnWakeup) mac_switch_watch.SetHandler(mac_switch_watch.KeyOnSystemWillPowerOff, OnPowerOff) OnStart() mac_switch_watch.Watch() }
func main() { mac_switch_watch.SetHandler(mac_switch_watch.KeyOnSystemWillSleep, OnSleep) mac_switch_watch.SetHandler(mac_switch_watch.KeyOnSystemWillPowerOn, OnWake) mac_switch_watch.Watch() }