diff --git a/packages/device_info_plus/device_info_plus_aurora/.gitignore b/packages/device_info_plus/device_info_plus_aurora/.gitignore new file mode 100644 index 0000000..96486fd --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/.gitignore @@ -0,0 +1,30 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/packages/device_info_plus/device_info_plus_aurora/README.md b/packages/device_info_plus/device_info_plus_aurora/README.md new file mode 100644 index 0000000..b85db91 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/README.md @@ -0,0 +1,55 @@ +# device_info_plus_aurora + +The Aurora implementation of [`device_info_plus`](https://pub.dev/packages/device_info_plus). + +Permission: `DeviceInfo`. + +Information available: + +- `id` - Target platform. +- `name` - Name OS. +- `version` - Versions OS. +- `prettyName` - Name and version OS. +- `hasGNSS` - The presence of GNSS in the device. +- `hasNFC` - The presence of NFC in the device. +- `hasBluetooth` - The presence of bluetooth in the device. +- `hasWlan` - The presence of wlan in the device. +- `maxCpuClockSpeed` - Max CPU clock speed. +- `numberCpuCores` - Number CPU cores. +- `batteryChargePercentage` - Device battery charge percentage. +- `mainCameraResolution` - Device main camera resolution. +- `frontalCameraResolution` - Device frontal camera resolution. +- `ramTotalSize` - Size total ram. +- `ramFreeSize` - Size free ram. +- `screenResolution` - Device screen resolution. +- `osVersion` - Name and version OS. +- `deviceModel` - Device name model. +- `internalStorage` - Map with information on internal storage. +- `internalStorage` - Map with information on internal storage. +- `simCards` - Array with information about SIM cards. + +## Usage + +This package is not an _endorsed_ implementation of `device_info_plus`. +Therefore, you have to include `device_info_plus_aurora` alongside `device_info_plus` as dependencies in your `pubspec.yaml` file. + +**pubspec.yaml** + +```yaml +dependencies: + device_info_plus: ^9.0.1 + device_info_plus_aurora: + path: # path to folder with plugin +``` + +***.dart** + +```dart +import 'package:device_info_plus/device_info_plus.dart'; + +final deviceInfoPlugin = DeviceInfoPlugin(); +final deviceInfo = await deviceInfoPlugin.linuxInfo as AuroraDeviceInfo; + +debutPrint(deviceInfo.data); +``` + diff --git a/packages/device_info_plus/device_info_plus_aurora/analysis_options.yaml b/packages/device_info_plus/device_info_plus_aurora/analysis_options.yaml new file mode 100644 index 0000000..566c597 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/analysis_options.yaml @@ -0,0 +1,4 @@ +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +include: package:flutter_lints/flutter.yaml diff --git a/packages/device_info_plus/device_info_plus_aurora/data/preview.png b/packages/device_info_plus/device_info_plus_aurora/data/preview.png new file mode 100644 index 0000000..b7d356e Binary files /dev/null and b/packages/device_info_plus/device_info_plus_aurora/data/preview.png differ diff --git a/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.Features.xml b/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.Features.xml new file mode 100644 index 0000000..3c38d5a --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.Features.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.SIM.xml b/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.SIM.xml new file mode 100644 index 0000000..0b2bc14 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.SIM.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.Storages.xml b/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.Storages.xml new file mode 100644 index 0000000..d7fbd32 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/data/ru.omp.deviceinfo.Storages.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/device_info_plus/device_info_plus_aurora/example/.gitignore b/packages/device_info_plus/device_info_plus_aurora/example/.gitignore new file mode 100644 index 0000000..3db3823 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/.gitignore @@ -0,0 +1,47 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +# Aurora generated +/aurora/flutter diff --git a/packages/device_info_plus/device_info_plus_aurora/example/README.md b/packages/device_info_plus/device_info_plus_aurora/example/README.md new file mode 100644 index 0000000..ae0d7d1 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/README.md @@ -0,0 +1,21 @@ +# device_info_plus_aurora + +Demonstrates how to use the device_info_plus plugin. + +## Build + +```shell +# Add an alias if it doesn't already exist +alias flutter-aurora=$HOME/.local/opt/flutter-sdk/bin/flutter +# Get dependencies +flutter-aurora pub get +# Run build +flutter-aurora build aurora --release # [--release|--debug|--profile] +``` + +You can collect, sign, run an example on the device with a script located in the `script/build_example.sh` +More information in `build_example.sh`. + +### Preview example + +![preview.png](../data/preview.png) diff --git a/packages/device_info_plus/device_info_plus_aurora/example/analysis_options.yaml b/packages/device_info_plus/device_info_plus_aurora/example/analysis_options.yaml new file mode 100644 index 0000000..566c597 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/analysis_options.yaml @@ -0,0 +1,4 @@ +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +include: package:flutter_lints/flutter.yaml diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/.gitignore b/packages/device_info_plus/device_info_plus_aurora/example/aurora/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/aurora/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/CMakeLists.txt b/packages/device_info_plus/device_info_plus_aurora/example/aurora/CMakeLists.txt new file mode 100644 index 0000000..ef6d32e --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/aurora/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +cmake_minimum_required(VERSION 3.10) +project(com.example.device_info_plus_aurora_example LANGUAGES CXX) + +include(GNUInstallDirs) + +set(BINARY_NAME ${CMAKE_PROJECT_NAME}) +set(FLUTTER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/flutter) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +set(CMAKE_SKIP_RPATH OFF) +set(CMAKE_INSTALL_RPATH "\$ORIGIN/../share/${BINARY_NAME}/lib") + +find_package(PkgConfig REQUIRED) +pkg_check_modules(FlutterEmbedder REQUIRED IMPORTED_TARGET flutter-embedder) + +add_executable(${BINARY_NAME} main.cpp ${FLUTTER_DIR}/generated_plugin_registrant.cpp) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::FlutterEmbedder) +target_include_directories(${BINARY_NAME} PRIVATE ${FLUTTER_DIR}) + +include(flutter/generated_plugins.cmake) + +set(PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${BINARY_NAME}) +set(DESKTOP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/applications) +set(ICONS_INSTALL_ROOT_DIR ${CMAKE_INSTALL_DATADIR}/icons/hicolor) + +add_custom_command(TARGET ${BINARY_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libflutter-embedder.so + ${PROJECT_BINARY_DIR}/bundle/lib/libflutter-embedder.so) + +install(FILES ${PROJECT_BINARY_DIR}/bundle/icudtl.dat DESTINATION ${PACKAGE_INSTALL_DIR}) +install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/flutter_assets DESTINATION ${PACKAGE_INSTALL_DIR}) +install(DIRECTORY ${PROJECT_BINARY_DIR}/bundle/lib DESTINATION ${PACKAGE_INSTALL_DIR}) + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES desktop/${BINARY_NAME}.desktop DESTINATION ${DESKTOP_INSTALL_DIR}) + +foreach(ICONS_SIZE 86x86 108x108 128x128 172x172) + install(FILES icons/${ICONS_SIZE}.png + RENAME ${BINARY_NAME}.png + DESTINATION ${ICONS_INSTALL_ROOT_DIR}/${ICONS_SIZE}/apps/) +endforeach(ICONS_SIZE) diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/desktop/com.example.device_info_plus_aurora_example.desktop b/packages/device_info_plus/device_info_plus_aurora/example/aurora/desktop/com.example.device_info_plus_aurora_example.desktop new file mode 100644 index 0000000..88c8b51 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/aurora/desktop/com.example.device_info_plus_aurora_example.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Application +Name=device_info_plus_aurora_example +Comment=Demonstrates how to use the device_info_plus_aurora plugin. +Icon=com.example.device_info_plus_aurora_example +Exec=/usr/bin/com.example.device_info_plus_aurora_example +X-Nemo-Application-Type=silica-qt5 + +[X-Application] +Permissions=DeviceInfo +OrganizationName=com.example +ApplicationName=device_info_plus_aurora_example diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/108x108.png b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/108x108.png new file mode 100644 index 0000000..984893d Binary files /dev/null and b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/108x108.png differ diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/128x128.png b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/128x128.png new file mode 100644 index 0000000..2d552ef Binary files /dev/null and b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/128x128.png differ diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/172x172.png b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/172x172.png new file mode 100644 index 0000000..9dc271b Binary files /dev/null and b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/172x172.png differ diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/86x86.png b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/86x86.png new file mode 100644 index 0000000..5923bb1 Binary files /dev/null and b/packages/device_info_plus/device_info_plus_aurora/example/aurora/icons/86x86.png differ diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/main.cpp b/packages/device_info_plus/device_info_plus_aurora/example/aurora/main.cpp new file mode 100644 index 0000000..83f2ca8 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/aurora/main.cpp @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +#include +#include "generated_plugin_registrant.h" + +int main(int argc, char *argv[]) { + Application::Initialize(argc, argv); + RegisterPlugins(); + Application::Launch(); + return 0; +} diff --git a/packages/device_info_plus/device_info_plus_aurora/example/aurora/rpm/com.example.device_info_plus_aurora_example.spec b/packages/device_info_plus/device_info_plus_aurora/example/aurora/rpm/com.example.device_info_plus_aurora_example.spec new file mode 100644 index 0000000..8706033 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/aurora/rpm/com.example.device_info_plus_aurora_example.spec @@ -0,0 +1,31 @@ +%global __provides_exclude_from ^%{_datadir}/%{name}/lib/.*$ +%global __requires_exclude ^lib(dconf|flutter-embedder|maliit-glib|appmanifest-.+|.+_platform_plugin)\\.so.*$ + +Name: com.example.device_info_plus_aurora_example +Summary: Demonstrates how to use the device_info_plus_aurora plugin. +Version: 0.1.0 +Release: 1 +License: Proprietary +Source0: %{name}-%{version}.tar.zst + +BuildRequires: cmake +BuildRequires: pkgconfig(flutter-embedder) + +%description +%{summary}. + +%prep +%autosetup + +%build +%cmake -DCMAKE_BUILD_TYPE=%{_flutter_build_type} +%make_build + +%install +%make_install + +%files +%{_bindir}/%{name} +%{_datadir}/%{name}/* +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}.png diff --git a/packages/device_info_plus/device_info_plus_aurora/example/lib/main.dart b/packages/device_info_plus/device_info_plus_aurora/example/lib/main.dart new file mode 100644 index 0000000..26c9b63 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/lib/main.dart @@ -0,0 +1,389 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +import 'package:device_info_plus_aurora/aurora_device_info.dart'; +import 'package:flutter/material.dart'; +import 'dart:async'; + +import 'package:device_info_plus/device_info_plus.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + String? _error; + String? _id; + String? _name; + String? _version; + String? _prettyName; + bool? _hasGNSS; + bool? _hasNFC; + bool? _hasBluetooth; + bool? _hasWlan; + int? _maxCpuClockSpeed; + int? _numberCpuCores; + int? _batteryChargePercentage; + double? _mainCameraResolution; + double? _frontalCameraResolution; + int? _ramTotalSize; + int? _ramFreeSize; + String? _screenResolution; + String? _osVersion; + String? _deviceModel; + Map? _externalStorage; + Map? _internalStorage; + List>? _simCards; + + @override + void initState() { + super.initState(); + initPlatformState(); + } + + // Platform messages are asynchronous, so we initialize in an async method. + Future initPlatformState() async { + final deviceInfoPlugin = DeviceInfoPlugin(); + + try { + final deviceInfo = await deviceInfoPlugin.linuxInfo as AuroraDeviceInfo; + setState(() { + _id = deviceInfo.id; + _name = deviceInfo.name; + _version = deviceInfo.version; + _prettyName = deviceInfo.prettyName; + _hasGNSS = deviceInfo.hasGNSS; + _hasNFC = deviceInfo.hasNFC; + _hasBluetooth = deviceInfo.hasBluetooth; + _hasWlan = deviceInfo.hasWlan; + _maxCpuClockSpeed = deviceInfo.maxCpuClockSpeed; + _numberCpuCores = deviceInfo.numberCpuCores; + _batteryChargePercentage = deviceInfo.batteryChargePercentage; + _mainCameraResolution = deviceInfo.mainCameraResolution; + _frontalCameraResolution = deviceInfo.frontalCameraResolution; + _ramTotalSize = deviceInfo.ramTotalSize; + _ramFreeSize = deviceInfo.ramFreeSize; + _screenResolution = deviceInfo.screenResolution; + _osVersion = deviceInfo.osVersion; + _deviceModel = deviceInfo.deviceModel; + _externalStorage = deviceInfo.externalStorage; + _internalStorage = deviceInfo.internalStorage; + _simCards = deviceInfo.simCards; + }); + } on Exception catch (e) { + setState(() { + _error = e.toString(); + }); + } + } + + @override + Widget build(BuildContext context) { + const textStyleWhite = TextStyle(fontSize: 18, color: Colors.white); + const textStyleTitle = TextStyle(fontSize: 20, color: Colors.black); + const textStylePath = TextStyle(fontSize: 18, color: Colors.black54); + + const spaceMedium = SizedBox(height: 20); + const spaceSmall = SizedBox(height: 10); + + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Example device_info_plus'), + ), + body: Stack( + children: [ + // Error message + Visibility( + visible: _error != null, + child: Center( + child: Padding( + padding: const EdgeInsets.all(16), + child: Container( + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + color: Colors.redAccent, + borderRadius: BorderRadius.all(Radius.circular(10.0)), + ), + child: Text( + _error ?? '', + style: textStyleWhite, + ), + ), + ), + ), + ), + // List directories path + Visibility( + visible: _error == null, + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16), + child: Center( + child: Column( + children: [ + // Info + Container( + padding: const EdgeInsets.all(20), + decoration: const BoxDecoration( + color: Colors.green, + borderRadius: + BorderRadius.all(Radius.circular(10.0)), + ), + child: const Text( + 'Demo application demonstration implementation of device_info_plus', + style: textStyleWhite, + textAlign: TextAlign.center, + ), + ), + const SizedBox(height: 30), + + const Text( + 'ID', + style: textStyleTitle, + ), + spaceSmall, + Text( + _id.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Name', + style: textStyleTitle, + ), + spaceSmall, + Text( + _name.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Version', + style: textStyleTitle, + ), + spaceSmall, + Text( + _version.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Pretty Name', + style: textStyleTitle, + ), + spaceSmall, + Text( + _prettyName.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Has GNSS', + style: textStyleTitle, + ), + spaceSmall, + Text( + _hasGNSS.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Has NFC', + style: textStyleTitle, + ), + spaceSmall, + Text( + _hasNFC.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Has Bluetooth', + style: textStyleTitle, + ), + spaceSmall, + Text( + _hasBluetooth.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Has Wlan', + style: textStyleTitle, + ), + spaceSmall, + Text( + _hasWlan.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Max Cpu Clock Speed', + style: textStyleTitle, + ), + spaceSmall, + Text( + _maxCpuClockSpeed.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Number Cpu Cores', + style: textStyleTitle, + ), + spaceSmall, + Text( + _numberCpuCores.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Battery Charge Percentage', + style: textStyleTitle, + ), + spaceSmall, + Text( + _batteryChargePercentage.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Main Camera Resolution', + style: textStyleTitle, + ), + spaceSmall, + Text( + _mainCameraResolution.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Frontal Camera Resolution', + style: textStyleTitle, + ), + spaceSmall, + Text( + _frontalCameraResolution.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Ram Total Size', + style: textStyleTitle, + ), + spaceSmall, + Text( + _ramTotalSize.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Ram Free Size', + style: textStyleTitle, + ), + spaceSmall, + Text( + _ramFreeSize.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Screen Resolution', + style: textStyleTitle, + ), + spaceSmall, + Text( + _screenResolution.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'OS Version', + style: textStyleTitle, + ), + spaceSmall, + Text( + _osVersion.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Device Model', + style: textStyleTitle, + ), + spaceSmall, + Text( + _deviceModel.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'External Storage Info', + style: textStyleTitle, + ), + spaceSmall, + Text( + _externalStorage.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'Internal Storage Info', + style: textStyleTitle, + ), + spaceSmall, + Text( + _internalStorage.toString(), + style: textStylePath, + ), + + spaceMedium, + const Text( + 'SIM Cards Info', + style: textStyleTitle, + ), + spaceSmall, + Text( + _simCards.toString(), + style: textStylePath, + ), + ], + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/packages/device_info_plus/device_info_plus_aurora/example/pubspec.lock b/packages/device_info_plus/device_info_plus_aurora/example/pubspec.lock new file mode 100644 index 0000000..98de599 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/pubspec.lock @@ -0,0 +1,257 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.1" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.9.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.16.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + dbus: + dependency: transitive + description: + name: dbus + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.8" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.2" + device_info_plus_aurora: + dependency: "direct main" + description: + path: ".." + relative: true + source: path + version: "0.0.1" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "7.0.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.4" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.4" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.2" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.12" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.4" + win32_registry: + dependency: transitive + description: + name: win32_registry + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" +sdks: + dart: ">=2.18.6 <3.0.0" + flutter: ">=3.3.0" diff --git a/packages/device_info_plus/device_info_plus_aurora/example/pubspec.yaml b/packages/device_info_plus/device_info_plus_aurora/example/pubspec.yaml new file mode 100644 index 0000000..4ccd339 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/example/pubspec.yaml @@ -0,0 +1,26 @@ +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +name: device_info_plus_aurora_example +description: Demonstrates how to use the device_info_plus_aurora plugin. + +publish_to: 'none' + +environment: + sdk: '>=2.18.6 <3.0.0' + +dependencies: + flutter: + sdk: flutter + device_info_plus: ^9.0.1 + device_info_plus_aurora: + path: ../ + cupertino_icons: ^1.0.2 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + uses-material-design: true diff --git a/packages/device_info_plus/device_info_plus_aurora/lib/aurora_device_info.dart b/packages/device_info_plus/device_info_plus_aurora/lib/aurora_device_info.dart new file mode 100644 index 0000000..687524c --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/lib/aurora_device_info.dart @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +import 'package:device_info_plus/device_info_plus.dart'; + +class AuroraDeviceInfo implements LinuxDeviceInfo { + /// Constructs a AuroraDeviceInfo. + AuroraDeviceInfo({ + required this.hasGNSS, + required this.hasNFC, + required this.hasBluetooth, + required this.hasWlan, + required this.maxCpuClockSpeed, + required this.numberCpuCores, + required this.batteryChargePercentage, + required this.mainCameraResolution, + required this.frontalCameraResolution, + required this.ramTotalSize, + required this.ramFreeSize, + required this.screenResolution, + required this.osVersion, + required this.deviceModel, + required this.externalStorage, + required this.internalStorage, + required this.simCards, + }); + + @override + String get id => 'aurora'; + + @override + String get name => osVersion.split(' ').first; + + @override + String? get version => osVersion.split(' ').last; + + @override + String get prettyName => osVersion; + + final bool hasGNSS; + final bool hasNFC; + final bool hasBluetooth; + final bool hasWlan; + final int maxCpuClockSpeed; + final int numberCpuCores; + final int batteryChargePercentage; + final double mainCameraResolution; + final double frontalCameraResolution; + final int ramTotalSize; + final int ramFreeSize; + final String screenResolution; + final String osVersion; + final String deviceModel; + final Map externalStorage; + final Map internalStorage; + final List> simCards; + + @override + Map get data => { + 'id': id, + 'name': name, + 'version': version, + 'prettyName': prettyName, + 'hasGNSS': hasGNSS, + 'hasNFC': hasNFC, + 'hasBluetooth': hasBluetooth, + 'hasWlan': hasWlan, + 'maxCpuClockSpeed': maxCpuClockSpeed, + 'numberCpuCores': numberCpuCores, + 'batteryChargePercentage': batteryChargePercentage, + 'mainCameraResolution': mainCameraResolution, + 'frontalCameraResolution': frontalCameraResolution, + 'ramTotalSize': ramTotalSize, + 'ramFreeSize': ramFreeSize, + 'screenResolution': screenResolution, + 'osVersion': osVersion, + 'deviceModel': deviceModel, + 'externalStorage': externalStorage, + 'internalStorage': internalStorage, + 'simCards': simCards, + }; + + @override + String? get buildId => null; + + @override + List? get idLike => null; + + @override + String? get machineId => null; + + @override + String? get variant => null; + + @override + String? get variantId => null; + + @override + String? get versionCodename => null; + + @override + String? get versionId => null; + + @Deprecated('Use [data] getter instead') + @override + Map toMap() { + return data; + } +} diff --git a/packages/device_info_plus/device_info_plus_aurora/lib/device_info_plus_aurora.dart b/packages/device_info_plus/device_info_plus_aurora/lib/device_info_plus_aurora.dart new file mode 100644 index 0000000..df96320 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/lib/device_info_plus_aurora.dart @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +import 'package:dbus/dbus.dart'; +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:device_info_plus_aurora/ru_omp_deviceinfo_features.dart'; +import 'package:device_info_plus_aurora/ru_omp_deviceinfo_sim.dart'; +import 'package:device_info_plus_aurora/ru_omp_deviceinfo_storages.dart'; +import 'package:device_info_plus_platform_interface/device_info_plus_platform_interface.dart'; +import 'package:flutter/foundation.dart'; +import 'aurora_device_info.dart'; + +class DeviceInfoPlusAurora extends DeviceInfoPlatform { + /// Register this dart class as the platform implementation for aurora + static void registerWith() { + if (TargetPlatform.aurora == defaultTargetPlatform) { + DeviceInfoPlatform.instance = DeviceInfoPlusAurora(); + } else { + DeviceInfoPlatform.instance = DeviceInfoPlusLinuxPlugin(); + } + } + + @override + Future deviceInfo() async { + final client = DBusClient.session(); + + // Features + final features = RuOmpDeviceinfoFeatures(client, 'ru.omp.deviceinfo', + DBusObjectPath('/ru/omp/deviceinfo/Features')); + + final hasGNSS = await features.callhasGNSS(); + final hasNFC = await features.callhasNFC(); + final hasBluetooth = await features.callhasBluetooth(); + final hasWlan = await features.callhasWlan(); + final maxCpuClockSpeed = await features.callgetMaxCpuClockSpeed(); + final numberCpuCores = await features.callgetNumberCpuCores(); + final batteryChargePercentage = + await features.callgetBatteryChargePercentage(); + final mainCameraResolution = await features.callgetMainCameraResolution(); + final frontalCameraResolution = + await features.callgetFrontalCameraResolution(); + final ramTotalSize = await features.callgetRamTotalSize(); + final ramFreeSize = await features.callgetRamFreeSize(); + final screenResolution = await features.callgetScreenResolution(); + final osVersion = await features.callgetOsVersion(); + final deviceModel = await features.callgetDeviceModel(); + + // Storages + final storages = RuOmpDeviceinfoStorages(client, 'ru.omp.deviceinfo', + DBusObjectPath('/ru/omp/deviceinfo/Storages')); + + final Map internalStorage = {}; + (await storages.callgetInternalStorageInfo()).forEach((key, value) { + internalStorage[key] = value.toNative(); + }); + + final Map externalStorage = {}; + (await storages.callgetExternalStorageInfo()).forEach((key, value) { + externalStorage[key] = value.toNative(); + }); + + // SIM + final infoSIM = RuOmpDeviceinfoSIM( + client, 'ru.omp.deviceinfo', DBusObjectPath('/ru/omp/deviceinfo/SIM')); + + final List> simCards = []; + for (var element in await infoSIM.callgetSimCardsInfo()) { + final Map simCard = {}; + element.forEach((key, value) { + simCard[key] = value.toNative(); + }); + simCards.add(simCard); + } + + await client.close(); + + return AuroraDeviceInfo( + hasGNSS: hasGNSS, + hasNFC: hasNFC, + hasBluetooth: hasBluetooth, + hasWlan: hasWlan, + maxCpuClockSpeed: maxCpuClockSpeed, + numberCpuCores: numberCpuCores, + batteryChargePercentage: batteryChargePercentage, + mainCameraResolution: mainCameraResolution, + frontalCameraResolution: frontalCameraResolution, + ramTotalSize: ramTotalSize, + ramFreeSize: ramFreeSize, + screenResolution: screenResolution, + osVersion: osVersion, + deviceModel: deviceModel, + externalStorage: externalStorage, + internalStorage: internalStorage, + simCards: simCards, + ); + } +} diff --git a/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_features.dart b/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_features.dart new file mode 100644 index 0000000..dd1def9 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_features.dart @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +import 'package:dbus/dbus.dart'; + +/// Signal data for ru.omp.deviceinfo.Features.cameraEnabledChanged. +class RuOmpDeviceinfoFeaturescameraEnabledChanged extends DBusSignal { + bool get enabled => values[0].asBoolean(); + + RuOmpDeviceinfoFeaturescameraEnabledChanged(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); +} + +class RuOmpDeviceinfoFeatures extends DBusRemoteObject { + /// Stream of ru.omp.deviceinfo.Features.cameraEnabledChanged signals. + late final Stream + cameraEnabledChanged; + + RuOmpDeviceinfoFeatures( + DBusClient client, String destination, DBusObjectPath path) + : super(client, name: destination, path: path) { + cameraEnabledChanged = DBusRemoteObjectSignalStream( + object: this, + interface: 'ru.omp.deviceinfo.Features', + name: 'cameraEnabledChanged', + signature: DBusSignature('b')) + .asBroadcastStream() + .map((signal) => RuOmpDeviceinfoFeaturescameraEnabledChanged(signal)); + } + + /// Invokes ru.omp.deviceinfo.Features.hasGNSS() + Future callhasGNSS( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod('ru.omp.deviceinfo.Features', 'hasGNSS', [], + replySignature: DBusSignature('b'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asBoolean(); + } + + /// Invokes ru.omp.deviceinfo.Features.hasNFC() + Future callhasNFC( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod('ru.omp.deviceinfo.Features', 'hasNFC', [], + replySignature: DBusSignature('b'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asBoolean(); + } + + /// Invokes ru.omp.deviceinfo.Features.hasBluetooth() + Future callhasBluetooth( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'hasBluetooth', [], + replySignature: DBusSignature('b'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asBoolean(); + } + + /// Invokes ru.omp.deviceinfo.Features.hasWlan() + Future callhasWlan( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod('ru.omp.deviceinfo.Features', 'hasWlan', [], + replySignature: DBusSignature('b'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asBoolean(); + } + + /// Invokes ru.omp.deviceinfo.Features.getMaxCpuClockSpeed() + Future callgetMaxCpuClockSpeed( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getMaxCpuClockSpeed', [], + replySignature: DBusSignature('u'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asUint32(); + } + + /// Invokes ru.omp.deviceinfo.Features.getNumberCpuCores() + Future callgetNumberCpuCores( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getNumberCpuCores', [], + replySignature: DBusSignature('u'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asUint32(); + } + + /// Invokes ru.omp.deviceinfo.Features.getCpuModel() + Future callgetCpuModel( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getCpuModel', [], + replySignature: DBusSignature('s'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asString(); + } + + /// Invokes ru.omp.deviceinfo.Features.getMaxCpuCoresClockSpeed() + Future> callgetMaxCpuCoresClockSpeed( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getMaxCpuCoresClockSpeed', [], + replySignature: DBusSignature('av'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asVariantArray().toList(); + } + + /// Invokes ru.omp.deviceinfo.Features.getBatteryChargePercentage() + Future callgetBatteryChargePercentage( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getBatteryChargePercentage', [], + replySignature: DBusSignature('u'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asUint32(); + } + + /// Invokes ru.omp.deviceinfo.Features.getMainCameraResolution() + Future callgetMainCameraResolution( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getMainCameraResolution', [], + replySignature: DBusSignature('d'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asDouble(); + } + + /// Invokes ru.omp.deviceinfo.Features.getFrontalCameraResolution() + Future callgetFrontalCameraResolution( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getFrontalCameraResolution', [], + replySignature: DBusSignature('d'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asDouble(); + } + + /// Invokes ru.omp.deviceinfo.Features.getRamTotalSize() + Future callgetRamTotalSize( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getRamTotalSize', [], + replySignature: DBusSignature('t'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asUint64(); + } + + /// Invokes ru.omp.deviceinfo.Features.getRamFreeSize() + Future callgetRamFreeSize( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getRamFreeSize', [], + replySignature: DBusSignature('t'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asUint64(); + } + + /// Invokes ru.omp.deviceinfo.Features.getScreenResolution() + Future callgetScreenResolution( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getScreenResolution', [], + replySignature: DBusSignature('s'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asString(); + } + + /// Invokes ru.omp.deviceinfo.Features.getOsVersion() + Future callgetOsVersion( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getOsVersion', [], + replySignature: DBusSignature('s'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asString(); + } + + /// Invokes ru.omp.deviceinfo.Features.getDeviceModel() + Future callgetDeviceModel( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getDeviceModel', [], + replySignature: DBusSignature('s'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asString(); + } + + /// Invokes ru.omp.deviceinfo.Features.getSerialNumber() + Future callgetSerialNumber( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Features', 'getSerialNumber', [], + replySignature: DBusSignature('s'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asString(); + } +} diff --git a/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_sim.dart b/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_sim.dart new file mode 100644 index 0000000..96ef17d --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_sim.dart @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +import 'package:dbus/dbus.dart'; + +/// Signal data for ru.omp.deviceinfo.SIM.simCardsEnabledChanged. +class RuOmpDeviceinfoSIMsimCardsEnabledChanged extends DBusSignal { + List> get updatedSimCards => + values[0].asArray().map((child) => child.asStringVariantDict()).toList(); + + RuOmpDeviceinfoSIMsimCardsEnabledChanged(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); +} + +/// Signal data for ru.omp.deviceinfo.SIM.preferredDataTransferSimChanged. +class RuOmpDeviceinfoSIMpreferredDataTransferSimChanged extends DBusSignal { + List> get updatedSimCards => + values[0].asArray().map((child) => child.asStringVariantDict()).toList(); + + RuOmpDeviceinfoSIMpreferredDataTransferSimChanged(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); +} + +/// Signal data for ru.omp.deviceinfo.SIM.preferredVoiceCallSimChanged. +class RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged extends DBusSignal { + List> get updatedSimCards => + values[0].asArray().map((child) => child.asStringVariantDict()).toList(); + + RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); +} + +class RuOmpDeviceinfoSIM extends DBusRemoteObject { + /// Stream of ru.omp.deviceinfo.SIM.simCardsEnabledChanged signals. + late final Stream + simCardsEnabledChanged; + + /// Stream of ru.omp.deviceinfo.SIM.preferredDataTransferSimChanged signals. + late final Stream + preferredDataTransferSimChanged; + + /// Stream of ru.omp.deviceinfo.SIM.preferredVoiceCallSimChanged signals. + late final Stream + preferredVoiceCallSimChanged; + + RuOmpDeviceinfoSIM(DBusClient client, String destination, DBusObjectPath path) + : super(client, name: destination, path: path) { + simCardsEnabledChanged = DBusRemoteObjectSignalStream( + object: this, + interface: 'ru.omp.deviceinfo.SIM', + name: 'simCardsEnabledChanged', + signature: DBusSignature('aa{sv}')) + .asBroadcastStream() + .map((signal) => RuOmpDeviceinfoSIMsimCardsEnabledChanged(signal)); + + preferredDataTransferSimChanged = DBusRemoteObjectSignalStream( + object: this, + interface: 'ru.omp.deviceinfo.SIM', + name: 'preferredDataTransferSimChanged', + signature: DBusSignature('aa{sv}')) + .asBroadcastStream() + .map((signal) => + RuOmpDeviceinfoSIMpreferredDataTransferSimChanged(signal)); + + preferredVoiceCallSimChanged = DBusRemoteObjectSignalStream( + object: this, + interface: 'ru.omp.deviceinfo.SIM', + name: 'preferredVoiceCallSimChanged', + signature: DBusSignature('aa{sv}')) + .asBroadcastStream() + .map( + (signal) => RuOmpDeviceinfoSIMpreferredVoiceCallSimChanged(signal)); + } + + /// Invokes ru.omp.deviceinfo.SIM.getSimCardsInfo() + Future>> callgetSimCardsInfo( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.SIM', 'getSimCardsInfo', [], + replySignature: DBusSignature('aa{sv}'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0] + .asArray() + .map((child) => child.asStringVariantDict()) + .toList(); + } +} diff --git a/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_storages.dart b/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_storages.dart new file mode 100644 index 0000000..18fcd5e --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/lib/ru_omp_deviceinfo_storages.dart @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023. Open Mobile Platform LLC. + * License: Proprietary. + */ +import 'package:dbus/dbus.dart'; + +/// Signal data for ru.omp.deviceinfo.Storages.externalStorageChanged. +class RuOmpDeviceinfoStoragesexternalStorageChanged extends DBusSignal { + Map get updatedStorage => values[0].asStringVariantDict(); + + RuOmpDeviceinfoStoragesexternalStorageChanged(DBusSignal signal) + : super( + sender: signal.sender, + path: signal.path, + interface: signal.interface, + name: signal.name, + values: signal.values); +} + +class RuOmpDeviceinfoStorages extends DBusRemoteObject { + /// Stream of ru.omp.deviceinfo.Storages.externalStorageChanged signals. + late final Stream + externalStorageChanged; + + RuOmpDeviceinfoStorages( + DBusClient client, String destination, DBusObjectPath path) + : super(client, name: destination, path: path) { + externalStorageChanged = DBusRemoteObjectSignalStream( + object: this, + interface: 'ru.omp.deviceinfo.Storages', + name: 'externalStorageChanged', + signature: DBusSignature('a{sv}')) + .asBroadcastStream() + .map((signal) => RuOmpDeviceinfoStoragesexternalStorageChanged(signal)); + } + + /// Invokes ru.omp.deviceinfo.Storages.getInternalStorageInfo() + Future> callgetInternalStorageInfo( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Storages', 'getInternalStorageInfo', [], + replySignature: DBusSignature('a{sv}'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asStringVariantDict(); + } + + /// Invokes ru.omp.deviceinfo.Storages.getInternalUserPartitionInfo() + Future> callgetInternalUserPartitionInfo( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Storages', 'getInternalUserPartitionInfo', [], + replySignature: DBusSignature('a{sv}'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asStringVariantDict(); + } + + /// Invokes ru.omp.deviceinfo.Storages.getExternalStorageInfo() + Future> callgetExternalStorageInfo( + {bool noAutoStart = false, + bool allowInteractiveAuthorization = false}) async { + var result = await callMethod( + 'ru.omp.deviceinfo.Storages', 'getExternalStorageInfo', [], + replySignature: DBusSignature('a{sv}'), + noAutoStart: noAutoStart, + allowInteractiveAuthorization: allowInteractiveAuthorization); + return result.returnValues[0].asStringVariantDict(); + } +} diff --git a/packages/device_info_plus/device_info_plus_aurora/pubspec.yaml b/packages/device_info_plus/device_info_plus_aurora/pubspec.yaml new file mode 100644 index 0000000..7953d23 --- /dev/null +++ b/packages/device_info_plus/device_info_plus_aurora/pubspec.yaml @@ -0,0 +1,29 @@ +# Copyright (c) 2023. Open Mobile Platform LLC. +# License: Proprietary. + +name: device_info_plus_aurora +description: The Aurora OS implementation of flutter_local_notifications. +version: 0.0.1 + +environment: + sdk: '>=2.18.6 <3.0.0' + flutter: ">=2.5.0" + +dependencies: + flutter: + sdk: flutter + dbus: ^0.7.8 + device_info_plus: ^9.0.1 + plugin_platform_interface: ^2.0.2 + device_info_plus_platform_interface: ^7.0.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^2.0.0 + +flutter: + plugin: + platforms: + aurora: + dartPluginClass: DeviceInfoPlusAurora