Checkpoint 3

This commit is contained in:
Arti Zirk
2023-07-29 20:04:19 +03:00
parent 2521a811f5
commit 172dbcc210
5 changed files with 154 additions and 55 deletions

View File

@@ -1,23 +1,32 @@
package main
import (
"fmt"
"time"
)
type WiegandMock struct {
mockUid uint64
openState bool
}
func (*WiegandMock) OpenDoor() {
fmt.Println("Door is now open")
time.Sleep(500 * time.Millisecond)
fmt.Println("Door is now closed")
func (w *WiegandMock) OpenDoor() error {
w.openState = true
return nil
}
func (w *WiegandMock) CloseDoor() error {
w.openState = false
return nil
}
func (w *WiegandMock) IsDoorOpen() (bool, error) {
return w.openState, nil
}
func (w *WiegandMock) GetCardUid() (uint64, error) {
time.Sleep(1 * time.Second)
return w.mockUid, fmt.Errorf("err")
return w.mockUid, nil //fmt.Errorf("err")
}
func (w *WiegandMock) SetMockUid(mockUid uint64) {