Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Non-setting mode" #1

Open
StIch0 opened this issue Feb 15, 2021 · 1 comment
Open

Error "Non-setting mode" #1

StIch0 opened this issue Feb 15, 2021 · 1 comment

Comments

@StIch0
Copy link

StIch0 commented Feb 15, 2021

Good day.
Tell me what is the error?
getting Error initLock 7 Non-setting mode

`Ttlock.getBluetoothState((state: BluetoothState) => {
if (state !== 4) {
console.log(state);
} else {
Ttlock.startScan((scanLockModal: ScanLockModal): void => {
console.log('scanLockModal', scanLockModal);

      const param = {
        lockMac: scanLockModal.lockMac,
        lockVersion: scanLockModal.lockVersion,
      };

      Ttlock.initLock(
        param,
        (lockData: string): void => {
          console.log('lockData = ', lockData);
          Ttlock.stopScan();
          Ttlock.setLockConfig(
            LockConfigType.Audio,
            isOn,
            lockData,
            () => {
              Ttlock.controlLock(
                isOn ? LockControlType.Unlock : LockControlType.Lock,
                lockData,
                (
                  lockTime: number,
                  electricQuantity: number,
                  uniqueId: number,
                ) => {
                  console.log(
                    'controlLock',
                    lockTime,
                    electricQuantity,
                    uniqueId,
                  );
                },
                (errorCode: number, errorDesc: string): void => {
                  console.log('Error controlLock', errorCode, errorDesc);
                },
              );
            },
            (errorCode: number, errorDesc: string): void => {
              console.log('Error setLockConfig', errorCode, errorDesc);
              Ttlock.stopScan();
            },
          );
        },
        (errorCode: number, errorDesc: string): void => {
          console.warn('Error initLock', errorCode, errorDesc); // here is error
        },
      );
    });
  }
});`
@ttlock
Copy link
Owner

ttlock commented Aug 9, 2022

Hi !
Please make sure scanLockModal.isInited is false and scanLockModal.isKeyboardActivated is true before init lock.

If the lock already be initialized the scanLockModal.isInited is always true. you can reset lock by api Ttlock.resetLock or manual long press the reset button on the lock then enter the password on the keyboard (usually: 0000).

If the scanLockModal.isKeyboardActivated is false please touch the keypad on the door lock first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants