add factory reset

This commit is contained in:
Michele Balistreri 2021-10-27 09:17:12 +03:00
parent e3c16d0e57
commit ec962ae1e7
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
2 changed files with 9 additions and 7 deletions

View File

@ -1,12 +1,14 @@
package statuskeycardgo
import "errors"
func (f *KeycardFlow) factoryReset(kc *keycardContext) error {
// on success, remove the FactoryReset switch to avoid re-triggering it
// if card is disconnected/reconnected
delete(f.params, FactoryReset)
return errors.New("not implemented")
err := kc.factoryReset()
if err == nil {
delete(f.params, FactoryReset)
return restartErr()
} else {
return err
}
}
func (f *KeycardFlow) selectKeycard(kc *keycardContext) error {

View File

@ -463,7 +463,7 @@ func (kc *keycardContext) changePairingPassword(pairingPassword string) error {
return nil
}
func (kc *keycardContext) factoryReset(pairingPassword string) error {
func (kc *keycardContext) factoryReset() error {
<-kc.connected
if kc.runErr != nil {
return kc.runErr