Skip to content

Commit 08bcc5c

Browse files
committed
nfc operations
1 parent c12a187 commit 08bcc5c

16 files changed

+2830
-494
lines changed

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55

66
let package = Package(
77
name: "RNLibreToolsiOS13",
8-
platforms: [.iOS(.v13)],
8+
platforms: [.iOS(.v15)],
99
products: [
1010
// Products define the executables and libraries a package produces, and make them visible to other packages.
1111
.library(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Foundation
2+
3+
protocol Logging {
4+
func error(_ s: String)
5+
func info(_ s: String)
6+
func warning(_ s: String)
7+
}
8+
9+
public final class NaiveLogger: Logging {
10+
11+
func error(_ s: String) {
12+
print("[ERR] \(s)")
13+
}
14+
15+
func info(_ s: String) {
16+
print("[INFO] \(s)")
17+
}
18+
19+
func warning(_ s: String) {
20+
print("[WARN] \(s)")
21+
}
22+
}
23+
24+
public final class DummyLogger: Logging {
25+
func error(_ s: String) {}
26+
func info(_ s: String) {}
27+
func warning(_ s: String) {}
28+
}

Sources/RNLibreToolsiOS13/LibreError.swift

+36
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,40 @@ public struct LibreError : Error {
1515
self.errorCode = errorCode
1616
self.errorMessage = errorMessage
1717
}
18+
19+
public static func unknown(_ msg: String) -> LibreError {
20+
return LibreError(errorCode: 0, errorMessage: msg)
21+
}
22+
23+
public static func connectionFailed(_ msg: String) -> LibreError {
24+
return LibreError(errorCode: 1, errorMessage: msg)
25+
}
26+
27+
public static func gettingSystemInfoFailed(_ msg: String) -> LibreError {
28+
return LibreError(errorCode: 2, errorMessage: msg)
29+
}
30+
31+
public static func commandNotSupported(_ cmd: String) -> LibreError {
32+
return LibreError(errorCode: 3, errorMessage: "Command not supported: \(cmd)")
33+
}
34+
35+
public static func activationError(_ msg: String) -> LibreError {
36+
return LibreError(errorCode: 4, errorMessage: "Activation error: \(msg)")
37+
}
38+
39+
public static func readFailure(_ msg: String) -> LibreError {
40+
return LibreError(errorCode: 5, errorMessage: "Read error: \(msg)")
41+
}
42+
43+
public static func unexpected(_ msg: String) -> LibreError {
44+
return LibreError(errorCode: 6, errorMessage: "Unexpected error: \(msg)")
45+
}
46+
47+
public static func oop(_ msg: String) -> LibreError {
48+
return LibreError(errorCode: 7, errorMessage: "OOP error: \(msg)")
49+
}
50+
51+
public static func dataValidation(_ msg: String) -> LibreError {
52+
return LibreError(errorCode: 8, errorMessage: "Data validation error: \(msg)")
53+
}
1854
}

0 commit comments

Comments
 (0)