Skip to content

Commit

Permalink
Merge pull request #328 from NordicSemiconductor/develop
Browse files Browse the repository at this point in the history
Version 4.5.1
  • Loading branch information
philips77 authored Aug 21, 2019
2 parents 394c41f + bd20734 commit f6896ee
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 38 deletions.
8 changes: 1 addition & 7 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Example/iOSDFULibrary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
52237250202B117700068EE4 /* CustomTestSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5223724F202B117700068EE4 /* CustomTestSet.swift */; };
5223729B202B275F00068EE4 /* Firmwares in Resources */ = {isa = PBXBuildFile; fileRef = 5223729A202B275F00068EE4 /* Firmwares */; };
5223729D2036DDFC00068EE4 /* nRF52840TestSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5223729C2036DDFC00068EE4 /* nRF52840TestSet.swift */; };
52A9C167230D633A0036792A /* changelog.md in Resources */ = {isa = PBXBuildFile; fileRef = 52A9C166230D633A0036792A /* changelog.md */; };
52A9C169230D63410036792A /* documentation.md in Resources */ = {isa = PBXBuildFile; fileRef = 52A9C168230D63410036792A /* documentation.md */; };
52F6AD6222B2429300F0D7DF /* TestFirmwares in Resources */ = {isa = PBXBuildFile; fileRef = 52F6AD6122B2429300F0D7DF /* TestFirmwares */; };
52FB0B022220168D00B1E575 /* PeripheralCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FB0B012220168D00B1E575 /* PeripheralCell.swift */; };
52FB0B04222019C700B1E575 /* MainNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52FB0B03222019C700B1E575 /* MainNavigationViewController.swift */; };
Expand Down Expand Up @@ -62,6 +64,8 @@
5223724F202B117700068EE4 /* CustomTestSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTestSet.swift; sourceTree = "<group>"; };
5223729A202B275F00068EE4 /* Firmwares */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Firmwares; sourceTree = "<group>"; };
5223729C2036DDFC00068EE4 /* nRF52840TestSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = nRF52840TestSet.swift; sourceTree = "<group>"; };
52A9C166230D633A0036792A /* changelog.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = changelog.md; path = ../changelog.md; sourceTree = "<group>"; };
52A9C168230D63410036792A /* documentation.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = documentation.md; path = ../documentation.md; sourceTree = "<group>"; };
52F6AD6122B2429300F0D7DF /* TestFirmwares */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TestFirmwares; sourceTree = "<group>"; };
52FB0B012220168D00B1E575 /* PeripheralCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeripheralCell.swift; sourceTree = "<group>"; };
52FB0B03222019C700B1E575 /* MainNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainNavigationViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -229,6 +233,8 @@
children = (
3B0557890E61EFF388A8734B /* iOSDFULibrary.podspec */,
8EE39CA79039E8FFBDA0C9D3 /* README.md */,
52A9C166230D633A0036792A /* changelog.md */,
52A9C168230D63410036792A /* documentation.md */,
DAEFE092DC94AFC6C8316559 /* LICENSE */,
);
name = "Podspec Metadata";
Expand Down Expand Up @@ -389,8 +395,10 @@
buildActionMask = 2147483647;
files = (
52F6AD6222B2429300F0D7DF /* TestFirmwares in Resources */,
52A9C169230D63410036792A /* documentation.md in Resources */,
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */,
52FB0B0622201A4A00B1E575 /* LaunchScreen.storyboard in Resources */,
52A9C167230D633A0036792A /* changelog.md in Resources */,
5223729B202B275F00068EE4 /* Firmwares in Resources */,
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1030"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2016, Nordic Semiconductor
Copyright (c) 2019, Nordic Semiconductor
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
### Changelog
- **4.5.1**
- Bugfix: Fixed an issue where DFU could not be started on iOS 13 (#322).

- **4.5.0**
- Improvement: Hex2Bin converter rewritten to Swift 5.
- Library released in Swift Package Manager (SPM).
Expand Down
2 changes: 1 addition & 1 deletion iOSDFULibrary.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "iOSDFULibrary"
s.version = "4.5.0"
s.version = "4.5.1"
s.summary = "This repository contains a tested library for iOS 9+ devices to perform Device Firmware Update on the nRF5x devices"
s.description = <<-DESC
The nRF5x Series chips are flash-based SoCs, and as such they represent the most flexible solution available. A key feature of the nRF5x Series and their associated software architecture and S-Series SoftDevices is the possibility for Over-The-Air Device Firmware Upgrade (OTA-DFU). See Figure 1. OTA-DFU allows firmware upgrades to be issued and downloaded to products in the field via the cloud and so enables OEMs to fix bugs and introduce new features to products that are already out on the market. This brings added security and flexibility to product development when using the nRF5x Series SoCs.
Expand Down
20 changes: 7 additions & 13 deletions iOSDFULibrary/Classes/Implementation/DFUServiceInitiator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import CoreBluetooth

//MARK: - Internal variables

internal let centralManager : CBCentralManager
internal var target : CBPeripheral!
internal var file : DFUFirmware?
internal let centralManager : CBCentralManager
internal var targetIdentifier : UUID!
internal var file : DFUFirmware?

internal var queue : DispatchQueue
internal var delegateQueue : DispatchQueue
Expand Down Expand Up @@ -244,7 +244,7 @@ import CoreBluetooth
self.centralManager = centralManager
// Just to be sure that manager is not scanning
self.centralManager.stopScan()
self.target = target
self.targetIdentifier = target.identifier
// Default peripheral selector will choose the service UUID as a filter
self.peripheralSelector = DFUPeripheralSelector()
// Default UUID helper with standard set of UUIDs
Expand Down Expand Up @@ -329,7 +329,7 @@ import CoreBluetooth
}

// Make sure the target was set by the deprecated init.
guard let _ = target else {
guard let _ = targetIdentifier else {
delegate?.dfuError(.failedToConnect, didOccurWithMessage: "Target not specified: use start(target) instead")
return nil
}
Expand Down Expand Up @@ -394,18 +394,12 @@ import CoreBluetooth
*/
@objc public func start(targetWithIdentifier uuid: UUID) -> DFUServiceController? {
// The firmware file must be specified before calling `start(...)`.
if file == nil {
guard let _ = file else {
delegate?.dfuError(.fileNotSpecified, didOccurWithMessage: "Firmware not specified")
return nil
}

// As the given peripheral was obtained using a different central manager,
// its new instance must be obtained from the new manager.
guard let peripheral = self.centralManager.retrievePeripherals(withIdentifiers: [uuid]).first else {
delegate?.dfuError(.bluetoothDisabled, didOccurWithMessage: "Could not obtain peripheral instance")
return nil
}
target = peripheral
targetIdentifier = uuid

let controller = DFUServiceController()
let selector = DFUServiceSelector(initiator: self, controller: controller)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ internal protocol BaseDFUPeripheralAPI : class, DFUController {
internal class BaseDFUPeripheral<TD : BasePeripheralDelegate> : NSObject, BaseDFUPeripheralAPI, CBPeripheralDelegate, CBCentralManagerDelegate {
/// Bluetooth Central Manager used to scan for the peripheral.
internal let centralManager: CBCentralManager
internal let targetIdentifier: UUID
internal let queue: DispatchQueue
/// The DFU Target peripheral.
internal var peripheral: CBPeripheral?
Expand Down Expand Up @@ -89,14 +90,13 @@ internal class BaseDFUPeripheral<TD : BasePeripheralDelegate> : NSObject, BaseDF

init(_ initiator: DFUServiceInitiator, _ logger: LoggerHelper) {
self.centralManager = initiator.centralManager
self.targetIdentifier = initiator.targetIdentifier
self.queue = initiator.queue
self.logger = logger
self.experimentalButtonlessServiceInSecureDfuEnabled = initiator.enableUnsafeExperimentalButtonlessServiceInSecureDfu
self.uuidHelper = initiator.uuidHelper

super.init()
// Set the initial peripheral. It may be changed later (flashing App fw after first flashing SD/BL)
self.peripheral = initiator.target
}

// MARK: - Base DFU Peripheral API
Expand All @@ -109,14 +109,20 @@ internal class BaseDFUPeripheral<TD : BasePeripheralDelegate> : NSObject, BaseDF
// Central manager not ready. Wait for poweredOn state.
return
}
// Set the initial peripheral. It may be changed later (flashing App fw after first flashing SD/BL).
guard let peripheral = centralManager.retrievePeripherals(withIdentifiers: [targetIdentifier]).first else {
delegate?.error(.bluetoothDisabled, didOccurWithMessage: "Could not obtain peripheral instance")
return
}
self.peripheral = peripheral

if peripheral!.state != .connected {
if peripheral.state != .connected {
connect()
} else {
let name = peripheral!.name ?? "Unknown device"
let name = peripheral.name ?? "Unknown device"
logger.i("Connected to \(name)")

let dfuService = findDfuService(in: peripheral!.services)
let dfuService = findDfuService(in: peripheral.services)
if dfuService == nil {
// DFU service has not been found, but it doesn't matter it's not there.
// Perhaps the user's application didn't discover it. Let's discover DFU services.
Expand Down

0 comments on commit f6896ee

Please sign in to comment.