Enable enables the specified sensor type with the given delay rate. Users must set a non-nil Sender via Notify before enabling a sensor, otherwise an error will be returned.
(t Type, delay time.Duration)
| 101 | // Users must set a non-nil Sender via Notify before enabling a sensor, |
| 102 | // otherwise an error will be returned. |
| 103 | func Enable(t Type, delay time.Duration) error { |
| 104 | if t < 0 || int(t) >= len(sensorNames) { |
| 105 | return errors.New("sensor: unknown sensor type") |
| 106 | } |
| 107 | if err := validSender(); err != nil { |
| 108 | return err |
| 109 | } |
| 110 | return enable(t, delay) |
| 111 | } |
| 112 | |
| 113 | // Disable disables to feed the manager with the specified sensor. |
| 114 | // Disable is not safe for concurrent use. |
nothing calls this directly
no test coverage detected