Smart Lock Products

Bosma Lock belongs to Business layer,mainly to provide the relevant support for Smart Lock Series.Main production are:Aegis,Gateway,Keypad and etc.

Aegis

Add Aegis

The Aegis device has a built-in Bluetooth module, so we add a device via the Bluetooth module. The sample code is shown in BosmaDemo

1.Search device

Press and hold the reset button of the Aegis device. When the red light of the device blinks, it means the device is reset successfully. Then use the BosmaBluetoothManager.h or use the Bluetooth service of the system to search for the Aegis device, get theCBPeripheral instance of the Aegis device ,use this instance and the related data to initialize the BosmaAddLocktool class, and finish the binding process;

2.Bind device

Aegis device binding communicates with the device's Bluetooth module via the APP Bluetooth service. During the binding process, please keep the app and the device within the Bluetooth communication range.

/// Register and bind Aegis lock devices
/// @param peripheral The searched target peripheral device, you need to connect to the device first
/// @param modelCode Aegis lock's modelCode (010601)
/// @param familyId the family You want to bind the device to
/// @param block  result or binding error code
[[BosmaAddLock sharedInstance] registerDeviceLockWithPeripheral:@"searched Aegis cbPeripheral" 
         modelCode:@"Aegis model code (010601)"
         familyId:@"Your family id"
         registerDeviceBlock:(RegisterBleDeviceBlock)block];

Calibrate Aegis

The Aegis device has sensors that detect the unlocked/locked status of the door locks and the open/closed status of the doors. So before we start using Aegis, we need to calibrate the Aegis device. The sample code is shown in BosmaDemo

Precautions

When calibrating the device, make sure that the device is in the state required by the current step before calling the method to send the command; If the calibration procedure is not followed, or if the device status does not match the procedure, the calibration will fail; If the calibration fails, the calibration can be repeated; If the device is uninstalled for reinstallation, or if the on/off state of the device is abnormal, it can be recalibrated and used again;

typedef enum
{
    BS_LOCK_CALIBRATION_STEP_START = 0x01,       //step1: door closed and locked state
    BS_LOCK_CALIBRATION_STEP_UNLOCK = 0x02,      //step2: unlock state
    BS_LOCK_CALIBRATION_STEP_OPENDOOR = 0x03,    //step3: open the door with an opening angle of more than 30’
    BS_LOCK_CALIBRATION_STEP_LOCK = 0x05,        //step4: door closed and locked state
    BS_LOCK_CALIBRATION_STEP_UNLOCK_END = 0x06,  //step5: save and complete
}BS_LOCK_CALIBRATION_STEP;


/// Call this method to calibrate the door lock, *the door lock must be calibrated before it can be used normally
/// @param step step description
/// @param callBack callBack description
[[BosmaLock sharedInstance] queryLockCalibrationOperateWithStep:(BS_LOCK_CALIBRATION_STEP)step 
                                        callback:(BSBLEDLockCorrectStepBlock)callBack];

Management of Aegis

If you want to control an Aegis device, then you must configure the device data of Aegis first, then connect to Aegis, as shown in the following diagram. The sample code is shown in BosmaDemo

Configure the device data of Aegis

When using the interface provided by[BosmaLock sharedInstance],the device data must be initialized first.Only one initialization is required to operate the same Aegis device;

// Configure Aegis device data
[[BosmaLock sharedInstance] configureDeivceWithDevicePid:@"Your Aegis device pid"
                                                deiceMac:@"Your Aegis device MAC"];

Connect Aegis

// Connect Aegis device
[[BosmaLock sharedInstance] searchConnectDeviceCallBack:^(BOOL isSuccess, 
                                                CBPeripheral *peripheral, 
                                                CBCharacteristic *characteristic) 
    {
    if (isSuccess == true) {
        NSLog(@"Connect Aegis device is success");
        [self setButtonDone];
                    
    }else {
        NSLog(@"Connect Aegis device is failure");
    }
}];

Check the Bluetooth connection status of the device

Aegis setup is usually done by communicating with the Aegis Bluetooth module through the Bluetooth service of the app. Usually, before setting up Aegis, you can check if the device is already connected.

/// Whether to connect to the target device;
[[BosmaLock sharedInstance] isTargetLockConnected];

1.Remove Aegis

The following methods can be called directly to delete the binding relationship of the device; (For security reasons, you can set the check permission conditions to prevent faulty operation of the user, such as requiring the user to enter the login password or obtain the authentication code before deleting the device; before deleting the device, you can prompt the user to ensure that the door lock is unlocked to avoid unnecessary trouble; )

/// Remove device lock
/// @param callback callback description
[[BosmaLock sharedInstance] removeLockCallback:(BSRemoveLockBlock)callback];

2.Synchronize the time of the Aegis

The built-in time of Aegis is used as the recording time of each operation log; if the device is not used for a long time, the time of the built-in timer of the device may be inaccurate. It is recommended to synchronize the time of the device whenever calibrating the device.

/// Synchronize the time of the device
/// @param timestamp The time when the device is currently acquired
/// @param isForce Whether to auto synchronization to the current phone time
/// @param callBack callBack description
[[BosmaLock sharedInstance] synchronizeDeviceTimestmap:(NSString*)timestamp 
                isForce:(BOOL)isForce 
                callBack:(BSBLECommandBlock)callBack];

**3.Check the reset state of Aegis **

Check whether the device has been reset, the device version information, and whether the device is in an abnormal state of firmware upgrade data (need to re-update the device firmware)

3.1 Press and hold the reset button of the device to put the device into the reset state; the device in the reset state should be re-added and recalibrated before normal use;

3.2 The device version information is the version information of the current firmware of the device; in case of firmware abnormality, the version information will return the charactersFF.FF.FF.FF character;

3.3 When the firmware of the device is upgraded, due to Bluetooth error or the phone is too far from Aegis and the Bluetooth data is lost, the Aegis firmware data is abnormal after completion of the upgrade, or the upgrading fails directly; this interface can query whether the device is in an abnormal firmware data state; if the firmware data of the device is abnormal, the device version information will return FF.FF.FF.FF character, and return the parameterisNeedOTA = true, The device will resume the normal state after re-upgrading the firmware;

/// Query lock status  reset / version / abnormal status need upgrade
/// @param callBack callBack description
[[BosmaLock sharedInstance] queryLockStatusIsResetCallback:(BSBLEDLockCheckResetBlock)callBack];

4.Monitor the change of the common state of the Aegis

The interface monitors the change of the common state of the device, including the device open/close status, device open/close lock status, device power information, etc.; (If the state value returned by this interface is abnormal, the device can be recalibrated and then observed;)

/// Set the observer of the state of the door lock device, and notify the observer when the state changes
/// @param callBack callBack description
[[BosmaLock sharedInstance] observerDeviceStatusUpdateCallback:(BSBLEDLockStatusInfoUpdateBlock)callBack];

5.Query the general status of the Aegis

Query the general status of the device, you can get the device open/close status, device open/close lock status, device power information, etc.

/// Query the status of the device, such as locked, unlocked, power, etc.
/// @param callBack callBack description
[[BosmaLock sharedInstance] queryDeviceStatusCallback:(BSBLEDLockQueryStatusInfoBlock)callBack];

**6.Query all status values of Aegis **

Query all status values of the device,specifics as BSBLEDLockQueryAllInfoBlock

/// Query device all info
/// @param callback callback description
[[BosmaLock sharedInstance] queryDeviceInformationCallBack:(BSBLEDLockQueryAllInfoBlock)callback];

7.Aegis unLock Setting

Aegis unlocking can be divided into two cases: family member unlocking and visitor unlocking;

Family members include the primary user who added the lock, as well as the users who joined the same family;

Visitors include temporary guest users who share access to the door lock;

/// Unlock device (family member)
/// @param callBack callBack description
[[BosmaLock sharedInstance] unlockDeviceCallBack:(BSBLECommandBlock)callBack];

///  Unlock device (Visitor (guest))
/// @param callBack callBack description
- (void)UnlockDeviceGuestOperationCallBack:(BSBLECommandBlock)callBack

8.Aegis Lockout Setting

/// Lock device  (family member)
/// @param callBack callBack description
[[BosmaLock sharedInstance] lockDeviceCallBack:(BSBLECommandBlock)callBack];

///  Lock device (Visitor (guest))
/// @param callBack callBack description
- (void)LockDeviceGuestOperationCallBack:(BSBLECommandBlock)callBack

**9.Aegis Crash Alerts Setting **

Aegis will sound an alarm when being hit. The impact sensitivity can be set with this interface; the range is from0to100; when the impact alarm needs to be disabled, the sensitivity can be set as255;

/// Update the sensitivity of door lock impact
/// @param value form 0 to 100, the The smaller the value, the more sensitive; value 255 mean disable
/// @param callBack callBack description
[[BosmaLock sharedInstance] updateImpactSensitivity:(CGFloat)value callBack:(BSBLECommandBlock)callBack];

10.Aegis automatically lock when the door is closed

Aegis can be set to lock automatically when the door is closed, or it can be set to lock automatically a period after the door is closed;

/// Update the status and  offset time  of automatic lock,If enabled, when the door is closed, the device is not locked after the timeout, then the device will be automatically locked (*available for lock version greater than or equal to 2.1.4.0)
/// @param isAvailable The status of automatic lock. YES enable, NO disable
/// @param second The timeout  for automatic lock
/// @param callback callback description
[[BosmaLock sharedInstance] updateAutoLockStatus:(BOOL)isAvailable 
    offsetSeconds:(NSInteger)second 
    callBack:(BSBLECommandBlock)callback;

/// Query the status and  offset time of automatic lock (*available for lock version greater than or equal to 2.1.4.0)
/// @param callback callback description
-(void)queryAutoLockStatusAndOffsetTimeCallBack:(BSBLEDLockQueryAutoLockOffsetTimeBlock)callback;

11.Aegis device sound setting

Aegis will have a corresponding feedback sound after some operations (e.g. after locking). This interface allows you to set whether the corresponding sound is turned off or not.

/// Sound settings of the device, such as impact alarm sound, lock sound, etc. (*available for lock version greater than or equal to 2.1.4.0)
/// @param impact The sound of the lock being impact,YES turn on, NO turn off
/// @param block The sound when the lock is blocking,YES turn on, NO turn off
/// @param lock The sound when the lock is lock,YES turn on, NO turn off
/// @param unlock The sound when the lock is unlock,YES turn on, NO turn off
/// @param arming  The sound when arming mode switch,YES turn on, NO turn off
/// @param callback callback description
- (void)updateDeviceSoundParameter:(BOOL)impact 
    blockSound:(BOOL)block 
    lockSound:(BOOL)lock 
    unlockSound:(BOOL)unlock 
    armingSound:(BOOL)arming 
    callback:(BSBLECommandBlock)callback;

/// Query the sound settings of the device (*available for lock version greater than or equal to 2.1.4.0)
/// @param callback callback description
-(void)queryDeviceSoundParameter:(BSBLEDLockQueryDeviceSoundBlock)callback;

12.Aegis remote unlock/ Lock setting

Remote operation requires that Aegis is bound to a Gateway or Sentry device and that the device network is available;

/// Lock/Unlock the device by remote. If your door lock has been bound to a linkage device, then you can use this method, otherwise you cannot use it
/// @param operation Device operation type
/// @param linkageDevicePid The device's pid of the linkage device,For example:Sentry or gateway
/// @param callback result callBack
- (void)remoteOperation:(LOCK_OPERATION_TYPE)operation 
    linkageDevicePid:(nullable NSString*)linkageDevicePid 
        callback:(BSLockRemoteOperationResult)callback;
        
/// Query the status of the device by remote. If your door lock has been bound to a linkage device, then you can use this method, otherwise you cannot use it
/// @param callback status Info
- (void)remoteQueryStatusCallback: (BSLockRemoteLinkResult)callback;

OTA of Aegis

The firmware upgrade for Aegis devices requires a Bluetooth connection to the device. Please ensure that the Aegis device is in Bluetooth communication range of the app during the upgrade process;

The whole firmware upgrade process requires downloading the firmware to the APP. The device will be put into OTA mode by sending commands via Bluetooth, then the APP will connect to the device to confirm the identity, and finally, the firmware upgrade will be completed by sending data via Bluetooth. This process takes about 5 to 8 minutes;

Use the following interface for quick access to the Aegis firmware upgrade function module;

1.1 Check the device version information

Check for available firmware versions

// Check device ota info if need upgread
[[BosmaLock sharedInstance] checkDevicseOTAInfoWithDeviceVersion:@"device current version"] 
                                                        callback:(BSLockOtaInfoStatus)callBack;

1.2 Configure information required for device OTA

// Configure Aegis device data before setup OTA 
[[BosmaLock sharedInstance] configureDeivceOTAWithDevicePid:@"Your Aegis device pid"
                                                deiceMac:@"Your Aegis device MAC"
                                                modelCode: @"Aegis modelCode(010601)"
                                                deviceVersion:@"Aegis current version"];

1.3 Monitor the download progress callback (optional)

// Observe download progress callback
[[BosmaLock sharedInstance] setupOTADownLoadFirmwareCallBack:(BSLockOtaProcessingBlock)callBack];

1.4 Start firmware upgrade, and monitor callbacks for upgrade status

// Start device upgrade processe via bluetooth and Observe status change
[[BosmaLock sharedInstance] setupOTAStartCallBack:(BSLockOtaProcessingBlock)callBack];

2. Discontinue equipment upgrade

​ This method can be used if you need to abort the device upgrade for certain reasons, but it is not recommended to abort the device upgrade operation, as it may cause abnormal firmware information for the device.

// Stop sending ota data (*This method must be used with caution, suspending the device update will cause the device to be abnormal)
[[BosmaLock sharedInstance] setupOTAStop];

Gateway

The Gateway device is networkable while Aegis has no network module, so once Aegis is bound to Gateway, Aegis will be specifically networkable.

Gateway adding

Before adding the Gateway, we need to complete adding the Aegis first. Since the Gateway device has a Bluetooth module embedded in it, we can add the Gateway via Bluetooth. The sample code is shown in BosmaDemo

使用 BosmaLockGateway.h 可以进行Gateway绑定Aegis, 查询Gateway状态信息等操作;

1.Configure Gateway's linked device data
/// Initialize the necessary data
/// @param lockPid The PID of the bound lock
/// @param lockMac The MAC address of the bound lock
[[BosmaLockGateway sharedInstance] configureWithLockPid:@"Your Aegis device pid"
                                    lockMac:@"Your Aegis deviceMac"];
2.Prompt the user to press the Sync key on the Aegis device

Press and hold the unlock button of Aegis until the light flashes. You can refer to the product manual.

3.Prompt the user to press the Sync key on the Gateway device

Press and hold the Gateway Syncbutton until the blue light flashes, and you can refer to the product manual.

4.Query the synchronization status of Gateway and Aegis

You can keep querying by this method to check whether the device is successfully synchronized, and the timeout is recommended to be 120 seconds; when the successful result of device synchronization is returned, proceed to the next operation.

/// Query the synchronization status of the Gateway and the door lock
/// @param callBack Gateway and door lock synchronization status callback
[[BosmaLockGateway sharedInstance] queryGatewaySyncStatusWithCallBack:(BSLockAndGatewaySyncStatus)callBack];
5. Set the networking configuration information for Gateway

When the device is successfully synchronized, you can check the WiFi network information near the device, and then select the appropriate network for configuration.

/// Query the WiFi list near the gateway,This method can be called only after the Gateway is sync to the Aegis lock
/// @param callBack Query Gateway device information callback
- (void)queryGatewayNearlyWiFiListCallBack:(BSQueryGatewayNearWifiListResult)callBack;

/// Setup Gateway's WiFi configuration,This method can be called only after the Gateway is sync to the Aegis lock
/// @param wifiName wifi ssid (only supports 2.4Ghz)
/// @param wifiPasswrod wifi password
/// @param callback Callback of Gateway WiFi information settings
- (void)setupGatewayWiFiInformation:(NSString*)wifiName wifiPassword:(NSString*)wifiPasswrod callback:(BSGatewayWiFiSettingBlock)callback;

/// abort setup Gateway wifi
- (void)setupGatewayWiFiInformationAbort;

6. Complete the Gateway registration activation

The Gateway MacAddress of the device can be obtained by querying the interface information of the synchronization status.

/// Register and activate the Gateway device, when the Gateway network is successfully configured
/// @param gatewayMAC The MAC address of the Gateway, you will get this MAC address when you complete the synchronization between Lock and Gateway
/// @param block Registered device callback
[[BosmaLockGateway sharedInstance] registerGateway:(NSString *) gatewayMAC block:(BSRegisterGatewayBlock) block];

Management of Gateway

Because the Gateway is used for serving other devices, you must configure the data of the Gateway's linked devices and query the status first before using the Gateway, as shown in the following flowchart, with sample code in BosmaDemo

1.Query Gateway's distribution network information
/// Query gateway current wifi ssid info,This method can be called only after the Gateway is bound to the door lock and success setup wifi
/// @param block block description
[[BosmaLockGateway sharedInstance] queryGatewayCurrentWifiNameCallback:(BSBLEGatewayWiFiSSIDBlock)block];
2.Remove Gateway
/// Remove / unbind gateway
/// @param callback callback description
 [[BosmaLockGateway sharedInstance] removeGatewayCallback:(BSRemoveGatewayBlock)callback];
3.Set Gateway to enable automatic upgrade

​ When the automatic update function is enabled, the device will be automatically updated to the latest firmware version once there is an available firmware update version and the device is connected to the network.

/// Set whether to enable the automatic upgrade function of the gateway
/// @param available available description
/// @param callBack callBack description
 [[BosmaLockGateway sharedInstance] configureGatwayAutoUpgradeAvailable:(BOOL)available callBack:(BSBLECommandBlock)callBack];

OTA of Gateway

1.Check the device version information
/// Check device info if need upgread
/// @param deviceVersion deviceVersion description
/// @param callback callback description
 [[BosmaLockGateway sharedInstance] checkDeviceOTAInfoWithDeviceVersion:(NSString*)deviceVersion callback:(BSGatewayOtaInfoStatus)callback];
2.Configuring OTA data for Gateway
/// Configure keypad data before enter keypad ota or other setup
/// @param gatewayMac gatwayMac description
/// @param deviceVersion deviceVersion description
 [[BosmaLockGateway sharedInstance] configureGatewayOTAWithGatewayMac:(NSString*)gatewayMac 
        deviceVersion:(NSString*)deviceVersion];
3.Notify the device of the OTA process

Send command to notify the device to enter OTA process, and monitor process status change callback.

/// Start keypa ota progress
/// @param callback callback description
  [[BosmaLockGateway sharedInstance] keypadOtaStartCallback:(BSGatewayOtaProcessingBlock)callback];

Keypad

The Keypad is a user input device where the user can enter a password and fingerprint ID in advance, so once the Aegis is bound to the Keypad, the user can use the password or fingerprint ID to unlock the device, etc.

Add Keypad

The keypad is a device that serves Aegis, so before binding the Keypad, we need to bind Aegis to Gateway and establish the binding relationship between Aegis and Gateway. The process is as follows, see BosmaDemo for sample code.

1.Search device

Press and hold the Sync key of the Keypad device. When the device's keyboard indicator flashes, it means that the device's Bluetooth radio search is available. Then use theBosmaBluetoothManager.h use the system's Bluetooth service to search for the Keypad device, and get theCBPeripheralinstance of the Keypad device. Use this instance and the associated device's data initialization ofBosmaLockKeypad tool class.

2.Bind device

Keypad is a linked device with Aegis and Gateway, so to bind Keypad, you need to configure the associated data of Aegis and Gateway;

/// Register and activate the Kepad device after connecting to the Keypad via Bluetooth
/// @param peripheral Keypad peripheral that you search and connected
/// @param lockMac Prepare to bind the lock device MacAddress
/// @param lockPid Prepare to bind the lock device pid
/// @param gatewayMac Prepare to bind the gateway device MacAddress
/// @param block Callback for activation of device registration
[[BosmaLockKeypad sharedInstance] registerKeypadWithPeripheral:@"Searched Keypad peripheral" 
        bindLockMac:@"bind lock macAddress"
        bindLockPid:@"bind lock pid"
        gatewayMac:@"bind gateway macAddress"
        registerBlock:(RegisterKeypadBlock)block];

Management of Keypad

Before using Keypad, you need to complete the configuration data of the device. The specific process is shown in the following diagram, and the sample code is shown in BosmaDemo

Configure Keypad Device Data

/// Before using Keypad, you must configure Keypad
/// @param keypadMac The MAC address of the keypad
/// @param lockPid The PID of the lock
/// @param lockMac The MAC address of the lock
/// @param gatewayMac The MAC address of the Gateway
[[BosmaLockKeypad sharedInstance] configureKeypadWithKeypadMac:@"Your Keypad MacAddress" 
                lockPid:@"Your Aegis device pid" 
                lockMac:@"Your Aegis device MacAddress" 
                gatewayMac:@"Your gateway device MacAddress"];
1、Remove Keypad

For security reasons, the Keypad can only be deleted by entering the correct verification code on the device keyboard. Firstly, the interface gets the verification code for deleting the Keypad, then it calls a callback method that monitors whether the verification code was entered correctly; during this period, the deletion process can also be aborted;;

/// Remove keypad Process 1 : request Match code
/// @param callback callback description
[[BosmaLockGateway sharedInstance] keypadRemoveDevieRequestMatchCode:(KeypadUnbindMatchCodeInfoSuccess)callback];


/// Remove keypad Process 2 : request result that match code input Correct or not
/// @param callback callback description
[[BosmaLockGateway sharedInstance]keypadRemoveDevieQueryResultCallback:(KeypadOpeartionCallback)callback];


/// Cancel query remove device timer
[[BosmaLockGateway sharedInstance] keypadRemoveDevieQueryResultAbort];

In some cases, such as when the device is abnormal, this method can be called to directly delete the binding of the keypad.

 /// Forcibly delete device
/// @param code Verification code (no need to send parameters if there have no verification code)
/// @param callback callback description
- (void)KeypadEnforceRemoveWithVerifyCode:(NSString *)code callback:(KeypadRemoveDeviceCallback)callback;

2.Add common password

The recommended length of the common password is 6 to 10 digits, and the common password does not expire.

/// Create normal password to keypad with params
/// @param password passwordText description
/// @param name passwordName description
/// @param callback callback description
 [[BosmaLockKeypad sharedInstance] createNormalPassword:(NSString*)password 
    name:(NSString*)name 
    callback:(KeypadOpeartionCallback)callback];
 
3.Add a temporary password

The recommended length of the temporary password is 6 digits, and the temporary password can only be valid for a set period; the maximum valid time interval is 7 days;

/// Create temp password to keypad device with params
/// @param password passwordText description
/// @param name passwordName description
/// @param startTimeStamp startTimeStamp description
/// @param endTimeStamp endTimeStamp description
/// @param totalUsed validTotal description(optional, default is 255)
/// @param callback callback description
 [[BosmaLockKeypad sharedInstance] createTempPassword:(NSString*)password  
        name:(NSString*)name 
        startTimeStamp:(NSString*)startTimeStamp 
        endTimeStamp:(NSString*)endTimeStamp 
        totalUsed:(NSInteger)totalUsed 
        callback:(KeypadOpeartionCallback)callback];
 
4.Query the list of device password names表

There are three ways to query the device's password list: common password, temporary password, and fingerprint ID;

/// Query keyapd passwrod list
/// @param dataType dataType : password / temp password / fingerprint
/// @param successBlock successBlock description
 [[BosmaLockKeypad sharedInstance] queryDeviceIdentityData:(BSKeypadDataType)dataType success:(KeypadQueryPasswordListBlock)successBlock];
 
5.Modify device password name
/// Modify keypad password/ temp password / fingerprint nickName or opration type
/// @param dataPid dataPid description
/// @param type operationType description
/// @param nickName nickName description
/// @param callback callback description
  [[BosmaLockKeypad sharedInstance] updateDeviceIdentityDataWithPid:(NSString*)dataPid 
    type:(BSKeypadDataEditType)type 
    nickName:(NSString*)nickName  
    callback:(KeypadOpeartionCallback)callback];
 
6.Fingerprint entry

Send a command to the device to put the device into fingerprint recording mode

/// Setup keypad start collect fingerprint mode
/// @param callback callback description
  [[BosmaLockKeypad sharedInstance] startCollectFingerprintCallback:(KeypadOpeartionCallback)callback];
 

Progress callback for querying fingerprint entry

According to the status of the progress callback, it can be divided into:

  1. Start recording fingerprint; 2. Prompt user to press finger; 3. Prompt user to lift finger; 4. Fingerprint already exists; 5. The fingerprint is successfully entered;

Generally, to complete a fingerprint ID entry, you need to press and lift the fingerprint 3 times each;
Only one fingerprint ID can be entered for the same finger;

/// Query keypad collect fingerprint progress
/// @param progressCallback progressCallback description
/// @param resultCallback resultCallback description
   [[BosmaLockKeypad sharedInstance]  queryFingerprintCollectProgressCallback:(KeypadQueryFingerprintProgressBlock)progressCallback resultCallBack:(KeypadQueryFingerprintCreateSuccess)resultCallback];
 

Abort fingerprint entry process (optional)

/// Setup keypad stop collect fingerprint mode
/// @param callback callback description
   [[BosmaLockKeypad sharedInstance] stopCollectFingerprintCallback:(KeypadOpeartionCallback)callback];
 

Set the default prefix name for the fingerprint (optional)

/// configure keypad fingerprint default name prefix
/// @param namePrefix name prefix default is "keypadFP"-1
 [[BosmaLockKeypad sharedInstance] configureCollectFingerprintDefaultNamePrefix:(NSString*)namePrefix];
 
7.Device prompt sound setting

There are feedback prompt sounds when the device is operated (such as pressing the fingerprint or pressing the key prompt). This interface can be set to turn off or on the device prompt sound.

/// Setup keypad device sound is available (muted)
/// @param isSound isAvailable description
/// @param callback callback description
- (void)updateDeviceSoundStatus:(BOOL)isSound callback:(KeypadOpeartionCallback)callback;
 
/// Query keypad device sound is available (muted)
/// @param callback callback description
- (void)queryDeviceSoundStatusCallback:(KeypadQueryDeviceIsMutedCallback)callback;
 
8.Set whether the fingerprint is used for unlocking.
/// Setup keypad fingerprint use for only Unlock or other function
/// @param available true mean fingerprint only use for unlock
/// @param callback callback description
- (void)updateKeypadFingerprintOnlyForUnlockAvailable:(BOOL)available callback:(KeypadOpeartionCallback)callback;
 
/// Query keypad fingerprint use for only Unlock or other function
/// @param callback callback description
- (void)queryDeviceFingerprintUseForCallback:(KeypadQueryFingerprintUseForCallback)callback;
9.Set the function extension of the home button of the device
/// Setup keypad home key function
/// @param switchType Type of security mode to switch
/// @param callback callback description
- (void)updateHomeKeySwitch:(BSKeypadHomeKeySwitchType )switchType callback:(KeypadOpeartionCallback)callback;
 
/// Query keypad home key funtion
/// @param successBlock successBlock description
- (void)queryHomeKeySwitch:(KeypadQueryHomeKeySuccess)successBlock;

OTA for Keypad

The OTA of the device requires the user to enter the OTA operation code on the Keypad to ensure that the user is near the Keypad. The specific process is as follows, and the sample code is shown in BosmaDemo

1.Query device OTA information
/// Check device info if need upgrade
/// @param deviceVersion device Version description
/// @param callback callback description
 [[BosmaLockKeypad sharedInstance]  checkDeviceOTAInfoWithDeviceVersion:(NSString*)deviceVersion callback:(keypadOtaInfoStatus)callback];
2. Configure correlation data for Gateway's OTA
/// Configure keypad data before enter keypad ota
/// @param keypadMac keypadMac description
/// @param lockPid lockPid description
/// @param lockMac lockMac description
/// @param gatewayMac gatewayMac description
/// @param deviceVersion device Version description
  [[BosmaLockKeypad sharedInstance] configureKeypadOTAWithKeypadMac:@"Your Keypad MacAddress" 
        lockPid:@"Your Aegis device pid" 
        lockMac:@"Your Aegis device MacAddress" 
        gatewayMac: @"Your gateway device MacAddress"
        deviceVersion:@"Your gateway current MacAddress"];
3. Set the OTA verification code

For security reasons, updating the Keypad firmware requires entering the correct verification code on the device keypad to enter Keypad firmware update mode;

The firmware update of Keypad is realized by sending data to and from the keypad through the APP Bluetooth, so please make sure the APP devices are close to each other when updating the firmware;

Firstly, get the OTA verification code.

/// Setup keypad enter upgarde mode Process 1 : : request Match code
/// @param firmwareVersion firmwareVersion can be found form [- checkDeviceOTAInfoCallback:]
/// @param firmwareSize firmwareSize can be found form [- checkDeviceOTAInfoCallback:]
/// @param callback callback description
   [[BosmaLockKeypad sharedInstance] KeypadEnterUpgradeModeWithFirmwareVersion:(NSString*)firmwareVersion firmwareSize:(NSString*)firmwareSize  matchCode:(KeypadSendEnterOTAModelCallback)callback];

Then monitor if the correct OTA verification code is entered on the keypad keyboard.

/// Setup keypad enter upgarde mode Process 2 : request result that match code input correct or not
/// @param callback callback description
    [[BosmaLockKeypad sharedInstance] KeypadEnterUpgradeModeQueryResultCallback:(KeypadOpeartionCallback)callback];
4. Monitor device download progress callback (optional)
/// Progress that download data to app
/// @param callBack callBack description
 [[BosmaLockKeypad sharedInstance] KeypadDownLoadFirmwareCallBack:(KeypadDownloadProcessingBlock)callBack;
5. The device starts the OTA firmware update process and monitors the update progress callback interface
/// Progress that download data to app
/// @param callBack callBack description
 [[BosmaLockKeypad sharedInstance] KeypadDownLoadFirmwareCallBack:(KeypadDownloadProcessingBlock)callBack;
6. Query whether the keypad is in firmware abnormal mode (optional)

Disconnecting the device during a firmware upgrade, or aborting the firmware OTA, may result in abnormal device firmware data;

If the device is in an abnormal state and cannot broadcast Bluetooth information normally, this method can be used to check whether the device is in an abnormal state;

If the device is checked to be in an abnormal state, you can upgrade the device firmware directly without entering the verification code;

/// Query whether the device is in an unavailable state, through the Bluetooth channel
/// @param callback callback description
  [[BosmaLockKeypad sharedInstance]  checkDeviceIsUnderDisableStatusInfoCallback:(keypadIsUnderDisableStatus)callback;

Updated at November 17th, 2022