Skip to content

Commit

Permalink
Merge pull request JuulLabs-OSS#17 from NordicSemiconductor/develop
Browse files Browse the repository at this point in the history
Merge 'Develop' branch into 'master'
  • Loading branch information
dinesharjani authored Jan 17, 2022
2 parents 093adb7 + 15e8429 commit b55da15
Show file tree
Hide file tree
Showing 7 changed files with 495 additions and 189 deletions.
14 changes: 14 additions & 0 deletions Source/Extensions/String+McuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import Foundation

// MARK: - String

internal extension String {

func replaceFirst(of pattern:String, with replacement:String) -> String {
Expand All @@ -24,3 +26,15 @@ internal extension String {
}
}
}

// MARK: - StringInterpolation

internal extension String.StringInterpolation {

/**
Fix for SwiftLint warning when printing an Optional value.
*/
mutating func appendInterpolation<T: CustomStringConvertible>(_ value: T?) {
appendInterpolation(value ?? "nil" as CustomStringConvertible)
}
}
38 changes: 38 additions & 0 deletions Source/Managers/BasicManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// BasicManager.swift
//
//
// Created by Dinesh Harjani on 21/9/21.
//

import Foundation
import SwiftCBOR

// MARK: - BasicManager

/// Sends commands belonging to the Basic Group.
///
public class BasicManager: McuManager {
override class var TAG: McuMgrLogCategory { .basic }

// MARK: - Constants

enum ID: UInt8 {
case Reset = 0
}

// MARK: - Init

public init(transporter: McuMgrTransport) {
super.init(group: .basic, transporter: transporter)
}

// MARK: - Commands

/// Erase stored Application-Level Settings from the Application Core.
///
/// - parameter callback: The response callback with a ``McuMgrResponse``.
public func eraseAppSettings(callback: @escaping McuMgrCallback<McuMgrResponse>) {
send(op: .write, commandId: ID.Reset.rawValue, payload: [:], callback: callback)
}
}
Loading

0 comments on commit b55da15

Please sign in to comment.