bluejay icon indicating copy to clipboard operation
bluejay copied to clipboard

Successful Write but Disconnection on Data Retrieval

Open pksa opened this issue 1 year ago • 0 comments
trafficstars

Summary: Device: Buerer BM96 The connection is lost when attempting to write to the characteristic.

`let writeHeartRateCharacteristic = CharacteristicIdentifier( uuid: BM96CharacteristicUUID.heartServiceUUID.rawValue, service: ServiceIdentifier(uuid: BM96CharacteristicUUID.customServiceUUID.rawValue) )

private func writeGetAllHeartUser1Measurements() {
    let OP_CODE_REPORT_STORED_RECORDS: UInt8 = 0x02
    let OPERATOR_SENDING_RECORD_1: UInt8 = 0x00
    let OPERATOR_SENDING_RECORD_2: UInt8 = 0x00
    
    let command = [OP_CODE_REPORT_STORED_RECORDS, OPERATOR_SENDING_RECORD_1, OPERATOR_SENDING_RECORD_2]
    
    bluejay.write(to: writeHeartRateCharacteristic, value: Data(command), type: .withoutResponse) { result in
        switch result {
        case .success:
            Logger.shared.log("Write to sensor location is successful.")
            self.listenHeartRateData()
            
        case .failure(let error):
            print("Failed to write sensor location with error: \(error.localizedDescription)")
        }
    }
}`

Actual Result: Write to sensor location is successful. failure(Bluejay.BluejayError.notConnected) Failed to listen to heart rate with error: Not connected to a peripheral

Expected Result: Retrieve data upon successful write. Also, do not disconnect device.

Device, Build, OS:

pksa avatar Mar 08 '24 13:03 pksa