diff --git a/packages/tizen_log/CHANGELOG.md b/packages/tizen_log/CHANGELOG.md index b21c90c9a..0086030c4 100644 --- a/packages/tizen_log/CHANGELOG.md +++ b/packages/tizen_log/CHANGELOG.md @@ -2,6 +2,7 @@ * Omit obvious local variable types. * Reformat with a line length of 100. +* Use wrapper API. ## 0.1.3 diff --git a/packages/tizen_log/lib/tizen_log.dart b/packages/tizen_log/lib/tizen_log.dart index c054aee3b..c61a04c3b 100644 --- a/packages/tizen_log/lib/tizen_log.dart +++ b/packages/tizen_log/lib/tizen_log.dart @@ -6,8 +6,8 @@ import 'dart:ffi'; import 'package:ffi/ffi.dart'; -typedef _DlogPrintNative = Void Function(Int32, Pointer, Pointer, Pointer); -typedef _DlogPrint = void Function(int, Pointer, Pointer, Pointer); +typedef _DlogPrintNative = Int Function(Int, Pointer, Pointer); +typedef _DlogPrint = int Function(int, Pointer, Pointer); /// Provides the ability to use Tizen's logging service, dlog. /// @@ -20,10 +20,10 @@ typedef _DlogPrint = void Function(int, Pointer, Pointer, Pointer>('dlog_print').asFunction(); + _library.lookup>('ftpw_tizen_log_dlog_print').asFunction(); static final RegExp _stackTraceRegExp = RegExp( r'^#(\d+)\s+(.+)\((.+\.dart):(\d+)(:\d+)?\)$', @@ -166,11 +166,9 @@ class Log { message = '${file ?? "-"}: ${func ?? "-"}(${line ?? "-"}) > $message'; } final Pointer tagPtr = tag.toNativeUtf8(); - final Pointer formatPtr = '%s'.toNativeUtf8(); final Pointer messagePtr = message.toNativeUtf8(); - _dlogPrint(priority.value, tagPtr, formatPtr, messagePtr); + _dlogPrint(priority.value, tagPtr, messagePtr); malloc.free(tagPtr); - malloc.free(formatPtr); malloc.free(messagePtr); } diff --git a/packages/tizen_log/pubspec.yaml b/packages/tizen_log/pubspec.yaml index 44db843ab..9113cbd13 100644 --- a/packages/tizen_log/pubspec.yaml +++ b/packages/tizen_log/pubspec.yaml @@ -10,3 +10,10 @@ environment: dependencies: ffi: ">=1.1.2 <3.0.0" + +flutter: + plugin: + platforms: + tizen: + pluginClass: TizenLogPlugin + fileName: tizen_log_plugin.h diff --git a/packages/tizen_log/tizen/.gitignore b/packages/tizen_log/tizen/.gitignore new file mode 100644 index 000000000..a2a7d62b1 --- /dev/null +++ b/packages/tizen_log/tizen/.gitignore @@ -0,0 +1,5 @@ +.cproject +.sign +crash-info/ +Debug/ +Release/ diff --git a/packages/tizen_log/tizen/inc/ftpw_tizen_log.h b/packages/tizen_log/tizen/inc/ftpw_tizen_log.h new file mode 100644 index 000000000..3f72402fb --- /dev/null +++ b/packages/tizen_log/tizen/inc/ftpw_tizen_log.h @@ -0,0 +1,17 @@ +// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#ifndef FLUTTER_TIZEN_PLUGINS_WRAPPER_TIZEN_LOG_H_ +#define FLUTTER_TIZEN_PLUGINS_WRAPPER_TIZEN_LOG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int ftpw_tizen_log_dlog_print(int priority, const char *tag, const char *message); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/packages/tizen_log/tizen/inc/tizen_log_plugin.h b/packages/tizen_log/tizen/inc/tizen_log_plugin.h new file mode 100644 index 000000000..947de4caf --- /dev/null +++ b/packages/tizen_log/tizen/inc/tizen_log_plugin.h @@ -0,0 +1,27 @@ +// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_PLUGIN_TIZEN_LOG_PLUGIN_H_ +#define FLUTTER_PLUGIN_TIZEN_LOG_PLUGIN_H_ + +#include + +#ifdef FLUTTER_PLUGIN_IMPL +#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) +#else +#define FLUTTER_PLUGIN_EXPORT +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +FLUTTER_PLUGIN_EXPORT void TizenLogPluginRegisterWithRegistrar( + FlutterDesktopPluginRegistrarRef registrar); + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // FLUTTER_PLUGIN_TIZEN_LOG_PLUGIN_H_ diff --git a/packages/tizen_log/tizen/lib/aarch64/libftpw_tizen_log.so b/packages/tizen_log/tizen/lib/aarch64/libftpw_tizen_log.so new file mode 100755 index 000000000..c06a272fc Binary files /dev/null and b/packages/tizen_log/tizen/lib/aarch64/libftpw_tizen_log.so differ diff --git a/packages/tizen_log/tizen/lib/armel/libftpw_tizen_log.so b/packages/tizen_log/tizen/lib/armel/libftpw_tizen_log.so new file mode 100755 index 000000000..e8796dc29 Binary files /dev/null and b/packages/tizen_log/tizen/lib/armel/libftpw_tizen_log.so differ diff --git a/packages/tizen_log/tizen/lib/i586/libftpw_tizen_log.so b/packages/tizen_log/tizen/lib/i586/libftpw_tizen_log.so new file mode 100755 index 000000000..ffa20470d Binary files /dev/null and b/packages/tizen_log/tizen/lib/i586/libftpw_tizen_log.so differ diff --git a/packages/tizen_log/tizen/lib/x86_64/libftpw_tizen_log.so b/packages/tizen_log/tizen/lib/x86_64/libftpw_tizen_log.so new file mode 100755 index 000000000..885caa947 Binary files /dev/null and b/packages/tizen_log/tizen/lib/x86_64/libftpw_tizen_log.so differ diff --git a/packages/tizen_log/tizen/project_def.prop b/packages/tizen_log/tizen/project_def.prop new file mode 100644 index 000000000..ff6d9c868 --- /dev/null +++ b/packages/tizen_log/tizen/project_def.prop @@ -0,0 +1,24 @@ +# See https://docs.tizen.org/application/tizen-studio/native-tools/project-conversion +# for details. + +APPNAME = tizen_log_plugin +type = staticLib +profile = common-5.5 + +# Source files +USER_SRCS += src/*.cc + +# User defines +USER_DEFS = +USER_UNDEFS = +USER_CPP_DEFS = FLUTTER_PLUGIN_IMPL +USER_CPP_UNDEFS = + +# User includes +USER_INC_DIRS = inc src +USER_INC_FILES = +USER_CPP_INC_FILES = + +# User libraries +USER_LIB_DIRS += lib/${BUILD_ARCH} +USER_LIBS += ftpw_tizen_log diff --git a/packages/tizen_log/tizen/src/tizen_log_plugin.cc b/packages/tizen_log/tizen/src/tizen_log_plugin.cc new file mode 100644 index 000000000..5d3345e73 --- /dev/null +++ b/packages/tizen_log/tizen/src/tizen_log_plugin.cc @@ -0,0 +1,7 @@ +// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "tizen_log_plugin.h" + +void TizenLogPluginRegisterWithRegistrar(FlutterDesktopPluginRegistrarRef) {}