Esempio n. 1
0
func createStopListener(ch chan int) {
	var prevStateStop int = 0
	var StateStop int = 0
	for {
		time.Sleep(time.Millisecond * 10)
		StateStop = int(C.elev_get_stop_signal())
		if StateStop != prevStateStop {
			prevStateStop = StateStop
			if StateStop == 1 {
				ch <- STOP
			}
		}
	}
}
Esempio n. 2
0
// StopButtonListener should be spawned as a goroutine, and will trigger on press
func StopButtonListener(ch chan<- bool) {
	var stopButtonState bool

	for {
		mutex.Lock()
		newState := C.elev_get_stop_signal() != 0
		mutex.Unlock()
		if newState != stopButtonState {
			stopButtonState = newState

			if newState {
				log.Debug("Stop button pressed")
			} else {
				log.Debug("Stop button released")
			}
			ch <- newState
		}
	}
}
Esempio n. 3
0
func Elev_get_stop_signal() int {
	return int(C.elev_get_stop_signal())
}
Esempio n. 4
0
func Elevator_get_stop_signal() bool {
	return (int(C.elev_get_stop_signal()) != 0)
}
Esempio n. 5
0
func GetStopSignal() int {
	return int(C.elev_get_stop_signal())
}