@dawidzawada/bonjour-zeroconf 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BonjourZeroconf.podspec +30 -0
- package/LICENSE +20 -0
- package/README.md +35 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +128 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf+AddressResolver.kt +182 -0
- package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf+Listeners.kt +45 -0
- package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf.kt +183 -0
- package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconfPackage.kt +22 -0
- package/ios/AddressResolverError.swift +20 -0
- package/ios/BonjourZeroconf+AddressResolver.swift +133 -0
- package/ios/BonjourZeroconf+Listeners.swift +26 -0
- package/ios/BonjourZeroconf.swift +201 -0
- package/ios/LocalNetworkAuthorization.swift +66 -0
- package/ios/LocalNetworkPermission+Listeners.swift +14 -0
- package/ios/LocalNetworkPermission.swift +41 -0
- package/ios/ServiceCache.swift +30 -0
- package/ios/Utils/Loggy.swift +37 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permissions.ios.js +23 -0
- package/lib/module/permissions.ios.js.map +1 -0
- package/lib/module/permissions.js +9 -0
- package/lib/module/permissions.js.map +1 -0
- package/lib/module/specs/BonjourFail.js +9 -0
- package/lib/module/specs/BonjourFail.js.map +1 -0
- package/lib/module/specs/BonjourListener.js +2 -0
- package/lib/module/specs/BonjourListener.js.map +1 -0
- package/lib/module/specs/BonjourZeroconf.nitro.js +4 -0
- package/lib/module/specs/BonjourZeroconf.nitro.js.map +1 -0
- package/lib/module/specs/LocalNetworkPermission.nitro.js +4 -0
- package/lib/module/specs/LocalNetworkPermission.nitro.js.map +1 -0
- package/lib/module/specs/ScanResult.js +2 -0
- package/lib/module/specs/ScanResult.js.map +1 -0
- package/lib/module/useIsScanning.js +19 -0
- package/lib/module/useIsScanning.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/permissions.d.ts +3 -0
- package/lib/typescript/src/permissions.d.ts.map +1 -0
- package/lib/typescript/src/permissions.ios.d.ts +3 -0
- package/lib/typescript/src/permissions.ios.d.ts.map +1 -0
- package/lib/typescript/src/specs/BonjourFail.d.ts +6 -0
- package/lib/typescript/src/specs/BonjourFail.d.ts.map +1 -0
- package/lib/typescript/src/specs/BonjourListener.d.ts +4 -0
- package/lib/typescript/src/specs/BonjourListener.d.ts.map +1 -0
- package/lib/typescript/src/specs/BonjourZeroconf.nitro.d.ts +19 -0
- package/lib/typescript/src/specs/BonjourZeroconf.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/LocalNetworkPermission.nitro.d.ts +9 -0
- package/lib/typescript/src/specs/LocalNetworkPermission.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/ScanResult.d.ts +8 -0
- package/lib/typescript/src/specs/ScanResult.d.ts.map +1 -0
- package/lib/typescript/src/useIsScanning.d.ts +2 -0
- package/lib/typescript/src/useIsScanning.d.ts.map +1 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/android/c++/JBonjourFail.hpp +62 -0
- package/nitrogen/generated/android/c++/JBonjourListener.hpp +68 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_BonjourFail.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_ScanResult_.hpp +97 -0
- package/nitrogen/generated/android/c++/JHybridBonjourZeroconfSpec.cpp +96 -0
- package/nitrogen/generated/android/c++/JHybridBonjourZeroconfSpec.hpp +69 -0
- package/nitrogen/generated/android/c++/JScanOptions.hpp +57 -0
- package/nitrogen/generated/android/c++/JScanResult.hpp +74 -0
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconf+autolinking.cmake +82 -0
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconf+autolinking.gradle +27 -0
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconfOnLoad.cpp +52 -0
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconfOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourFail.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourListener.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_BonjourFail.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_bool.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_std__vector_ScanResult_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/HybridBonjourZeroconfSpec.kt +90 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/ScanOptions.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/ScanResult.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/dawidzawada_bonjourzeroconfOnLoad.kt +35 -0
- package/nitrogen/generated/ios/BonjourZeroconf+autolinking.rb +60 -0
- package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Bridge.cpp +90 -0
- package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Bridge.hpp +282 -0
- package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Umbrella.hpp +65 -0
- package/nitrogen/generated/ios/BonjourZeroconfAutolinking.mm +41 -0
- package/nitrogen/generated/ios/BonjourZeroconfAutolinking.swift +40 -0
- package/nitrogen/generated/ios/c++/HybridBonjourZeroconfSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridBonjourZeroconfSpecSwift.hpp +120 -0
- package/nitrogen/generated/ios/c++/HybridLocalNetworkPermissionSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridLocalNetworkPermissionSpecSwift.hpp +87 -0
- package/nitrogen/generated/ios/swift/BonjourFail.swift +44 -0
- package/nitrogen/generated/ios/swift/BonjourListener.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_BonjourFail.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_ScanResult_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridBonjourZeroconfSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridBonjourZeroconfSpec_cxx.swift +203 -0
- package/nitrogen/generated/ios/swift/HybridLocalNetworkPermissionSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridLocalNetworkPermissionSpec_cxx.swift +155 -0
- package/nitrogen/generated/ios/swift/ScanOptions.swift +48 -0
- package/nitrogen/generated/ios/swift/ScanResult.swift +149 -0
- package/nitrogen/generated/shared/c++/BonjourFail.hpp +63 -0
- package/nitrogen/generated/shared/c++/BonjourListener.hpp +75 -0
- package/nitrogen/generated/shared/c++/HybridBonjourZeroconfSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridBonjourZeroconfSpec.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridLocalNetworkPermissionSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridLocalNetworkPermissionSpec.hpp +66 -0
- package/nitrogen/generated/shared/c++/ScanOptions.hpp +75 -0
- package/nitrogen/generated/shared/c++/ScanResult.hpp +92 -0
- package/package.json +169 -0
- package/src/index.ts +22 -0
- package/src/permissions.ios.ts +27 -0
- package/src/permissions.ts +7 -0
- package/src/specs/BonjourFail.ts +5 -0
- package/src/specs/BonjourListener.ts +3 -0
- package/src/specs/BonjourZeroconf.nitro.ts +20 -0
- package/src/specs/LocalNetworkPermission.nitro.ts +7 -0
- package/src/specs/ScanResult.ts +7 -0
- package/src/useIsScanning.ts +17 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridLocalNetworkPermissionSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A class implementation that bridges HybridLocalNetworkPermissionSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
open class HybridLocalNetworkPermissionSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift`)
|
|
23
|
+
* from `BonjourZeroconf-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.dawidzawada_bonjourzeroconf.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridLocalNetworkPermissionSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridLocalNetworkPermissionSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridLocalNetworkPermissionSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridLocalNetworkPermissionSpec_cxx` that wraps the given `HybridLocalNetworkPermissionSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridLocalNetworkPermissionSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridLocalNetworkPermissionSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridLocalNetworkPermissionSpec() -> any HybridLocalNetworkPermissionSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridLocalNetworkPermissionSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridLocalNetworkPermissionSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridLocalNetworkPermissionSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridLocalNetworkPermissionSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridLocalNetworkPermissionSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridLocalNetworkPermissionSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridLocalNetworkPermissionSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridLocalNetworkPermissionSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Call dispose() on the Swift class.
|
|
101
|
+
* This _may_ be called manually from JS.
|
|
102
|
+
*/
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public func dispose() {
|
|
105
|
+
self.__implementation.dispose()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Call toString() on the Swift class.
|
|
110
|
+
*/
|
|
111
|
+
@inline(__always)
|
|
112
|
+
public func toString() -> String {
|
|
113
|
+
return self.__implementation.toString()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Properties
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
// Methods
|
|
120
|
+
@inline(__always)
|
|
121
|
+
public final func requestPermission() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
122
|
+
do {
|
|
123
|
+
let __result = try self.__implementation.requestPermission()
|
|
124
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
125
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
126
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
127
|
+
__result
|
|
128
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
129
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
130
|
+
return __promise
|
|
131
|
+
}()
|
|
132
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
133
|
+
} catch (let __error) {
|
|
134
|
+
let __exceptionPtr = __error.toCpp()
|
|
135
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@inline(__always)
|
|
140
|
+
public final func listenForPermission(onChange: bridge.Func_void_bool) -> bridge.Result_BonjourListener_ {
|
|
141
|
+
do {
|
|
142
|
+
let __result = try self.__implementation.listenForPermission(onChange: { () -> (Bool) -> Void in
|
|
143
|
+
let __wrappedFunction = bridge.wrap_Func_void_bool(onChange)
|
|
144
|
+
return { (__granted: Bool) -> Void in
|
|
145
|
+
__wrappedFunction.call(__granted)
|
|
146
|
+
}
|
|
147
|
+
}())
|
|
148
|
+
let __resultCpp = __result
|
|
149
|
+
return bridge.create_Result_BonjourListener_(__resultCpp)
|
|
150
|
+
} catch (let __error) {
|
|
151
|
+
let __exceptionPtr = __error.toCpp()
|
|
152
|
+
return bridge.create_Result_BonjourListener_(__exceptionPtr)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ScanOptions.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `ScanOptions`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias ScanOptions = margelo.nitro.dawidzawada_bonjourzeroconf.ScanOptions
|
|
15
|
+
|
|
16
|
+
public extension ScanOptions {
|
|
17
|
+
private typealias bridge = margelo.nitro.dawidzawada_bonjourzeroconf.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `ScanOptions`.
|
|
21
|
+
*/
|
|
22
|
+
init(addressResolveTimeout: Double?) {
|
|
23
|
+
self.init({ () -> bridge.std__optional_double_ in
|
|
24
|
+
if let __unwrappedValue = addressResolveTimeout {
|
|
25
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
26
|
+
} else {
|
|
27
|
+
return .init()
|
|
28
|
+
}
|
|
29
|
+
}())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var addressResolveTimeout: Double? {
|
|
33
|
+
@inline(__always)
|
|
34
|
+
get {
|
|
35
|
+
return self.__addressResolveTimeout.value
|
|
36
|
+
}
|
|
37
|
+
@inline(__always)
|
|
38
|
+
set {
|
|
39
|
+
self.__addressResolveTimeout = { () -> bridge.std__optional_double_ in
|
|
40
|
+
if let __unwrappedValue = newValue {
|
|
41
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
42
|
+
} else {
|
|
43
|
+
return .init()
|
|
44
|
+
}
|
|
45
|
+
}()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ScanResult.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `ScanResult`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias ScanResult = margelo.nitro.dawidzawada_bonjourzeroconf.ScanResult
|
|
15
|
+
|
|
16
|
+
public extension ScanResult {
|
|
17
|
+
private typealias bridge = margelo.nitro.dawidzawada_bonjourzeroconf.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `ScanResult`.
|
|
21
|
+
*/
|
|
22
|
+
init(name: String, ipv4: String?, ipv6: String?, hostname: String?, port: Double?) {
|
|
23
|
+
self.init(std.string(name), { () -> bridge.std__optional_std__string_ in
|
|
24
|
+
if let __unwrappedValue = ipv4 {
|
|
25
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
26
|
+
} else {
|
|
27
|
+
return .init()
|
|
28
|
+
}
|
|
29
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
30
|
+
if let __unwrappedValue = ipv6 {
|
|
31
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
36
|
+
if let __unwrappedValue = hostname {
|
|
37
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
38
|
+
} else {
|
|
39
|
+
return .init()
|
|
40
|
+
}
|
|
41
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
42
|
+
if let __unwrappedValue = port {
|
|
43
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
44
|
+
} else {
|
|
45
|
+
return .init()
|
|
46
|
+
}
|
|
47
|
+
}())
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var name: String {
|
|
51
|
+
@inline(__always)
|
|
52
|
+
get {
|
|
53
|
+
return String(self.__name)
|
|
54
|
+
}
|
|
55
|
+
@inline(__always)
|
|
56
|
+
set {
|
|
57
|
+
self.__name = std.string(newValue)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var ipv4: String? {
|
|
62
|
+
@inline(__always)
|
|
63
|
+
get {
|
|
64
|
+
return { () -> String? in
|
|
65
|
+
if bridge.has_value_std__optional_std__string_(self.__ipv4) {
|
|
66
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__ipv4)
|
|
67
|
+
return String(__unwrapped)
|
|
68
|
+
} else {
|
|
69
|
+
return nil
|
|
70
|
+
}
|
|
71
|
+
}()
|
|
72
|
+
}
|
|
73
|
+
@inline(__always)
|
|
74
|
+
set {
|
|
75
|
+
self.__ipv4 = { () -> bridge.std__optional_std__string_ in
|
|
76
|
+
if let __unwrappedValue = newValue {
|
|
77
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
78
|
+
} else {
|
|
79
|
+
return .init()
|
|
80
|
+
}
|
|
81
|
+
}()
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var ipv6: String? {
|
|
86
|
+
@inline(__always)
|
|
87
|
+
get {
|
|
88
|
+
return { () -> String? in
|
|
89
|
+
if bridge.has_value_std__optional_std__string_(self.__ipv6) {
|
|
90
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__ipv6)
|
|
91
|
+
return String(__unwrapped)
|
|
92
|
+
} else {
|
|
93
|
+
return nil
|
|
94
|
+
}
|
|
95
|
+
}()
|
|
96
|
+
}
|
|
97
|
+
@inline(__always)
|
|
98
|
+
set {
|
|
99
|
+
self.__ipv6 = { () -> bridge.std__optional_std__string_ in
|
|
100
|
+
if let __unwrappedValue = newValue {
|
|
101
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
102
|
+
} else {
|
|
103
|
+
return .init()
|
|
104
|
+
}
|
|
105
|
+
}()
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
var hostname: String? {
|
|
110
|
+
@inline(__always)
|
|
111
|
+
get {
|
|
112
|
+
return { () -> String? in
|
|
113
|
+
if bridge.has_value_std__optional_std__string_(self.__hostname) {
|
|
114
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__hostname)
|
|
115
|
+
return String(__unwrapped)
|
|
116
|
+
} else {
|
|
117
|
+
return nil
|
|
118
|
+
}
|
|
119
|
+
}()
|
|
120
|
+
}
|
|
121
|
+
@inline(__always)
|
|
122
|
+
set {
|
|
123
|
+
self.__hostname = { () -> bridge.std__optional_std__string_ in
|
|
124
|
+
if let __unwrappedValue = newValue {
|
|
125
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
126
|
+
} else {
|
|
127
|
+
return .init()
|
|
128
|
+
}
|
|
129
|
+
}()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var port: Double? {
|
|
134
|
+
@inline(__always)
|
|
135
|
+
get {
|
|
136
|
+
return self.__port.value
|
|
137
|
+
}
|
|
138
|
+
@inline(__always)
|
|
139
|
+
set {
|
|
140
|
+
self.__port = { () -> bridge.std__optional_double_ in
|
|
141
|
+
if let __unwrappedValue = newValue {
|
|
142
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
143
|
+
} else {
|
|
144
|
+
return .init()
|
|
145
|
+
}
|
|
146
|
+
}()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BonjourFail.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An enum which can be represented as a JavaScript enum (BonjourFail).
|
|
25
|
+
*/
|
|
26
|
+
enum class BonjourFail {
|
|
27
|
+
RESOLVE_FAILED SWIFT_NAME(resolveFailed) = 0,
|
|
28
|
+
EXTRACTION_FAILED SWIFT_NAME(extractionFailed) = 1,
|
|
29
|
+
DISCOVERY_FAILED SWIFT_NAME(discoveryFailed) = 2,
|
|
30
|
+
} CLOSED_ENUM;
|
|
31
|
+
|
|
32
|
+
} // namespace margelo::nitro::dawidzawada_bonjourzeroconf
|
|
33
|
+
|
|
34
|
+
namespace margelo::nitro {
|
|
35
|
+
|
|
36
|
+
// C++ BonjourFail <> JS BonjourFail (enum)
|
|
37
|
+
template <>
|
|
38
|
+
struct JSIConverter<margelo::nitro::dawidzawada_bonjourzeroconf::BonjourFail> final {
|
|
39
|
+
static inline margelo::nitro::dawidzawada_bonjourzeroconf::BonjourFail fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
40
|
+
int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
|
|
41
|
+
return static_cast<margelo::nitro::dawidzawada_bonjourzeroconf::BonjourFail>(enumValue);
|
|
42
|
+
}
|
|
43
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::dawidzawada_bonjourzeroconf::BonjourFail arg) {
|
|
44
|
+
int enumValue = static_cast<int>(arg);
|
|
45
|
+
return JSIConverter<int>::toJSI(runtime, enumValue);
|
|
46
|
+
}
|
|
47
|
+
static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
|
|
48
|
+
if (!value.isNumber()) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
double number = value.getNumber();
|
|
52
|
+
int integer = static_cast<int>(number);
|
|
53
|
+
if (number != integer) {
|
|
54
|
+
// The integer is not the same value as the double - we truncated floating points.
|
|
55
|
+
// Enums are all integers, so the input floating point number is obviously invalid.
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
// Check if we are within the bounds of the enum.
|
|
59
|
+
return integer >= 0 && integer <= 2;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BonjourListener.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <functional>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (BonjourListener).
|
|
34
|
+
*/
|
|
35
|
+
struct BonjourListener {
|
|
36
|
+
public:
|
|
37
|
+
std::function<void()> remove SWIFT_PRIVATE;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
BonjourListener() = default;
|
|
41
|
+
explicit BonjourListener(std::function<void()> remove): remove(remove) {}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::dawidzawada_bonjourzeroconf
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro {
|
|
47
|
+
|
|
48
|
+
// C++ BonjourListener <> JS BonjourListener (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<margelo::nitro::dawidzawada_bonjourzeroconf::BonjourListener> final {
|
|
51
|
+
static inline margelo::nitro::dawidzawada_bonjourzeroconf::BonjourListener fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return margelo::nitro::dawidzawada_bonjourzeroconf::BonjourListener(
|
|
54
|
+
JSIConverter<std::function<void()>>::fromJSI(runtime, obj.getProperty(runtime, "remove"))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::dawidzawada_bonjourzeroconf::BonjourListener& arg) {
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setProperty(runtime, "remove", JSIConverter<std::function<void()>>::toJSI(runtime, arg.remove));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
63
|
+
if (!value.isObject()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
jsi::Object obj = value.getObject(runtime);
|
|
67
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!JSIConverter<std::function<void()>>::canConvert(runtime, obj.getProperty(runtime, "remove"))) return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridBonjourZeroconfSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridBonjourZeroconfSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
11
|
+
|
|
12
|
+
void HybridBonjourZeroconfSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("isScanning", &HybridBonjourZeroconfSpec::getIsScanning);
|
|
18
|
+
prototype.registerHybridMethod("scan", &HybridBonjourZeroconfSpec::scan);
|
|
19
|
+
prototype.registerHybridMethod("stop", &HybridBonjourZeroconfSpec::stop);
|
|
20
|
+
prototype.registerHybridMethod("listenForScanResults", &HybridBonjourZeroconfSpec::listenForScanResults);
|
|
21
|
+
prototype.registerHybridMethod("listenForScanState", &HybridBonjourZeroconfSpec::listenForScanState);
|
|
22
|
+
prototype.registerHybridMethod("listenForScanFail", &HybridBonjourZeroconfSpec::listenForScanFail);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
} // namespace margelo::nitro::dawidzawada_bonjourzeroconf
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridBonjourZeroconfSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `ScanOptions` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanOptions; }
|
|
18
|
+
// Forward declaration of `BonjourListener` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
|
|
20
|
+
// Forward declaration of `ScanResult` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanResult; }
|
|
22
|
+
// Forward declaration of `BonjourFail` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { enum class BonjourFail; }
|
|
24
|
+
|
|
25
|
+
#include <string>
|
|
26
|
+
#include "ScanOptions.hpp"
|
|
27
|
+
#include <optional>
|
|
28
|
+
#include "BonjourListener.hpp"
|
|
29
|
+
#include "ScanResult.hpp"
|
|
30
|
+
#include <vector>
|
|
31
|
+
#include <functional>
|
|
32
|
+
#include "BonjourFail.hpp"
|
|
33
|
+
|
|
34
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
35
|
+
|
|
36
|
+
using namespace margelo::nitro;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An abstract base class for `BonjourZeroconf`
|
|
40
|
+
* Inherit this class to create instances of `HybridBonjourZeroconfSpec` in C++.
|
|
41
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
42
|
+
* @example
|
|
43
|
+
* ```cpp
|
|
44
|
+
* class HybridBonjourZeroconf: public HybridBonjourZeroconfSpec {
|
|
45
|
+
* public:
|
|
46
|
+
* HybridBonjourZeroconf(...): HybridObject(TAG) { ... }
|
|
47
|
+
* // ...
|
|
48
|
+
* };
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
class HybridBonjourZeroconfSpec: public virtual HybridObject {
|
|
52
|
+
public:
|
|
53
|
+
// Constructor
|
|
54
|
+
explicit HybridBonjourZeroconfSpec(): HybridObject(TAG) { }
|
|
55
|
+
|
|
56
|
+
// Destructor
|
|
57
|
+
~HybridBonjourZeroconfSpec() override = default;
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
// Properties
|
|
61
|
+
virtual bool getIsScanning() = 0;
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
// Methods
|
|
65
|
+
virtual void scan(const std::string& type, const std::string& domain, const std::optional<ScanOptions>& options) = 0;
|
|
66
|
+
virtual void stop() = 0;
|
|
67
|
+
virtual BonjourListener listenForScanResults(const std::function<void(const std::vector<ScanResult>& /* results */)>& onResult) = 0;
|
|
68
|
+
virtual BonjourListener listenForScanState(const std::function<void(bool /* isScanning */)>& onChange) = 0;
|
|
69
|
+
virtual BonjourListener listenForScanFail(const std::function<void(BonjourFail /* fail */)>& onFail) = 0;
|
|
70
|
+
|
|
71
|
+
protected:
|
|
72
|
+
// Hybrid Setup
|
|
73
|
+
void loadHybridMethods() override;
|
|
74
|
+
|
|
75
|
+
protected:
|
|
76
|
+
// Tag for logging
|
|
77
|
+
static constexpr auto TAG = "BonjourZeroconf";
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro::dawidzawada_bonjourzeroconf
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridLocalNetworkPermissionSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridLocalNetworkPermissionSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
11
|
+
|
|
12
|
+
void HybridLocalNetworkPermissionSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("requestPermission", &HybridLocalNetworkPermissionSpec::requestPermission);
|
|
18
|
+
prototype.registerHybridMethod("listenForPermission", &HybridLocalNetworkPermissionSpec::listenForPermission);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace margelo::nitro::dawidzawada_bonjourzeroconf
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridLocalNetworkPermissionSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `BonjourListener` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
|
|
18
|
+
|
|
19
|
+
#include <NitroModules/Promise.hpp>
|
|
20
|
+
#include "BonjourListener.hpp"
|
|
21
|
+
#include <functional>
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
24
|
+
|
|
25
|
+
using namespace margelo::nitro;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An abstract base class for `LocalNetworkPermission`
|
|
29
|
+
* Inherit this class to create instances of `HybridLocalNetworkPermissionSpec` in C++.
|
|
30
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
31
|
+
* @example
|
|
32
|
+
* ```cpp
|
|
33
|
+
* class HybridLocalNetworkPermission: public HybridLocalNetworkPermissionSpec {
|
|
34
|
+
* public:
|
|
35
|
+
* HybridLocalNetworkPermission(...): HybridObject(TAG) { ... }
|
|
36
|
+
* // ...
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
class HybridLocalNetworkPermissionSpec: public virtual HybridObject {
|
|
41
|
+
public:
|
|
42
|
+
// Constructor
|
|
43
|
+
explicit HybridLocalNetworkPermissionSpec(): HybridObject(TAG) { }
|
|
44
|
+
|
|
45
|
+
// Destructor
|
|
46
|
+
~HybridLocalNetworkPermissionSpec() override = default;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
// Properties
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Methods
|
|
54
|
+
virtual std::shared_ptr<Promise<bool>> requestPermission() = 0;
|
|
55
|
+
virtual BonjourListener listenForPermission(const std::function<void(bool /* granted */)>& onChange) = 0;
|
|
56
|
+
|
|
57
|
+
protected:
|
|
58
|
+
// Hybrid Setup
|
|
59
|
+
void loadHybridMethods() override;
|
|
60
|
+
|
|
61
|
+
protected:
|
|
62
|
+
// Tag for logging
|
|
63
|
+
static constexpr auto TAG = "LocalNetworkPermission";
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::dawidzawada_bonjourzeroconf
|