@dawidzawada/bonjour-zeroconf 1.0.0 → 1.1.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/README.md +274 -10
- package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf+AddressResolver.kt +14 -0
- package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf.kt +25 -1
- package/ios/AddressResolverError.swift +13 -10
- package/ios/BonjourZeroconf+AddressResolver.swift +58 -21
- package/ios/BonjourZeroconf.swift +21 -0
- package/ios/LocalNetworkAuthorization.swift +0 -1
- package/lib/typescript/src/specs/BonjourZeroconf.nitro.d.ts +1 -0
- package/lib/typescript/src/specs/BonjourZeroconf.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JBonjourFail.hpp +1 -1
- package/nitrogen/generated/android/c++/JBonjourListener.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_BonjourFail.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_ScanResult_.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridBonjourZeroconfSpec.cpp +35 -8
- package/nitrogen/generated/android/c++/JHybridBonjourZeroconfSpec.hpp +2 -1
- package/nitrogen/generated/android/c++/JScanOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JScanResult.hpp +1 -1
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconf+autolinking.cmake +1 -1
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconf+autolinking.gradle +1 -1
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconfOnLoad.cpp +1 -1
- package/nitrogen/generated/android/dawidzawada_bonjourzeroconfOnLoad.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourFail.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourListener.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_BonjourFail.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_bool.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_std__vector_ScanResult_.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/HybridBonjourZeroconfSpec.kt +6 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/ScanOptions.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/ScanResult.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/dawidzawada_bonjourzeroconfOnLoad.kt +1 -1
- package/nitrogen/generated/ios/BonjourZeroconf+autolinking.rb +1 -1
- package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Bridge.cpp +17 -17
- package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Bridge.hpp +73 -52
- package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/BonjourZeroconfAutolinking.mm +1 -1
- package/nitrogen/generated/ios/BonjourZeroconfAutolinking.swift +1 -1
- package/nitrogen/generated/ios/c++/HybridBonjourZeroconfSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridBonjourZeroconfSpecSwift.hpp +14 -5
- package/nitrogen/generated/ios/c++/HybridLocalNetworkPermissionSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridLocalNetworkPermissionSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/BonjourFail.swift +1 -1
- package/nitrogen/generated/ios/swift/BonjourListener.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_BonjourFail.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -1
- package/nitrogen/generated/ios/swift/Func_void_std__vector_ScanResult_.swift +6 -6
- package/nitrogen/generated/ios/swift/HybridBonjourZeroconfSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridBonjourZeroconfSpec_cxx.swift +26 -1
- package/nitrogen/generated/ios/swift/HybridLocalNetworkPermissionSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridLocalNetworkPermissionSpec_cxx.swift +1 -1
- package/nitrogen/generated/ios/swift/ScanOptions.swift +1 -1
- package/nitrogen/generated/ios/swift/ScanResult.swift +1 -1
- package/nitrogen/generated/shared/c++/BonjourFail.hpp +1 -1
- package/nitrogen/generated/shared/c++/BonjourListener.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridBonjourZeroconfSpec.cpp +2 -1
- package/nitrogen/generated/shared/c++/HybridBonjourZeroconfSpec.hpp +6 -4
- package/nitrogen/generated/shared/c++/HybridLocalNetworkPermissionSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridLocalNetworkPermissionSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/ScanOptions.hpp +1 -1
- package/nitrogen/generated/shared/c++/ScanResult.hpp +1 -1
- package/package.json +18 -2
- package/src/specs/BonjourZeroconf.nitro.ts +7 -0
|
@@ -2,32 +2,34 @@
|
|
|
2
2
|
/// JHybridBonjourZeroconfSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "JHybridBonjourZeroconfSpec.hpp"
|
|
9
9
|
|
|
10
|
+
// Forward declaration of `ScanResult` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanResult; }
|
|
10
12
|
// Forward declaration of `BonjourListener` to properly resolve imports.
|
|
11
13
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
|
|
12
14
|
// Forward declaration of `ScanOptions` to properly resolve imports.
|
|
13
15
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanOptions; }
|
|
14
|
-
// Forward declaration of `ScanResult` to properly resolve imports.
|
|
15
|
-
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanResult; }
|
|
16
16
|
// Forward declaration of `BonjourFail` to properly resolve imports.
|
|
17
17
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf { enum class BonjourFail; }
|
|
18
18
|
|
|
19
|
+
#include "ScanResult.hpp"
|
|
20
|
+
#include <vector>
|
|
21
|
+
#include <NitroModules/Promise.hpp>
|
|
22
|
+
#include <NitroModules/JPromise.hpp>
|
|
23
|
+
#include "JScanResult.hpp"
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <optional>
|
|
19
26
|
#include "BonjourListener.hpp"
|
|
20
27
|
#include "JBonjourListener.hpp"
|
|
21
28
|
#include <functional>
|
|
22
29
|
#include "JFunc_void.hpp"
|
|
23
|
-
#include <string>
|
|
24
30
|
#include "ScanOptions.hpp"
|
|
25
|
-
#include <optional>
|
|
26
31
|
#include "JScanOptions.hpp"
|
|
27
|
-
#include "ScanResult.hpp"
|
|
28
|
-
#include <vector>
|
|
29
32
|
#include "JFunc_void_std__vector_ScanResult_.hpp"
|
|
30
|
-
#include "JScanResult.hpp"
|
|
31
33
|
#include "JFunc_void_bool.hpp"
|
|
32
34
|
#include "BonjourFail.hpp"
|
|
33
35
|
#include "JFunc_void_BonjourFail.hpp"
|
|
@@ -73,6 +75,31 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
|
73
75
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* type */, jni::alias_ref<jni::JString> /* domain */, jni::alias_ref<JScanOptions> /* options */)>("scan");
|
|
74
76
|
method(_javaPart, jni::make_jstring(type), jni::make_jstring(domain), options.has_value() ? JScanOptions::fromCpp(options.value()) : nullptr);
|
|
75
77
|
}
|
|
78
|
+
std::shared_ptr<Promise<std::vector<ScanResult>>> JHybridBonjourZeroconfSpec::scanFor(double time, const std::string& type, const std::string& domain, const std::optional<ScanOptions>& options) {
|
|
79
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(double /* time */, jni::alias_ref<jni::JString> /* type */, jni::alias_ref<jni::JString> /* domain */, jni::alias_ref<JScanOptions> /* options */)>("scanFor");
|
|
80
|
+
auto __result = method(_javaPart, time, jni::make_jstring(type), jni::make_jstring(domain), options.has_value() ? JScanOptions::fromCpp(options.value()) : nullptr);
|
|
81
|
+
return [&]() {
|
|
82
|
+
auto __promise = Promise<std::vector<ScanResult>>::create();
|
|
83
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
84
|
+
auto __result = jni::static_ref_cast<jni::JArrayClass<JScanResult>>(__boxedResult);
|
|
85
|
+
__promise->resolve([&]() {
|
|
86
|
+
size_t __size = __result->size();
|
|
87
|
+
std::vector<ScanResult> __vector;
|
|
88
|
+
__vector.reserve(__size);
|
|
89
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
90
|
+
auto __element = __result->getElement(__i);
|
|
91
|
+
__vector.push_back(__element->toCpp());
|
|
92
|
+
}
|
|
93
|
+
return __vector;
|
|
94
|
+
}());
|
|
95
|
+
});
|
|
96
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
97
|
+
jni::JniException __jniError(__throwable);
|
|
98
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
99
|
+
});
|
|
100
|
+
return __promise;
|
|
101
|
+
}();
|
|
102
|
+
}
|
|
76
103
|
void JHybridBonjourZeroconfSpec::stop() {
|
|
77
104
|
static const auto method = javaClassStatic()->getMethod<void()>("stop");
|
|
78
105
|
method(_javaPart);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridBonjourZeroconfSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -55,6 +55,7 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
|
55
55
|
public:
|
|
56
56
|
// Methods
|
|
57
57
|
void scan(const std::string& type, const std::string& domain, const std::optional<ScanOptions>& options) override;
|
|
58
|
+
std::shared_ptr<Promise<std::vector<ScanResult>>> scanFor(double time, const std::string& type, const std::string& domain, const std::optional<ScanOptions>& options) override;
|
|
58
59
|
void stop() override;
|
|
59
60
|
BonjourListener listenForScanResults(const std::function<void(const std::vector<ScanResult>& /* results */)>& onResult) override;
|
|
60
61
|
BonjourListener listenForScanState(const std::function<void(bool /* isScanning */)>& onChange) override;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# dawidzawada_bonjourzeroconf+autolinking.cmake
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a CMake file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// dawidzawada_bonjourzeroconf+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// dawidzawada_bonjourzeroconfOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#ifndef BUILDING_DAWIDZAWADABONJOURZEROCONF_WITH_GENERATED_CMAKE_PROJECT
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// dawidzawada_bonjourzeroconfOnLoad.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include <jni.h>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BonjourFail.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BonjourListener.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void.kt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_BonjourFail.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_bool.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// Func_void_std__vector_ScanResult_.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridBonjourZeroconfSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
13
14
|
import com.margelo.nitro.core.HybridObject
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -51,6 +52,10 @@ abstract class HybridBonjourZeroconfSpec: HybridObject() {
|
|
|
51
52
|
@Keep
|
|
52
53
|
abstract fun scan(type: String, domain: String, options: ScanOptions?): Unit
|
|
53
54
|
|
|
55
|
+
@DoNotStrip
|
|
56
|
+
@Keep
|
|
57
|
+
abstract fun scanFor(time: Double, type: String, domain: String, options: ScanOptions?): Promise<Array<ScanResult>>
|
|
58
|
+
|
|
54
59
|
@DoNotStrip
|
|
55
60
|
@Keep
|
|
56
61
|
abstract fun stop(): Unit
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ScanOptions.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// ScanResult.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// dawidzawada_bonjourzeroconfOnLoad.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.dawidzawada.bonjourzeroconf
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# BonjourZeroconf+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BonjourZeroconf-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "BonjourZeroconf-Swift-Cxx-Bridge.hpp"
|
|
@@ -15,6 +15,22 @@
|
|
|
15
15
|
|
|
16
16
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
17
17
|
|
|
18
|
+
// pragma MARK: std::function<void(const std::vector<ScanResult>& /* result */)>
|
|
19
|
+
Func_void_std__vector_ScanResult_ create_Func_void_std__vector_ScanResult_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
|
+
auto swiftClosure = BonjourZeroconf::Func_void_std__vector_ScanResult_::fromUnsafe(swiftClosureWrapper);
|
|
21
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<ScanResult>& result) mutable -> void {
|
|
22
|
+
swiftClosure.call(result);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
27
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
28
|
+
auto swiftClosure = BonjourZeroconf::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
29
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
30
|
+
swiftClosure.call(error);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
// pragma MARK: std::function<void()>
|
|
19
35
|
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
36
|
auto swiftClosure = BonjourZeroconf::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
@@ -23,14 +39,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
|
23
39
|
};
|
|
24
40
|
}
|
|
25
41
|
|
|
26
|
-
// pragma MARK: std::function<void(const std::vector<ScanResult>& /* results */)>
|
|
27
|
-
Func_void_std__vector_ScanResult_ create_Func_void_std__vector_ScanResult_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
28
|
-
auto swiftClosure = BonjourZeroconf::Func_void_std__vector_ScanResult_::fromUnsafe(swiftClosureWrapper);
|
|
29
|
-
return [swiftClosure = std::move(swiftClosure)](const std::vector<ScanResult>& results) mutable -> void {
|
|
30
|
-
swiftClosure.call(results);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
42
|
// pragma MARK: std::function<void(bool /* isScanning */)>
|
|
35
43
|
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
36
44
|
auto swiftClosure = BonjourZeroconf::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
@@ -63,14 +71,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
|
63
71
|
return swiftPart.toUnsafe();
|
|
64
72
|
}
|
|
65
73
|
|
|
66
|
-
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
67
|
-
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
68
|
-
auto swiftClosure = BonjourZeroconf::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
69
|
-
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
70
|
-
swiftClosure.call(error);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
74
|
// pragma MARK: std::shared_ptr<HybridLocalNetworkPermissionSpec>
|
|
75
75
|
std::shared_ptr<HybridLocalNetworkPermissionSpec> create_std__shared_ptr_HybridLocalNetworkPermissionSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
76
76
|
BonjourZeroconf::HybridLocalNetworkPermissionSpec_cxx swiftPart = BonjourZeroconf::HybridLocalNetworkPermissionSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BonjourZeroconf-Swift-Cxx-Bridge.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -80,28 +80,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
|
80
80
|
return *optional;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// pragma MARK: std::function<void()>
|
|
84
|
-
/**
|
|
85
|
-
* Specialized version of `std::function<void()>`.
|
|
86
|
-
*/
|
|
87
|
-
using Func_void = std::function<void()>;
|
|
88
|
-
/**
|
|
89
|
-
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
90
|
-
*/
|
|
91
|
-
class Func_void_Wrapper final {
|
|
92
|
-
public:
|
|
93
|
-
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
94
|
-
inline void call() const noexcept {
|
|
95
|
-
_function->operator()();
|
|
96
|
-
}
|
|
97
|
-
private:
|
|
98
|
-
std::unique_ptr<std::function<void()>> _function;
|
|
99
|
-
} SWIFT_NONCOPYABLE;
|
|
100
|
-
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
101
|
-
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
102
|
-
return Func_void_Wrapper(std::move(value));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
83
|
// pragma MARK: std::optional<std::string>
|
|
106
84
|
/**
|
|
107
85
|
* Specialized version of `std::optional<std::string>`.
|
|
@@ -128,28 +106,84 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
|
128
106
|
return vector;
|
|
129
107
|
}
|
|
130
108
|
|
|
131
|
-
// pragma MARK: std::
|
|
109
|
+
// pragma MARK: std::shared_ptr<Promise<std::vector<ScanResult>>>
|
|
110
|
+
/**
|
|
111
|
+
* Specialized version of `std::shared_ptr<Promise<std::vector<ScanResult>>>`.
|
|
112
|
+
*/
|
|
113
|
+
using std__shared_ptr_Promise_std__vector_ScanResult___ = std::shared_ptr<Promise<std::vector<ScanResult>>>;
|
|
114
|
+
inline std::shared_ptr<Promise<std::vector<ScanResult>>> create_std__shared_ptr_Promise_std__vector_ScanResult___() noexcept {
|
|
115
|
+
return Promise<std::vector<ScanResult>>::create();
|
|
116
|
+
}
|
|
117
|
+
inline PromiseHolder<std::vector<ScanResult>> wrap_std__shared_ptr_Promise_std__vector_ScanResult___(std::shared_ptr<Promise<std::vector<ScanResult>>> promise) noexcept {
|
|
118
|
+
return PromiseHolder<std::vector<ScanResult>>(std::move(promise));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// pragma MARK: std::function<void(const std::vector<ScanResult>& /* result */)>
|
|
132
122
|
/**
|
|
133
123
|
* Specialized version of `std::function<void(const std::vector<ScanResult>&)>`.
|
|
134
124
|
*/
|
|
135
|
-
using Func_void_std__vector_ScanResult_ = std::function<void(const std::vector<ScanResult>& /*
|
|
125
|
+
using Func_void_std__vector_ScanResult_ = std::function<void(const std::vector<ScanResult>& /* result */)>;
|
|
136
126
|
/**
|
|
137
|
-
* Wrapper class for a `std::function<void(const std::vector<ScanResult>& / *
|
|
127
|
+
* Wrapper class for a `std::function<void(const std::vector<ScanResult>& / * result * /)>`, this can be used from Swift.
|
|
138
128
|
*/
|
|
139
129
|
class Func_void_std__vector_ScanResult__Wrapper final {
|
|
140
130
|
public:
|
|
141
|
-
explicit Func_void_std__vector_ScanResult__Wrapper(std::function<void(const std::vector<ScanResult>& /*
|
|
142
|
-
inline void call(std::vector<ScanResult>
|
|
143
|
-
_function->operator()(
|
|
131
|
+
explicit Func_void_std__vector_ScanResult__Wrapper(std::function<void(const std::vector<ScanResult>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<ScanResult>& /* result */)>>(std::move(func))) {}
|
|
132
|
+
inline void call(std::vector<ScanResult> result) const noexcept {
|
|
133
|
+
_function->operator()(result);
|
|
144
134
|
}
|
|
145
135
|
private:
|
|
146
|
-
std::unique_ptr<std::function<void(const std::vector<ScanResult>& /*
|
|
136
|
+
std::unique_ptr<std::function<void(const std::vector<ScanResult>& /* result */)>> _function;
|
|
147
137
|
} SWIFT_NONCOPYABLE;
|
|
148
138
|
Func_void_std__vector_ScanResult_ create_Func_void_std__vector_ScanResult_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
149
139
|
inline Func_void_std__vector_ScanResult__Wrapper wrap_Func_void_std__vector_ScanResult_(Func_void_std__vector_ScanResult_ value) noexcept {
|
|
150
140
|
return Func_void_std__vector_ScanResult__Wrapper(std::move(value));
|
|
151
141
|
}
|
|
152
142
|
|
|
143
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
144
|
+
/**
|
|
145
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
146
|
+
*/
|
|
147
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
148
|
+
/**
|
|
149
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
150
|
+
*/
|
|
151
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
152
|
+
public:
|
|
153
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
154
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
155
|
+
_function->operator()(error);
|
|
156
|
+
}
|
|
157
|
+
private:
|
|
158
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
159
|
+
} SWIFT_NONCOPYABLE;
|
|
160
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
161
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
162
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// pragma MARK: std::function<void()>
|
|
166
|
+
/**
|
|
167
|
+
* Specialized version of `std::function<void()>`.
|
|
168
|
+
*/
|
|
169
|
+
using Func_void = std::function<void()>;
|
|
170
|
+
/**
|
|
171
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
172
|
+
*/
|
|
173
|
+
class Func_void_Wrapper final {
|
|
174
|
+
public:
|
|
175
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
176
|
+
inline void call() const noexcept {
|
|
177
|
+
_function->operator()();
|
|
178
|
+
}
|
|
179
|
+
private:
|
|
180
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
181
|
+
} SWIFT_NONCOPYABLE;
|
|
182
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
183
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
184
|
+
return Func_void_Wrapper(std::move(value));
|
|
185
|
+
}
|
|
186
|
+
|
|
153
187
|
// pragma MARK: std::function<void(bool /* isScanning */)>
|
|
154
188
|
/**
|
|
155
189
|
* Specialized version of `std::function<void(bool)>`.
|
|
@@ -215,6 +249,15 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
|
215
249
|
return Result<void>::withError(error);
|
|
216
250
|
}
|
|
217
251
|
|
|
252
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>
|
|
253
|
+
using Result_std__shared_ptr_Promise_std__vector_ScanResult____ = Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>;
|
|
254
|
+
inline Result_std__shared_ptr_Promise_std__vector_ScanResult____ create_Result_std__shared_ptr_Promise_std__vector_ScanResult____(const std::shared_ptr<Promise<std::vector<ScanResult>>>& value) noexcept {
|
|
255
|
+
return Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>::withValue(value);
|
|
256
|
+
}
|
|
257
|
+
inline Result_std__shared_ptr_Promise_std__vector_ScanResult____ create_Result_std__shared_ptr_Promise_std__vector_ScanResult____(const std::exception_ptr& error) noexcept {
|
|
258
|
+
return Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>::withError(error);
|
|
259
|
+
}
|
|
260
|
+
|
|
218
261
|
// pragma MARK: Result<BonjourListener>
|
|
219
262
|
using Result_BonjourListener_ = Result<BonjourListener>;
|
|
220
263
|
inline Result_BonjourListener_ create_Result_BonjourListener_(const BonjourListener& value) noexcept {
|
|
@@ -236,28 +279,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
|
|
|
236
279
|
return PromiseHolder<bool>(std::move(promise));
|
|
237
280
|
}
|
|
238
281
|
|
|
239
|
-
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
240
|
-
/**
|
|
241
|
-
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
242
|
-
*/
|
|
243
|
-
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
244
|
-
/**
|
|
245
|
-
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
246
|
-
*/
|
|
247
|
-
class Func_void_std__exception_ptr_Wrapper final {
|
|
248
|
-
public:
|
|
249
|
-
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
250
|
-
inline void call(std::exception_ptr error) const noexcept {
|
|
251
|
-
_function->operator()(error);
|
|
252
|
-
}
|
|
253
|
-
private:
|
|
254
|
-
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
255
|
-
} SWIFT_NONCOPYABLE;
|
|
256
|
-
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
257
|
-
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
258
|
-
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
282
|
// pragma MARK: std::shared_ptr<HybridLocalNetworkPermissionSpec>
|
|
262
283
|
/**
|
|
263
284
|
* Specialized version of `std::shared_ptr<HybridLocalNetworkPermissionSpec>`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BonjourZeroconfAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// BonjourZeroconfAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
public final class BonjourZeroconfAutolinking {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridBonjourZeroconfSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridBonjourZeroconfSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridBonjourZeroconfSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -14,20 +14,21 @@ namespace BonjourZeroconf { class HybridBonjourZeroconfSpec_cxx; }
|
|
|
14
14
|
|
|
15
15
|
// Forward declaration of `ScanOptions` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanOptions; }
|
|
17
|
-
// Forward declaration of `BonjourListener` to properly resolve imports.
|
|
18
|
-
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
|
|
19
17
|
// Forward declaration of `ScanResult` to properly resolve imports.
|
|
20
18
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanResult; }
|
|
19
|
+
// Forward declaration of `BonjourListener` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
|
|
21
21
|
// Forward declaration of `BonjourFail` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::dawidzawada_bonjourzeroconf { enum class BonjourFail; }
|
|
23
23
|
|
|
24
24
|
#include <string>
|
|
25
25
|
#include "ScanOptions.hpp"
|
|
26
26
|
#include <optional>
|
|
27
|
-
#include "BonjourListener.hpp"
|
|
28
|
-
#include <functional>
|
|
29
27
|
#include "ScanResult.hpp"
|
|
30
28
|
#include <vector>
|
|
29
|
+
#include <NitroModules/Promise.hpp>
|
|
30
|
+
#include "BonjourListener.hpp"
|
|
31
|
+
#include <functional>
|
|
31
32
|
#include "BonjourFail.hpp"
|
|
32
33
|
|
|
33
34
|
#include "BonjourZeroconf-Swift-Cxx-Umbrella.hpp"
|
|
@@ -82,6 +83,14 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf {
|
|
|
82
83
|
std::rethrow_exception(__result.error());
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
inline std::shared_ptr<Promise<std::vector<ScanResult>>> scanFor(double time, const std::string& type, const std::string& domain, const std::optional<ScanOptions>& options) override {
|
|
87
|
+
auto __result = _swiftPart.scanFor(std::forward<decltype(time)>(time), type, domain, options);
|
|
88
|
+
if (__result.hasError()) [[unlikely]] {
|
|
89
|
+
std::rethrow_exception(__result.error());
|
|
90
|
+
}
|
|
91
|
+
auto __value = std::move(__result.value());
|
|
92
|
+
return __value;
|
|
93
|
+
}
|
|
85
94
|
inline void stop() override {
|
|
86
95
|
auto __result = _swiftPart.stop();
|
|
87
96
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridLocalNetworkPermissionSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridLocalNetworkPermissionSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridLocalNetworkPermissionSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|