From 020abb118f54a31d07ad4bae493ee6e9610e40af Mon Sep 17 00:00:00 2001 From: TonyLu Date: Thu, 7 May 2026 17:22:39 +0800 Subject: [PATCH] Refactor BLE plugin structure and rename to 'ble' for consistency across platforms --- android/build.gradle | 4 +- android/settings.gradle | 2 +- .../BlePlugin.kt} | 33 +++++++++--- ...eRelayHostPlugin.swift => BlePlugin.swift} | 10 ++-- ios/{ble_relay_host.podspec => ble.podspec} | 2 +- lib/{ble_relay_host.dart => ble.dart} | 2 +- lib/src/ble_relay_host.dart | 2 +- linux/CMakeLists.txt | 8 +-- linux/ble_plugin.cc | 50 +++++++++++++++++++ linux/ble_plugin.h | 16 ++++++ linux/ble_relay_host_plugin.cc | 48 ------------------ linux/ble_relay_host_plugin.h | 16 ------ ...eRelayHostPlugin.swift => BlePlugin.swift} | 10 ++-- macos/{ble_relay_host.podspec => ble.podspec} | 2 +- pubspec.yaml | 14 +++--- windows/CMakeLists.txt | 10 ++-- ...e_relay_host_plugin.cpp => ble_plugin.cpp} | 24 ++++----- .../{ble_relay_host_plugin.h => ble_plugin.h} | 8 +-- windows/include/ble/ble_plugin_c_api.h | 23 +++++++++ 19 files changed, 163 insertions(+), 121 deletions(-) rename android/src/main/kotlin/com/dalimaster/{ble_relay_host/BleRelayHostPlugin.kt => ble/BlePlugin.kt} (92%) rename ios/Classes/{BleRelayHostPlugin.swift => BlePlugin.swift} (70%) rename ios/{ble_relay_host.podspec => ble.podspec} (94%) rename lib/{ble_relay_host.dart => ble.dart} (92%) create mode 100644 linux/ble_plugin.cc create mode 100644 linux/ble_plugin.h delete mode 100644 linux/ble_relay_host_plugin.cc delete mode 100644 linux/ble_relay_host_plugin.h rename macos/Classes/{BleRelayHostPlugin.swift => BlePlugin.swift} (70%) rename macos/{ble_relay_host.podspec => ble.podspec} (94%) rename windows/{ble_relay_host_plugin.cpp => ble_plugin.cpp} (69%) rename windows/{ble_relay_host_plugin.h => ble_plugin.h} (60%) create mode 100644 windows/include/ble/ble_plugin_c_api.h diff --git a/android/build.gradle b/android/build.gradle index a84d77a..2e50cda 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,4 +1,4 @@ -group 'com.dalimaster.ble_relay_host' +group 'com.dalimaster.ble' version '1.0-SNAPSHOT' buildscript { @@ -24,7 +24,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - namespace 'com.dalimaster.ble_relay_host' + namespace 'com.dalimaster.ble' compileSdk 34 defaultConfig { diff --git a/android/settings.gradle b/android/settings.gradle index f215a71..10c4d9c 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1 +1 @@ -include ':ble_relay_host' +include ':ble' diff --git a/android/src/main/kotlin/com/dalimaster/ble_relay_host/BleRelayHostPlugin.kt b/android/src/main/kotlin/com/dalimaster/ble/BlePlugin.kt similarity index 92% rename from android/src/main/kotlin/com/dalimaster/ble_relay_host/BleRelayHostPlugin.kt rename to android/src/main/kotlin/com/dalimaster/ble/BlePlugin.kt index a91b5bf..7a5a925 100644 --- a/android/src/main/kotlin/com/dalimaster/ble_relay_host/BleRelayHostPlugin.kt +++ b/android/src/main/kotlin/com/dalimaster/ble/BlePlugin.kt @@ -1,6 +1,15 @@ -package com.dalimaster.ble_relay_host +package com.dalimaster.ble -import android.bluetooth.* +import android.bluetooth.BluetoothAdapter +import android.bluetooth.BluetoothDevice +import android.bluetooth.BluetoothGatt +import android.bluetooth.BluetoothGattCharacteristic +import android.bluetooth.BluetoothGattDescriptor +import android.bluetooth.BluetoothGattServer +import android.bluetooth.BluetoothGattServerCallback +import android.bluetooth.BluetoothGattService +import android.bluetooth.BluetoothManager +import android.bluetooth.BluetoothProfile import android.bluetooth.le.AdvertiseCallback import android.bluetooth.le.AdvertiseData import android.bluetooth.le.AdvertiseSettings @@ -16,11 +25,11 @@ import io.flutter.plugin.common.MethodChannel.MethodCallHandler import io.flutter.plugin.common.MethodChannel.Result import java.util.UUID -private const val TAG = "BleRelayHostPlugin" -private const val CHANNEL = "com.dalimaster.ble_relay_host" -private const val EVENT_CHANNEL = "com.dalimaster.ble_relay_host/clientWrites" +private const val TAG = "BlePlugin" +private const val CHANNEL = "com.dalimaster.ble" +private const val EVENT_CHANNEL = "com.dalimaster.ble/clientWrites" -class BleRelayHostPlugin : FlutterPlugin, MethodCallHandler { +class BlePlugin : FlutterPlugin, MethodCallHandler { private lateinit var methodChannel: MethodChannel private lateinit var eventChannel: EventChannel @@ -53,6 +62,7 @@ class BleRelayHostPlugin : FlutterPlugin, MethodCallHandler { override fun onListen(arguments: Any?, sink: EventChannel.EventSink?) { eventSink = sink } + override fun onCancel(arguments: Any?) { eventSink = null } @@ -79,18 +89,24 @@ class BleRelayHostPlugin : FlutterPlugin, MethodCallHandler { ?: "0000fff1-0000-1000-8000-00805f9b34fb" startInternal(advertisedName, serviceUuidStr, charUuidStr, result) } + "push" -> { val data = call.argument("data") if (data != null) pushInternal(data) result.success(null) } + "stop" -> { pendingStartResult?.error("CANCELLED", "BLE relay host start cancelled", null) pendingStartResult = null stopInternal() result.success(null) } - "isSupported" -> result.success(bluetoothAdapter != null && bluetoothAdapter!!.isMultipleAdvertisementSupported) + + "isSupported" -> result.success( + bluetoothAdapter != null && bluetoothAdapter!!.isMultipleAdvertisementSupported, + ) + else -> result.notImplemented() } } @@ -263,6 +279,7 @@ class BleRelayHostPlugin : FlutterPlugin, MethodCallHandler { pendingStartResult?.success(null) pendingStartResult = null } + override fun onStartFailure(errorCode: Int) { Log.e(TAG, "BLE advertising failed: $errorCode") pendingStartResult?.error( @@ -274,4 +291,4 @@ class BleRelayHostPlugin : FlutterPlugin, MethodCallHandler { stopInternal() } } -} +} \ No newline at end of file diff --git a/ios/Classes/BleRelayHostPlugin.swift b/ios/Classes/BlePlugin.swift similarity index 70% rename from ios/Classes/BleRelayHostPlugin.swift rename to ios/Classes/BlePlugin.swift index 99707ce..ad36294 100644 --- a/ios/Classes/BleRelayHostPlugin.swift +++ b/ios/Classes/BlePlugin.swift @@ -1,14 +1,14 @@ import Foundation import Flutter -/// iOS stub — BLE peripheral (CoreBluetooth CBPeripheralManager) is available on iOS but +/// iOS stub - BLE peripheral (CoreBluetooth CBPeripheralManager) is available on iOS but /// not yet implemented. `isSupported` returns false; all other methods are no-ops. -public class BleRelayHostPlugin: NSObject, FlutterPlugin { +public class BlePlugin: NSObject, FlutterPlugin { public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel( - name: "com.dalimaster.ble_relay_host", + name: "com.dalimaster.ble", binaryMessenger: registrar.messenger()) - let instance = BleRelayHostPlugin() + let instance = BlePlugin() registrar.addMethodCallDelegate(instance, channel: channel) } @@ -20,4 +20,4 @@ public class BleRelayHostPlugin: NSObject, FlutterPlugin { result(nil) } } -} +} \ No newline at end of file diff --git a/ios/ble_relay_host.podspec b/ios/ble.podspec similarity index 94% rename from ios/ble_relay_host.podspec rename to ios/ble.podspec index e1c4a93..8bd3f45 100644 --- a/ios/ble_relay_host.podspec +++ b/ios/ble.podspec @@ -1,5 +1,5 @@ Pod::Spec.new do |s| - s.name = 'ble_relay_host' + s.name = 'ble' s.version = '0.1.0' s.summary = 'BLE GATT-server peripheral host for the DALI relay feature.' s.description = <<-DESC diff --git a/lib/ble_relay_host.dart b/lib/ble.dart similarity index 92% rename from lib/ble_relay_host.dart rename to lib/ble.dart index 4aac058..75dc913 100644 --- a/lib/ble_relay_host.dart +++ b/lib/ble.dart @@ -14,4 +14,4 @@ // } // ``` -export 'src/ble_relay_host.dart'; +export 'src/ble_relay_host.dart'; \ No newline at end of file diff --git a/lib/src/ble_relay_host.dart b/lib/src/ble_relay_host.dart index 22cfe90..7658f1b 100644 --- a/lib/src/ble_relay_host.dart +++ b/lib/src/ble_relay_host.dart @@ -11,7 +11,7 @@ const String kBleRelayServiceUuid = '0000fff0-0000-1000-8000-00805f9b34fb'; const String kBleRelayCharacteristicUuid = '0000fff1-0000-1000-8000-00805f9b34fb'; /// Method-channel name (must match Android/iOS/macOS native implementations). -const String _kChannelName = 'com.dalimaster.ble_relay_host'; +const String _kChannelName = 'com.dalimaster.ble'; /// An abstraction over the platform BLE GATT-server implementation. /// diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index 7753969..fcac7f4 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.10) -set(PROJECT_NAME "ble_relay_host") +set(PROJECT_NAME "ble") project(${PROJECT_NAME} LANGUAGES CXX) cmake_policy(VERSION 3.10...3.24) -set(PLUGIN_NAME "ble_relay_host_plugin") +set(PLUGIN_NAME "ble_plugin") list(APPEND PLUGIN_SOURCES - "ble_relay_host_plugin.cc" + "ble_plugin.cc" ) add_library(${PLUGIN_NAME} SHARED @@ -21,7 +21,7 @@ target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR} target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) -set(ble_relay_host_bundled_libraries +set(ble_bundled_libraries "" PARENT_SCOPE ) diff --git a/linux/ble_plugin.cc b/linux/ble_plugin.cc new file mode 100644 index 0000000..da4eb19 --- /dev/null +++ b/linux/ble_plugin.cc @@ -0,0 +1,50 @@ +#include "ble_plugin.h" + +#include + +#define BLE_PLUGIN(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), ble_plugin_get_type(), BlePlugin)) + +struct _BlePlugin { + GObject parent_instance; +}; + +G_DEFINE_TYPE(BlePlugin, ble_plugin, g_object_get_type()) + +static void ble_plugin_handle_method_call(BlePlugin* self, + FlMethodCall* method_call) { + g_autoptr(FlMethodResponse) response = nullptr; + const gchar* method = fl_method_call_get_name(method_call); + if (strcmp(method, "isSupported") == 0) { + g_autoptr(FlValue) result = fl_value_new_bool(FALSE); + response = FL_METHOD_RESPONSE(fl_method_success_response_new(result)); + } else { + response = FL_METHOD_RESPONSE( + fl_method_success_response_new(fl_value_new_null())); + } + fl_method_call_respond(method_call, response, nullptr); +} + +static void method_call_cb(FlMethodChannel* channel, + FlMethodCall* method_call, + gpointer user_data) { + BlePlugin* plugin = BLE_PLUGIN(user_data); + ble_plugin_handle_method_call(plugin, method_call); +} + +void ble_plugin_register_with_registrar(FlPluginRegistrar* registrar) { + BlePlugin* plugin = BLE_PLUGIN(g_object_new(ble_plugin_get_type(), nullptr)); + g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); + g_autoptr(FlMethodChannel) channel = fl_method_channel_new( + fl_plugin_registrar_get_messenger(registrar), + "com.dalimaster.ble", + FL_METHOD_CODEC(codec)); + fl_method_channel_set_method_call_handler(channel, method_call_cb, + g_object_ref(plugin), + g_object_unref); + g_object_unref(plugin); +} + +static void ble_plugin_class_init(BlePluginClass* klass) {} + +static void ble_plugin_init(BlePlugin* self) {} \ No newline at end of file diff --git a/linux/ble_plugin.h b/linux/ble_plugin.h new file mode 100644 index 0000000..070d40c --- /dev/null +++ b/linux/ble_plugin.h @@ -0,0 +1,16 @@ +#ifndef FLUTTER_PLUGIN_BLE_PLUGIN_H_ +#define FLUTTER_PLUGIN_BLE_PLUGIN_H_ + +#include + +G_BEGIN_DECLS + +#define BLE_PLUGIN_TYPE (ble_plugin_get_type()) + +G_DECLARE_FINAL_TYPE(BlePlugin, ble_plugin, BLE, PLUGIN, GObject) + +void ble_plugin_register_with_registrar(FlPluginRegistrar* registrar); + +G_END_DECLS + +#endif // FLUTTER_PLUGIN_BLE_PLUGIN_H_ \ No newline at end of file diff --git a/linux/ble_relay_host_plugin.cc b/linux/ble_relay_host_plugin.cc deleted file mode 100644 index c055a92..0000000 --- a/linux/ble_relay_host_plugin.cc +++ /dev/null @@ -1,48 +0,0 @@ -#include "ble_relay_host_plugin.h" -#include - -#define BLE_RELAY_HOST_PLUGIN(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), ble_relay_host_plugin_get_type(), BleRelayHostPlugin)) - -struct _BleRelayHostPlugin { - GObject parent_instance; -}; - -G_DEFINE_TYPE(BleRelayHostPlugin, ble_relay_host_plugin, g_object_get_type()) - -static void ble_relay_host_plugin_handle_method_call( - BleRelayHostPlugin* self, - FlMethodCall* method_call) { - g_autoptr(FlMethodResponse) response = nullptr; - const gchar* method = fl_method_call_get_name(method_call); - if (strcmp(method, "isSupported") == 0) { - g_autoptr(FlValue) result = fl_value_new_bool(FALSE); - response = FL_METHOD_RESPONSE(fl_method_success_response_new(result)); - } else { - response = FL_METHOD_RESPONSE(fl_method_success_response_new(fl_value_new_null())); - } - fl_method_call_respond(method_call, response, nullptr); -} - -static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call, - gpointer user_data) { - BleRelayHostPlugin* plugin = BLE_RELAY_HOST_PLUGIN(user_data); - ble_relay_host_plugin_handle_method_call(plugin, method_call); -} - -void ble_relay_host_plugin_register_with_registrar(FlPluginRegistrar* registrar) { - BleRelayHostPlugin* plugin = BLE_RELAY_HOST_PLUGIN( - g_object_new(ble_relay_host_plugin_get_type(), nullptr)); - g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); - g_autoptr(FlMethodChannel) channel = - fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar), - "com.dalimaster.ble_relay_host", - FL_METHOD_CODEC(codec)); - fl_method_channel_set_method_call_handler(channel, method_call_cb, - g_object_ref(plugin), - g_object_unref); - g_object_unref(plugin); -} - -static void ble_relay_host_plugin_class_init(BleRelayHostPluginClass* klass) {} -static void ble_relay_host_plugin_init(BleRelayHostPlugin* self) {} diff --git a/linux/ble_relay_host_plugin.h b/linux/ble_relay_host_plugin.h deleted file mode 100644 index 3979134..0000000 --- a/linux/ble_relay_host_plugin.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef FLUTTER_PLUGIN_BLE_RELAY_HOST_PLUGIN_H_ -#define FLUTTER_PLUGIN_BLE_RELAY_HOST_PLUGIN_H_ - -#include - -G_BEGIN_DECLS - -#define BLE_RELAY_HOST_PLUGIN_TYPE (ble_relay_host_plugin_get_type()) - -G_DECLARE_FINAL_TYPE(BleRelayHostPlugin, ble_relay_host_plugin, BLE_RELAY_HOST, PLUGIN, GObject) - -void ble_relay_host_plugin_register_with_registrar(FlPluginRegistrar* registrar); - -G_END_DECLS - -#endif // FLUTTER_PLUGIN_BLE_RELAY_HOST_PLUGIN_H_ diff --git a/macos/Classes/BleRelayHostPlugin.swift b/macos/Classes/BlePlugin.swift similarity index 70% rename from macos/Classes/BleRelayHostPlugin.swift rename to macos/Classes/BlePlugin.swift index f3a3107..7e5521e 100644 --- a/macos/Classes/BleRelayHostPlugin.swift +++ b/macos/Classes/BlePlugin.swift @@ -1,13 +1,13 @@ import Foundation import FlutterMacOS -/// macOS stub — BLE peripheral mode not yet implemented. -public class BleRelayHostPlugin: NSObject, FlutterPlugin { +/// macOS stub - BLE peripheral mode not yet implemented. +public class BlePlugin: NSObject, FlutterPlugin { public static func register(with registrar: FlutterPluginRegistrar) { let channel = FlutterMethodChannel( - name: "com.dalimaster.ble_relay_host", + name: "com.dalimaster.ble", binaryMessenger: registrar.messenger) - let instance = BleRelayHostPlugin() + let instance = BlePlugin() registrar.addMethodCallDelegate(instance, channel: channel) } @@ -19,4 +19,4 @@ public class BleRelayHostPlugin: NSObject, FlutterPlugin { result(nil) } } -} +} \ No newline at end of file diff --git a/macos/ble_relay_host.podspec b/macos/ble.podspec similarity index 94% rename from macos/ble_relay_host.podspec rename to macos/ble.podspec index edc87a2..23b3c73 100644 --- a/macos/ble_relay_host.podspec +++ b/macos/ble.podspec @@ -1,5 +1,5 @@ Pod::Spec.new do |s| - s.name = 'ble_relay_host' + s.name = 'ble' s.version = '0.1.0' s.summary = 'BLE GATT-server peripheral host for the DALI relay feature.' s.description = <<-DESC diff --git a/pubspec.yaml b/pubspec.yaml index 996000f..5c62e93 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: ble_relay_host +name: ble description: "BLE GATT-server peripheral host adapter for the DALI Toolkit relay feature. Provides a simple start/stop/push API backed by platform-specific BLE advertising." version: 0.1.0 publish_to: none @@ -21,13 +21,13 @@ flutter: plugin: platforms: android: - package: com.dalimaster.ble_relay_host - pluginClass: BleRelayHostPlugin + package: com.dalimaster.ble + pluginClass: BlePlugin ios: - pluginClass: BleRelayHostPlugin + pluginClass: BlePlugin macos: - pluginClass: BleRelayHostPlugin + pluginClass: BlePlugin linux: - pluginClass: BleRelayHostPlugin + pluginClass: BlePlugin windows: - pluginClass: BleRelayHostPluginCApi + pluginClass: BlePluginCApi diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index 81e54dd..7d45e5c 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -1,17 +1,17 @@ cmake_minimum_required(VERSION 3.14) -set(PROJECT_NAME "ble_relay_host") +set(PROJECT_NAME "ble") project(${PROJECT_NAME} LANGUAGES CXX) cmake_policy(VERSION 3.14...3.25) -set(PLUGIN_NAME "ble_relay_host_plugin") +set(PLUGIN_NAME "ble_plugin") list(APPEND PLUGIN_SOURCES - "ble_relay_host_plugin.cpp" + "ble_plugin.cpp" ) add_library(${PLUGIN_NAME} SHARED - "include/ble_relay_host/ble_relay_host_plugin_c_api.h" + "include/ble/ble_plugin_c_api.h" ${PLUGIN_SOURCES} ) @@ -22,7 +22,7 @@ target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) -set(ble_relay_host_bundled_libraries +set(ble_bundled_libraries "" PARENT_SCOPE ) diff --git a/windows/ble_relay_host_plugin.cpp b/windows/ble_plugin.cpp similarity index 69% rename from windows/ble_relay_host_plugin.cpp rename to windows/ble_plugin.cpp index 0f2f0ab..b266599 100644 --- a/windows/ble_relay_host_plugin.cpp +++ b/windows/ble_plugin.cpp @@ -1,20 +1,20 @@ -#include "ble_relay_host_plugin.h" +#include "ble_plugin.h" -// Windows stub — BLE peripheral not yet implemented. +// Windows stub - BLE peripheral not yet implemented. #include #include #include -namespace ble_relay_host { +namespace ble { -class BleRelayHostPlugin : public flutter::Plugin { +class BlePlugin : public flutter::Plugin { public: static void RegisterWithRegistrar(flutter::PluginRegistrarWindows* registrar) { auto channel = std::make_unique>( - registrar->messenger(), "com.dalimaster.ble_relay_host", + registrar->messenger(), "com.dalimaster.ble", &flutter::StandardMethodCodec::GetInstance()); - auto plugin = std::make_unique(); + auto plugin = std::make_unique(); channel->SetMethodCallHandler( [plugin_pointer = plugin.get()](const auto& call, auto result) { plugin_pointer->HandleMethodCall(call, std::move(result)); @@ -22,8 +22,8 @@ class BleRelayHostPlugin : public flutter::Plugin { registrar->AddPlugin(std::move(plugin)); } - BleRelayHostPlugin() {} - virtual ~BleRelayHostPlugin() {} + BlePlugin() {} + virtual ~BlePlugin() {} private: void HandleMethodCall( @@ -37,11 +37,11 @@ class BleRelayHostPlugin : public flutter::Plugin { } }; -} // namespace ble_relay_host +} // namespace ble -void BleRelayHostPluginCApiRegisterWithRegistrar( +void BlePluginCApiRegisterWithRegistrar( FlutterDesktopPluginRegistrarRef registrar) { - ble_relay_host::BleRelayHostPlugin::RegisterWithRegistrar( + ble::BlePlugin::RegisterWithRegistrar( flutter::PluginRegistrarManager::GetInstance() ->GetRegistrar(registrar)); -} +} \ No newline at end of file diff --git a/windows/ble_relay_host_plugin.h b/windows/ble_plugin.h similarity index 60% rename from windows/ble_relay_host_plugin.h rename to windows/ble_plugin.h index 3ee4540..a40338f 100644 --- a/windows/ble_relay_host_plugin.h +++ b/windows/ble_plugin.h @@ -1,5 +1,5 @@ -#ifndef FLUTTER_PLUGIN_BLE_RELAY_HOST_PLUGIN_H_ -#define FLUTTER_PLUGIN_BLE_RELAY_HOST_PLUGIN_H_ +#ifndef FLUTTER_PLUGIN_BLE_PLUGIN_H_ +#define FLUTTER_PLUGIN_BLE_PLUGIN_H_ #include @@ -13,11 +13,11 @@ extern "C" { #endif -FLUTTER_PLUGIN_EXPORT void BleRelayHostPluginCApiRegisterWithRegistrar( +FLUTTER_PLUGIN_EXPORT void BlePluginCApiRegisterWithRegistrar( FlutterDesktopPluginRegistrarRef registrar); #if defined(__cplusplus) } // extern "C" #endif -#endif // FLUTTER_PLUGIN_BLE_RELAY_HOST_PLUGIN_H_ +#endif // FLUTTER_PLUGIN_BLE_PLUGIN_H_ \ No newline at end of file diff --git a/windows/include/ble/ble_plugin_c_api.h b/windows/include/ble/ble_plugin_c_api.h new file mode 100644 index 0000000..7ef1102 --- /dev/null +++ b/windows/include/ble/ble_plugin_c_api.h @@ -0,0 +1,23 @@ +#ifndef FLUTTER_PLUGIN_BLE_PLUGIN_C_API_H_ +#define FLUTTER_PLUGIN_BLE_PLUGIN_C_API_H_ + +#include + +#ifdef FLUTTER_PLUGIN_IMPL +#define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) +#else +#define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +FLUTTER_PLUGIN_EXPORT void BlePluginCApiRegisterWithRegistrar( + FlutterDesktopPluginRegistrarRef registrar); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // FLUTTER_PLUGIN_BLE_PLUGIN_C_API_H_ \ No newline at end of file