Skip to content

Commit

Permalink
Merge pull request #555 from NordicSemiconductor/feature/sar
Browse files Browse the repository at this point in the history
New SAR implementation
  • Loading branch information
philips77 authored Oct 10, 2023
2 parents 3c6cde5 + c61bf6e commit f122043
Show file tree
Hide file tree
Showing 22 changed files with 2,299 additions and 304 deletions.
40 changes: 40 additions & 0 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

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

64 changes: 57 additions & 7 deletions Example/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,68 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Create the main MeshNetworkManager instance and customize
// configuration values.
meshNetworkManager = MeshNetworkManager()
meshNetworkManager.networkParameters = .custom { builder in
builder.acknowledgmentTimerInterval = 0.150
builder.transmissionTimerInterval = 0.600
builder.incompleteMessageTimeout = 10.0
builder.retransmissionLimit = 2
builder.acknowledgmentMessageInterval = 4.2

// Configure network parameters using one of the following examples:
/*
// Default configuration.
meshNetworkManager.networkParameters = .default
*/

// Verbose configuration.
meshNetworkManager.networkParameters = .basic { parameters in
parameters.setDefaultTtl(5)
// Configure SAR Receiver properties
parameters.discardIncompleteSegmentedMessages(after: 10.0)
parameters.transmitSegmentAcknowledgmentMessage(
usingSegmentReceptionInterval: 0.06,
multipliedByMinimumDelayIncrement: 2.5)
parameters.retransmitSegmentAcknowledgmentMessages(
exactly: 1, timesWhenNumberOfSegmentsIsGreaterThan: 3)
// Configure SAR Transmitter properties
parameters.transmitSegments(withInterval: 0.06)
parameters.retransmitUnacknowledgedSegmentsToUnicastAddress(
atMost: 2, timesAndWithoutProgress: 2,
timesWithRetransmissionInterval: 0.200, andIncrement: 2.5)
parameters.retransmitAllSegmentsToGroupAddress(exactly: 3, timesWithInterval: 0.250)

// Note: The values below are different from the default ones.

// Configure message configuration
parameters.retransmitAcknowledgedMessage(after: 4.2)
// As the interval has been increased, the timeout can be adjusted.
// The acknowledged message will be repeated after 4.2 seconds,
// 12.6 seconds (4.2 + 4.2 * 2), and 29.4 seconds (4.2 + 4.2 * 2 + 4.2 * 4).
// Then, leave 10 seconds for until the incomplete message times out.
parameters.discardAcknowledgedMessages(after: 40.0)
}

/*
// Advanced configuration.
meshNetworkManager.networkParameters = .advanced { parameters in
parameters.defaultTtl = 5
// Configure SAR Receiver properties
parameters.sarDiscardTimeout = 0b0001
parameters.sarAcknowledgmentDelayIncrement = 0b001
parameters.sarReceiverSegmentIntervalStep = 0b101
parameters.sarSegmentsThreshold = 0b00011
parameters.sarAcknowledgmentRetransmissionsCount = 0b00
// Configure SAR Transmitter properties
parameters.sarSegmentIntervalStep = 0b0101
parameters.sarUnicastRetransmissionsCount = 0b0111
parameters.sarUnicastRetransmissionsWithoutProgressCount = 0b0010
parameters.sarUnicastRetransmissionsIntervalStep = 0b0111
parameters.sarUnicastRetransmissionsIntervalIncrement = 0b0001
parameters.sarMulticastRetransmissionsCount = 0b0010
parameters.sarMulticastRetransmissionsIntervalStep = 0b1001
// Configure acknowledged message timeouts
parameters.acknowledgmentMessageInterval = 4.2
// As the interval has been increased, the timeout can be adjusted.
// The acknowledged message will be repeated after 4.2 seconds,
// 12.6 seconds (4.2 + 4.2 * 2), and 29.4 seconds (4.2 + 4.2 * 2 + 4.2 * 4).
// Then, leave 10 seconds for until the incomplete message times out.
builder.acknowledgmentMessageTimeout = 40.0
parameters.acknowledgmentMessageTimeout = 40.0
}
*/
meshNetworkManager.logger = self

// Try loading the saved configuration.
Expand Down
4 changes: 2 additions & 2 deletions nRFMeshProvision/Documentation.docc/MeshNetworkManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ Use it to create, load or import a Bluetooth mesh network and send messages.
- ``registerCallback(forMessagesFrom:to:callback:)-7axud``
- ``unregisterCallback(forMessagesWithOpCode:from:)-2pj32``
- ``unregisterCallback(forMessagesWithOpCode:from:)-9rbl0``
- ``unregisterCallback(forMessagesWithType:from:)-2cij2``
- ``unregisterCallback(forMessagesWithType:from:)-7mdko``
- ``unregisterCallback(forMessagesWithType:from:)-15wz4``
- ``unregisterCallback(forMessagesWithType:from:)-1g3i0``

### Bearer Callbacks

Expand Down
18 changes: 10 additions & 8 deletions nRFMeshProvision/Documentation.docc/Provisioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ The provisioner, in a secure way, assigns a Unicast Address and sends the Networ
Knowing the key, the new device, now called a Node, can exchange mesh messages with other nodes.

> To provision a new device, the provisioner does not need to have an address assigned. Having a
Unicast Address makes the provisioner a node.
Unicast Address makes the provisioner a configuration manager node.

A provisioner with a Unicast Address assigned may also configure nodes after they have been
provisioned. Configuration messages are sent between *Configuration Client* model on the provisioner
A configuration manager may configure nodes after they have been provisioned.
Configuration messages are sent between *Configuration Client* model on the manager
and *Configuration Server* model on the target device, and, on the Upper Transport layer, are encrypted
using the node's Device Key, generated during provisioning.

Expand Down Expand Up @@ -40,10 +40,12 @@ func centralManager(_ central: CBCentralManager,
}
```

> Important: Provisioning of new devices using the current version of the nRF Mesh library
supports only with the use of GATT PB Bearer, i.e. remote provisioning is not supported.
New devices must support GATT PB Bearer in order to be provisioned using a mobile device.
This also applies to the nRF Mesh library for Android.
> Important: nRF Mesh library supports PB GATT Bearer and PB Remote Bearer.
PB Adv Bearer is not supported.

To provision a device which does not support PB GATT Bearer a ``PBRemoteBearer`` must be used.
A node supporting *Remote Provisioning Server* model must be provisioned and in range of the
unprovisioned device. All provisioning messages will be sent via that node.

Provisioning process is initiated by calling ``ProvisioningManager/identify(andAttractFor:)``
```swift
Expand All @@ -55,7 +57,7 @@ followed by ``ProvisioningManager/provision(usingAlgorithm:publicKey:authenticat
provisioningManager.address = ... // Defaults to the next available address.
provisioningManager.networkKey = ... // Defaults to the Primary Network Key.
// Start:
try provisioningManager.provision(usingAlgorithm: .fipsP256EllipticCurve,
try provisioningManager.provision(usingAlgorithm: .BTM_ECDH_P256_HMAC_SHA256_AES_CCM,
publicKey: ...,
authenticationMethod: ...)
```
Expand Down
Loading

0 comments on commit f122043

Please sign in to comment.