Skip to content

Commit

Permalink
Merge pull request #334 from NordicSemiconductor/develop
Browse files Browse the repository at this point in the history
Version 3.1.0, build 4
  • Loading branch information
philips77 authored Mar 1, 2021
2 parents 3eff287 + 6dfbf27 commit 5d39ed5
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Example/nRFMeshProvision.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CODE_SIGN_ENTITLEMENTS = nRFMeshProvision_Example.entitlements;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = P3R8YQEV4L;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = nRFMeshProvision/Info.plist;
Expand All @@ -1383,7 +1383,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CODE_SIGN_ENTITLEMENTS = nRFMeshProvision_Example.entitlements;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = P3R8YQEV4L;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = nRFMeshProvision/Info.plist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ class GenericDefaultTransitionTimeServerDelegate: ModelDelegate {
}
defaultTransitionTime = request.transitionTime
defaults.set(defaultTransitionTime.interval, forKey: "defaultTransitionTime")
fallthrough

case is GenericDefaultTransitionTimeGet:
return GenericDefaultTransitionTimeStatus(transitionTime: defaultTransitionTime)
break

default:
fatalError("Not possible")
}

// Reply with GenericDefaultTransitionTimeStatus.
return GenericDefaultTransitionTimeStatus(transitionTime: defaultTransitionTime)
}

func model(_ model: Model, didReceiveUnacknowledgedMessage message: MeshMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ class GenericLevelServerDelegate: StoredWithSceneModelDelegate {
delay: delay,
duration: transitionTime.interval)

case is GenericLevelGet:
break

default:
fatalError("Not possible")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ class GenericOnOffServerDelegate: StoredWithSceneModelDelegate {
delay: delay,
duration: transitionTime.interval)

case is GenericOnOffGet:
break

default:
fatalError("Not possible")
}
Expand Down
17 changes: 11 additions & 6 deletions Example/nRFMeshProvision/Mesh Network/SceneServerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,20 @@ class SceneServerDelegate: SceneServerModelDelegate {
transitionTime: transitionTime,
delay: delay)
}
fallthrough

case is SceneGet:
break

default:
if let (targetScene, complete) = targetScene {
let remainingTime = TransitionTime(complete.timeIntervalSinceNow)
return SceneStatus(report: targetScene, remainingTime: remainingTime)
}
return SceneStatus(report: currentScene)
fatalError("Not possible")
}

// Reply with SceneStatus.
if let (targetScene, complete) = targetScene {
let remainingTime = TransitionTime(complete.timeIntervalSinceNow)
return SceneStatus(report: targetScene, remainingTime: remainingTime)
}
return SceneStatus(report: currentScene)
}

func model(_ model: Model, didReceiveUnacknowledgedMessage message: MeshMessage,
Expand Down
5 changes: 3 additions & 2 deletions Example/nRFMeshProvision/Utils/UIViewController+Alert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ extension UIViewController {
textField.autocapitalizationType = .words
break
case .unicastAddress, .groupAddress,
.unicastAddressRequired, .groupAddressRequired:
.unicastAddressRequired, .groupAddressRequired,
.scene, .sceneRequired:
textField.autocapitalizationType = .allCharacters
case .ttlRequired, .scene, .sceneRequired:
case .ttlRequired:
textField.keyboardType = .numberPad
default:
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ class ScannerTableViewController: UITableViewController {
selectedDevice = discoveredPeripherals[indexPath.row].device

alert = UIAlertController(title: "Status", message: "Connecting...", preferredStyle: .alert)
alert!.addAction(UIAlertAction(title: "Cancel", style: .cancel) { action in
alert!.addAction(UIAlertAction(title: "Cancel", style: .cancel) { [weak self, bearer] action in
action.isEnabled = false
self.alert!.title = "Aborting"
self.alert!.message = "Cancelling connection..."
self?.alert?.title = "Aborting"
self?.alert?.message = "Cancelling connection..."
bearer.close()
})
present(alert!, animated: true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class EditKeyViewController: UITableViewController {
didSet {
if let key = key {
newKey = key.key
isApplicationKey = key is ApplicationKey
}
isApplicationKey = key is ApplicationKey
}
}
/// A flag containing `true` if the key is an Application Key, or `false`
Expand Down Expand Up @@ -306,12 +306,24 @@ private extension EditKeyViewController {
// Those 2 must be saved before setting the key.
let index = newBoundNetworkKeyIndex
let adding = isNewKey

// It is not possible to modify the key without doing Key Refresh Procedure.
// Instead, we'll remove the old key and create a new one with the same key
// Index and new data.
let keyIndex = key?.index
if let oldKey = key, oldKey.key != newKey {
if let key = oldKey as? ApplicationKey {
try! network.remove(applicationKey: key, force: true)
} else if let key = oldKey as? NetworkKey {
try! network.remove(networkKey: key, force: true)
}
key = nil
}
// If a new key was added, or the old one removed, create new keys.
if key == nil {
if isApplicationKey {
key = try! network.add(applicationKey: newKey, name: newName)
key = try! network.add(applicationKey: newKey, withIndex: keyIndex, name: newName)
} else {
key = try! network.add(networkKey: newKey, name: newName)
key = try! network.add(networkKey: newKey, withIndex: keyIndex, name: newName)
}
}
key!.name = newName
Expand Down

0 comments on commit 5d39ed5

Please sign in to comment.