Открыть боковую панель
Aurora OS
Kotlin Multiplatform
Libraries
Aurora KInterop
Коммиты
957d1c86
Коммит
957d1c86
создал
Июл 17, 2025
по автору
Зарубин Виталий Викторович
Просмотр файлов
feat: add spotless
владелец
5dcd0564
Изменения
43
Скрыть пробелы
Построчно
Рядом
AUTHORS.md
0 → 100644
Просмотр файла @
957d1c86
# Authors
*
Vitaliy Zarubin,
<v.zarubin@omp.ru>
*
Developer, 2025
LICENSE
0 → 100644
Просмотр файла @
957d1c86
# The 3-Clause BSD License
_Copyright (C) 2025. Open Mobile Platform LLC._
Redistribution and use in source and binary forms,
with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain
the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md
Просмотр файла @
957d1c86
[
**EN**
](
README.md
)
|
[
RU
](
README.ru.md
)
# Aurora KInterop
# Aurora KInterop
A Multiplatform library that provides convenient functionality for Kotlin Multiplatform applications
Kotlin Multiplatform libraries provide convenient functionality for interacting with Aurora OS.
to interact with the Aurora OS via
[
Aurora Cinterop
](
https://os-git.omprussia.ru/non-oss/kmp/aurora-cinterop
)
.
### Libs
### Libs
...
...
README.ru.md
0 → 100644
Просмотр файла @
957d1c86
[
**EN**
](
README.md
)
|
[
RU
](
README.ru.md
)
# Aurora KInterop
Библиотеки Kotlin Multiplatform предоставляют удобный функционал для взаимодействия с ОС Aurora.
### Libs
-
[
Battery Info
](
ak-battery-info/README.md
)
.
-
[
Camera Info
](
ak-camera-info/README.md
)
.
-
[
Connectivity Info
](
ak-connectivity-info/README.md
)
.
-
[
Device Info
](
ak-device-info/README.md
)
.
-
[
Local Notification
](
ak-local-notification/README.md
)
.
-
[
Location Info
](
ak-location-info/README.md
)
.
-
[
Package Info
](
ak-package-info/README.md
)
.
-
[
Path Info
](
ak-path-info/README.md
)
.
-
[
Sensors Info
](
ak-sensors-info/README.md
)
.
-
[
Share Data
](
ak-share-data/README.md
)
.
-
[
Shared Preferences
](
ak-shared-preferences/README.md
)
.
-
[
Shared Preferences Secure
](
ak-shared-preferences-secure/README.md
)
.
-
[
Theme Info
](
ak-theme-info/README.md
)
.
-
[
Uri Launcher
](
ak-uri-launcher/README.md
)
.
-
[
Vibration
](
ak-vibration/README.md
)
.
-
[
WakeLock
](
ak-wakelock/README.md
)
.
### Build
```
shell
./gradlew build publishToMavenLocal
```
ak-battery-info/src/commonMain/kotlin/ru/auroraos/kmp/batteryInfo/BatteryInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.batteryInfo
package
ru.auroraos.kmp.batteryInfo
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -17,25 +21,24 @@ object BatteryInfo {
...
@@ -17,25 +21,24 @@ object BatteryInfo {
/**
/**
* Battery charge level.
* Battery charge level.
*/
*/
fun
getLevel
():
Int
{
fun
getLevel
():
Int
=
libac
.
ac_battery_info_level
()
return
libac
.
ac_battery_info_level
()
}
/**
/**
* Battery charger status.
* Battery charger status.
*/
*/
fun
isCharger
():
Boolean
{
fun
isCharger
():
Boolean
=
libac
.
ac_battery_info_charger_state
().
toKString
().
lowercase
()
==
"on"
return
libac
.
ac_battery_info_charger_state
().
toKString
().
lowercase
()
==
"on"
}
/**
/**
* Listen charger state.
* Listen charger state.
*/
*/
fun
listenCharger
(
callback
:
(
ULong
,
Boolean
)
->
Unit
):
ULong
{
fun
listenCharger
(
callback
:
(
ULong
,
Boolean
)
->
Unit
):
ULong
{
val
stableRef
=
StableRef
.
create
(
callback
)
val
stableRef
=
StableRef
.
create
(
callback
)
val
id
=
libac
.
ac_battery_info_listen_charger
(
staticCFunction
{
id
,
value
,
data
->
val
id
=
libac
.
ac_battery_info_listen_charger
(
data
?.
asStableRef
<(
ULong
,
Boolean
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
value
.
toKString
().
lowercase
()
==
"on"
)
staticCFunction
{
id
,
value
,
data
->
},
stableRef
.
asCPointer
())
data
?.
asStableRef
<(
ULong
,
Boolean
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
value
.
toKString
().
lowercase
()
==
"on"
)
},
stableRef
.
asCPointer
(),
)
if
(
id
!=
0UL
)
{
if
(
id
!=
0UL
)
{
callbacks
.
put
(
id
,
stableRef
)
callbacks
.
put
(
id
,
stableRef
)
}
}
...
...
ak-camera-info/src/commonMain/kotlin/ru/auroraos/kmp/cameraInfo/CameraInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.cameraInfo
package
ru.auroraos.kmp.cameraInfo
import
kotlinx.cinterop.ExperimentalForeignApi
import
kotlinx.cinterop.ExperimentalForeignApi
...
@@ -10,16 +14,12 @@ object CameraInfo {
...
@@ -10,16 +14,12 @@ object CameraInfo {
/**
/**
* Getting information about cameras.
* Getting information about cameras.
*/
*/
fun
getInfoList
():
List
<
CameraInfoData
>
{
fun
getInfoList
():
List
<
CameraInfoData
>
=
memScoped
{
return
memScoped
{
libac
.
ac_camera_info_list
().
toKListCameraInfoData
()
libac
.
ac_camera_info_list
().
toKListCameraInfoData
()
}
}
}
/**
/**
* Getting information about the number of cameras.
* Getting information about the number of cameras.
*/
*/
fun
getInfoCount
():
ULong
{
fun
getInfoCount
():
ULong
=
libac
.
ac_camera_info_count
()
return
libac
.
ac_camera_info_count
()
}
}
}
ak-camera-info/src/commonMain/kotlin/ru/auroraos/kmp/cameraInfo/data/CameraInfoData.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.cameraInfo.data
package
ru.auroraos.kmp.cameraInfo.data
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -27,7 +31,7 @@ internal fun CValue<libac.Vec_AcciCameraInfo>?.toKListCameraInfoData(): List<Cam
...
@@ -27,7 +31,7 @@ internal fun CValue<libac.Vec_AcciCameraInfo>?.toKListCameraInfoData(): List<Cam
name
=
value
.
name
.
toKString
(),
name
=
value
.
name
.
toKString
(),
provider
=
value
.
provider
.
toKString
(),
provider
=
value
.
provider
.
toKString
(),
mountAngle
=
value
.
mount_angle
,
mountAngle
=
value
.
mount_angle
,
)
)
,
)
)
}
}
libac
.
ac_camera_info_info_free
(
this
)
libac
.
ac_camera_info_info_free
(
this
)
...
...
ak-camera-info/src/commonMain/kotlin/ru/auroraos/kmp/cameraInfo/utils/
cinterop
.kt
→
ak-camera-info/src/commonMain/kotlin/ru/auroraos/kmp/cameraInfo/utils/
Converts
.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.cameraInfo.utils
package
ru.auroraos.kmp.cameraInfo.utils
import
kotlinx.cinterop.*
import
kotlinx.cinterop.*
...
...
ak-connectivity-info/src/commonMain/kotlin/ru/auroraos/kmp/connectivityInfo/ConnectivityInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.connectivityInfo
package
ru.auroraos.kmp.connectivityInfo
import
kotlinx.cinterop.ExperimentalForeignApi
import
kotlinx.cinterop.ExperimentalForeignApi
...
@@ -6,7 +10,13 @@ import kotlinx.cinterop.asStableRef
...
@@ -6,7 +10,13 @@ import kotlinx.cinterop.asStableRef
import
kotlinx.cinterop.staticCFunction
import
kotlinx.cinterop.staticCFunction
enum
class
ConnectivityInfoState
{
enum
class
ConnectivityInfoState
{
None
,
Bluetooth
,
Wifi
,
Ethernet
,
Mobile
,
Vpn
,
Other
None
,
Bluetooth
,
Wifi
,
Ethernet
,
Mobile
,
Vpn
,
Other
,
}
}
@OptIn
(
ExperimentalForeignApi
::
class
)
@OptIn
(
ExperimentalForeignApi
::
class
)
...
@@ -16,19 +26,20 @@ object ConnectivityInfo {
...
@@ -16,19 +26,20 @@ object ConnectivityInfo {
/**
/**
* State is online.
* State is online.
*/
*/
fun
isOnline
():
Boolean
{
fun
isOnline
():
Boolean
=
libac
.
ac_connectivity_info_is_online
()
return
libac
.
ac_connectivity_info_is_online
()
}
/**
/**
* Listen change state.
* Listen change state.
*/
*/
fun
listen
(
callback
:
(
ULong
,
ConnectivityInfoState
)
->
Unit
):
ULong
{
fun
listen
(
callback
:
(
ULong
,
ConnectivityInfoState
)
->
Unit
):
ULong
{
val
stableRef
=
StableRef
.
create
(
callback
)
val
stableRef
=
StableRef
.
create
(
callback
)
val
id
=
libac
.
ac_connectivity_info_listen
(
staticCFunction
{
id
,
value
,
data
->
val
id
=
libac
.
ac_connectivity_info_listen
(
val
state
=
ConnectivityInfoState
.
entries
.
toTypedArray
().
getOrElse
(
value
)
{
ConnectivityInfoState
.
None
}
staticCFunction
{
id
,
value
,
data
->
data
?.
asStableRef
<(
ULong
,
ConnectivityInfoState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
state
)
val
state
=
ConnectivityInfoState
.
entries
.
toTypedArray
().
getOrElse
(
value
)
{
ConnectivityInfoState
.
None
}
},
stableRef
.
asCPointer
())
data
?.
asStableRef
<(
ULong
,
ConnectivityInfoState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
state
)
},
stableRef
.
asCPointer
(),
)
if
(
id
!=
0UL
)
{
if
(
id
!=
0UL
)
{
callbacks
.
put
(
id
,
stableRef
)
callbacks
.
put
(
id
,
stableRef
)
}
}
...
...
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/info/DeviceInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.info
package
ru.auroraos.kmp.deviceInfo.info
import
kotlinx.cinterop.ExperimentalForeignApi
import
kotlinx.cinterop.ExperimentalForeignApi
...
@@ -11,105 +15,75 @@ object DeviceInfo {
...
@@ -11,105 +15,75 @@ object DeviceInfo {
/**
/**
* Unique device identifier.
* Unique device identifier.
*/
*/
fun
id
():
String
{
fun
id
():
String
=
libac
.
ac_device_info_device_id
().
toKString
()
return
libac
.
ac_device_info_device_id
().
toKString
()
}
/**
/**
* Global Navigation Satellite System.
* Global Navigation Satellite System.
*/
*/
fun
hasGNSS
():
Boolean
{
fun
hasGNSS
():
Boolean
=
libac
.
ac_device_info_has_gnss
()
return
libac
.
ac_device_info_has_gnss
()
}
/**
/**
* Near Field Communication.
* Near Field Communication.
*/
*/
fun
hasNFC
():
Boolean
{
fun
hasNFC
():
Boolean
=
libac
.
ac_device_info_has_nfc
()
return
libac
.
ac_device_info_has_nfc
()
}
/**
/**
* Short-range wireless technology standard.
* Short-range wireless technology standard.
*/
*/
fun
hasBluetooth
():
Boolean
{
fun
hasBluetooth
():
Boolean
=
libac
.
ac_device_info_has_bluetooth
()
return
libac
.
ac_device_info_has_bluetooth
()
}
/**
/**
* Wireless Local Area Network.
* Wireless Local Area Network.
*/
*/
fun
hasWlan
():
Boolean
{
fun
hasWlan
():
Boolean
=
libac
.
ac_device_info_has_wlan
()
return
libac
.
ac_device_info_has_wlan
()
}
/**
/**
* The highest reported CPU clock speed.
* The highest reported CPU clock speed.
*/
*/
fun
getMaxCpuClockSpeed
():
UInt
{
fun
getMaxCpuClockSpeed
():
UInt
=
libac
.
ac_device_info_get_max_cpu_clock_speed
()
return
libac
.
ac_device_info_get_max_cpu_clock_speed
()
}
/**
/**
* Number of cores of the system.
* Number of cores of the system.
*/
*/
fun
getNumberCpuCores
():
UInt
{
fun
getNumberCpuCores
():
UInt
=
libac
.
ac_device_info_get_number_cpu_cores
()
return
libac
.
ac_device_info_get_number_cpu_cores
()
}
/**
/**
* Current battery charge in percentage.
* Current battery charge in percentage.
*/
*/
fun
getBatteryChargePercentage
():
UInt
{
fun
getBatteryChargePercentage
():
UInt
=
libac
.
ac_device_info_get_battery_charge_percentage
()
return
libac
.
ac_device_info_get_battery_charge_percentage
()
}
/**
/**
* Main camera resolution.
* Main camera resolution.
*/
*/
fun
getMainCameraResolution
():
Double
{
fun
getMainCameraResolution
():
Double
=
libac
.
ac_device_info_get_main_camera_resolution
()
return
libac
.
ac_device_info_get_main_camera_resolution
()
}
/**
/**
* Frontal camera resolution.
* Frontal camera resolution.
*/
*/
fun
getFrontalCameraResolution
():
Double
{
fun
getFrontalCameraResolution
():
Double
=
libac
.
ac_device_info_get_frontal_camera_resolution
()
return
libac
.
ac_device_info_get_frontal_camera_resolution
()
}
/**
/**
* Random-access memory total size.
* Random-access memory total size.
*/
*/
fun
getRamTotalSize
():
ULong
{
fun
getRamTotalSize
():
ULong
=
libac
.
ac_device_info_get_ram_total_size
()
return
libac
.
ac_device_info_get_ram_total_size
()
}
/**
/**
* Random-access memory free size.
* Random-access memory free size.
*/
*/
fun
getRamFreeSize
():
ULong
{
fun
getRamFreeSize
():
ULong
=
libac
.
ac_device_info_get_ram_free_size
()
return
libac
.
ac_device_info_get_ram_free_size
()
}
/**
/**
* The clarity and detail of visuals displayed on a device.
* The clarity and detail of visuals displayed on a device.
*/
*/
fun
getScreenResolution
():
String
{
fun
getScreenResolution
():
String
=
libac
.
ac_device_info_get_screen_resolution
().
toKString
()
return
libac
.
ac_device_info_get_screen_resolution
().
toKString
()
}
/**
/**
* Operating system version.
* Operating system version.
*/
*/
fun
getOsVersion
():
String
{
fun
getOsVersion
():
String
=
libac
.
ac_device_info_get_os_version
().
toKString
()
return
libac
.
ac_device_info_get_os_version
().
toKString
()
}
/**
/**
* Device model name.
* Device model name.
*/
*/
fun
getDeviceModel
():
String
{
fun
getDeviceModel
():
String
=
libac
.
ac_device_info_get_device_model
().
toKString
()
return
libac
.
ac_device_info_get_device_model
().
toKString
()
}
}
}
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/sim/DeviceSim.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.sim
package
ru.auroraos.kmp.deviceInfo.sim
import
kotlinx.cinterop.ExperimentalForeignApi
import
kotlinx.cinterop.ExperimentalForeignApi
...
@@ -13,9 +17,7 @@ object DeviceSim {
...
@@ -13,9 +17,7 @@ object DeviceSim {
/**
/**
* Information about the device's SIM cards.
* Information about the device's SIM cards.
*/
*/
fun
getSimCardsInfo
():
List
<
SimCardData
>
{
fun
getSimCardsInfo
():
List
<
SimCardData
>
=
memScoped
{
return
memScoped
{
libac
.
ac_device_info_get_sim_cards_info
().
toKListSimCardData
()
libac
.
ac_device_info_get_sim_cards_info
().
toKListSimCardData
()
}
}
}
}
}
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/sim/data/SimCardData.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.sim.data
package
ru.auroraos.kmp.deviceInfo.sim.data
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -29,7 +33,7 @@ internal fun CValue<libac.Vec_AcdiSimCard>?.toKListSimCardData(): List<SimCardDa
...
@@ -29,7 +33,7 @@ internal fun CValue<libac.Vec_AcdiSimCard>?.toKListSimCardData(): List<SimCardDa
preferredDataTransfer
=
value
.
preferred_data_transfer
,
preferredDataTransfer
=
value
.
preferred_data_transfer
,
preferredVoiceCall
=
value
.
preferred_voice_call
,
preferredVoiceCall
=
value
.
preferred_voice_call
,
simName
=
value
.
sim_name
.
toKString
(),
simName
=
value
.
sim_name
.
toKString
(),
)
)
,
)
)
}
}
libac
.
ac_device_info_vec_sim_card_free
(
this
)
libac
.
ac_device_info_vec_sim_card_free
(
this
)
...
...
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/storage/DeviceStorage.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.storage
package
ru.auroraos.kmp.deviceInfo.storage
import
kotlinx.cinterop.ExperimentalForeignApi
import
kotlinx.cinterop.ExperimentalForeignApi
...
@@ -15,18 +19,14 @@ object DeviceStorage {
...
@@ -15,18 +19,14 @@ object DeviceStorage {
/**
/**
* Information on external storage the device.
* Information on external storage the device.
*/
*/
fun
getExternalInfo
():
ExternalStorageInfoData
{
fun
getExternalInfo
():
ExternalStorageInfoData
=
memScoped
{
return
memScoped
{
libac
.
ac_device_info_get_external_storage_info
().
toKExternalStorageInfoData
()
libac
.
ac_device_info_get_external_storage_info
().
toKExternalStorageInfoData
()
}
}
}
/**
/**
* Information on internal storage the device.
* Information on internal storage the device.
*/
*/
fun
getInternalInfo
():
InternalStorageInfoData
{
fun
getInternalInfo
():
InternalStorageInfoData
=
memScoped
{
return
memScoped
{
libac
.
ac_device_info_get_internal_storage_info
().
toKInternalStorageInfoData
()
libac
.
ac_device_info_get_internal_storage_info
().
toKInternalStorageInfoData
()
}
}
}
}
}
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/storage/data/ExternalStorageInfoData.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.storage.data
package
ru.auroraos.kmp.deviceInfo.storage.data
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -15,13 +19,11 @@ data class ExternalStorageInfoData(
...
@@ -15,13 +19,11 @@ data class ExternalStorageInfoData(
)
)
@OptIn
(
ExperimentalForeignApi
::
class
)
@OptIn
(
ExperimentalForeignApi
::
class
)
internal
fun
CValue
<
libac
.
AcdiExternalStorageInfo
>
?.
toKExternalStorageInfoData
():
ExternalStorageInfoData
{
internal
fun
CValue
<
libac
.
AcdiExternalStorageInfo
>
?.
toKExternalStorageInfoData
():
ExternalStorageInfoData
=
ExternalStorageInfoData
(
return
ExternalStorageInfoData
(
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
countMountedPartitions
=
this
?.
useContents
{
count_mounted_partitions
}
?:
0U
,
countMountedPartitions
=
this
?.
useContents
{
count_mounted_partitions
}
?:
0U
,
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
mounted
=
this
?.
useContents
{
mounted
}
?:
false
,
mounted
=
this
?.
useContents
{
mounted
}
?:
false
,
)
)
}
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/storage/data/InternalStorageData.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.storage.data
package
ru.auroraos.kmp.deviceInfo.storage.data
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -14,12 +18,10 @@ data class InternalStorageInfoData(
...
@@ -14,12 +18,10 @@ data class InternalStorageInfoData(
)
)
@OptIn
(
ExperimentalForeignApi
::
class
)
@OptIn
(
ExperimentalForeignApi
::
class
)
internal
fun
CValue
<
libac
.
AcdiInternalStorageInfo
>
?.
toKInternalStorageInfoData
():
InternalStorageInfoData
{
internal
fun
CValue
<
libac
.
AcdiInternalStorageInfo
>
?.
toKInternalStorageInfoData
():
InternalStorageInfoData
=
InternalStorageInfoData
(
return
InternalStorageInfoData
(
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
filesystemType
=
this
?.
useContents
{
filesystem_type
}.
toKString
(),
filesystemType
=
this
?.
useContents
{
filesystem_type
}.
toKString
(),
)
)
}
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/utils/
cinterop
.kt
→
ak-device-info/src/commonMain/kotlin/ru/auroraos/kmp/deviceInfo/utils/
Converts
.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.deviceInfo.utils
package
ru.auroraos.kmp.deviceInfo.utils
import
kotlinx.cinterop.*
import
kotlinx.cinterop.*
...
...
ak-local-notification/src/commonMain/kotlin/ru/auroraos/kmp/localNotification/LocalNotification.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.localNotification
package
ru.auroraos.kmp.localNotification
import
kotlinx.cinterop.*
import
kotlinx.cinterop.*
...
@@ -11,22 +15,18 @@ object LocalNotification {
...
@@ -11,22 +15,18 @@ object LocalNotification {
title
:
String
,
title
:
String
,
summary
:
String
,
summary
:
String
,
body
:
String
,
body
:
String
,
):
UInt
{
):
UInt
=
memScoped
{
return
memScoped
{
libac
.
ac_local_notification_notify
(
libac
.
ac_local_notification_notify
(
stringToSaferC
(
title
),
stringToSaferC
(
title
),
stringToSaferC
(
summary
),
stringToSaferC
(
summary
),
stringToSaferC
(
body
),
stringToSaferC
(
body
),
)
)
}
}
}
/**
/**
* Close local notification by ID.
* Close local notification by ID.
*/
*/
fun
close
(
id
:
UInt
):
Boolean
{
fun
close
(
id
:
UInt
):
Boolean
=
libac
.
ac_local_notification_close
(
id
)
return
libac
.
ac_local_notification_close
(
id
)
}
}
}
@OptIn
(
ExperimentalForeignApi
::
class
)
@OptIn
(
ExperimentalForeignApi
::
class
)
...
@@ -38,4 +38,3 @@ internal fun MemScope.stringToSaferC(value: String): CPointer<libac.Vec_uint8> {
...
@@ -38,4 +38,3 @@ internal fun MemScope.stringToSaferC(value: String): CPointer<libac.Vec_uint8> {
cStruct
.
ptr
=
cValues
.
ptr
cStruct
.
ptr
=
cValues
.
ptr
return
interpretCPointer
(
cStruct
.
rawPtr
)
!!
return
interpretCPointer
(
cStruct
.
rawPtr
)
!!
}
}
ak-location-info/src/commonMain/kotlin/ru/auroraos/kmp/locationInfo/LocationInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.locationInfo
package
ru.auroraos.kmp.locationInfo
import
kotlinx.cinterop.ExperimentalForeignApi
import
kotlinx.cinterop.ExperimentalForeignApi
...
@@ -6,7 +10,10 @@ import kotlinx.cinterop.asStableRef
...
@@ -6,7 +10,10 @@ import kotlinx.cinterop.asStableRef
import
kotlinx.cinterop.staticCFunction
import
kotlinx.cinterop.staticCFunction
enum
class
LocationMethod
{
enum
class
LocationMethod
{
Undefined
,
Network
,
Satellite
,
All
Undefined
,
Network
,
Satellite
,
All
,
}
}
data class
LocationState
(
data class
LocationState
(
...
@@ -22,25 +29,24 @@ object LocationInfo {
...
@@ -22,25 +29,24 @@ object LocationInfo {
/**
/**
* Check is supported.
* Check is supported.
*/
*/
fun
isSupported
():
Boolean
{
fun
isSupported
():
Boolean
=
libac
.
ac_location_info_is_supported
()
return
libac
.
ac_location_info_is_supported
()
}
/**
/**
* Get listen location method.
* Get listen location method.
*/
*/
fun
getMethod
(
id
:
ULong
):
LocationMethod
{
fun
getMethod
(
id
:
ULong
):
LocationMethod
=
LocationMethod
.
entries
[
libac
.
ac_location_info_get_method
(
id
).
toInt
()]
return
LocationMethod
.
entries
[
libac
.
ac_location_info_get_method
(
id
).
toInt
()]
}
/**
/**
* Listen change state.
* Listen change state.
*/
*/
fun
listen
(
callback
:
(
ULong
,
LocationState
)
->
Unit
):
ULong
{
fun
listen
(
callback
:
(
ULong
,
LocationState
)
->
Unit
):
ULong
{
val
stableRef
=
StableRef
.
create
(
callback
)
val
stableRef
=
StableRef
.
create
(
callback
)
val
id
=
libac
.
ac_location_info_listen
(
staticCFunction
{
id
,
latitude
,
longitude
,
altitude
,
data
->
val
id
=
libac
.
ac_location_info_listen
(
data
?.
asStableRef
<(
ULong
,
LocationState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
LocationState
(
latitude
,
longitude
,
altitude
))
staticCFunction
{
id
,
latitude
,
longitude
,
altitude
,
data
->
},
stableRef
.
asCPointer
())
data
?.
asStableRef
<(
ULong
,
LocationState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
LocationState
(
latitude
,
longitude
,
altitude
))
},
stableRef
.
asCPointer
(),
)
if
(
id
!=
0UL
)
{
if
(
id
!=
0UL
)
{
callbacks
.
put
(
id
,
stableRef
)
callbacks
.
put
(
id
,
stableRef
)
}
}
...
...
ak-package-info/src/commonMain/kotlin/ru/auroraos/kmp/packageInfo/PackageInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.packageInfo
package
ru.auroraos.kmp.packageInfo
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -11,65 +15,47 @@ object PackageInfo {
...
@@ -11,65 +15,47 @@ object PackageInfo {
/**
/**
* Full package identifier.
* Full package identifier.
*/
*/
fun
getApplicationId
():
String
{
fun
getApplicationId
():
String
=
libac
.
ac_package_info_application_id
().
toKString
()
return
libac
.
ac_package_info_application_id
().
toKString
()
}
/**
/**
* Application name identifier.
* Application name identifier.
*/
*/
fun
getAppName
():
String
{
fun
getAppName
():
String
=
libac
.
ac_package_info_app_name
().
toKString
()
return
libac
.
ac_package_info_app_name
().
toKString
()
}
/**
/**
* Application Organization ID.
* Application Organization ID.
*/
*/
fun
getOrgName
():
String
{
fun
getOrgName
():
String
=
libac
.
ac_package_info_org_name
().
toKString
()
return
libac
.
ac_package_info_org_name
().
toKString
()
}
/**
/**
* Version of the application with the release.
* Version of the application with the release.
*/
*/
fun
getVersion
():
String
{
fun
getVersion
():
String
=
libac
.
ac_package_info_version
().
toKString
()
return
libac
.
ac_package_info_version
().
toKString
()
}
/**
/**
* Package group.
* Package group.
*/
*/
fun
getSubgroup
():
String
{
fun
getSubgroup
():
String
=
libac
.
ac_package_info_subgroup
().
toKString
()
return
libac
.
ac_package_info_subgroup
().
toKString
()
}
/**
/**
* The size of the entire directory of the installed package.
* The size of the entire directory of the installed package.
*/
*/
fun
getSize
():
ULong
{
fun
getSize
():
ULong
=
libac
.
ac_package_info_size
()
return
libac
.
ac_package_info_size
()
}
/**
/**
* Size of bin directory with executable file.
* Size of bin directory with executable file.
*/
*/
fun
getSizeBin
():
ULong
{
fun
getSizeBin
():
ULong
=
libac
.
ac_package_info_size_bin
()
return
libac
.
ac_package_info_size_bin
()
}
/**
/**
* Size of package data directory.
* Size of package data directory.
*/
*/
fun
getSizeData
():
ULong
{
fun
getSizeData
():
ULong
=
libac
.
ac_package_info_size_data
()
return
libac
.
ac_package_info_size_data
()
}
/**
/**
* Size of the directory with package libraries.
* Size of the directory with package libraries.
*/
*/
fun
getSizeDataLib
():
ULong
{
fun
getSizeDataLib
():
ULong
=
libac
.
ac_package_info_size_data_lib
()
return
libac
.
ac_package_info_size_data_lib
()
}
}
}
@OptIn
(
ExperimentalForeignApi
::
class
)
@OptIn
(
ExperimentalForeignApi
::
class
)
...
...
ak-path-info/src/commonMain/kotlin/ru/auroraos/kmp/pathInfo/PathInfo.kt
Просмотр файла @
957d1c86
/**
* SPDX-FileCopyrightText: Copyright 2025 Open Mobile Platform LLC <community@omp.ru>
* SPDX-License-Identifier: BSD-3-Clause
*/
package
ru.auroraos.kmp.pathInfo
package
ru.auroraos.kmp.pathInfo
import
kotlinx.cinterop.CValue
import
kotlinx.cinterop.CValue
...
@@ -12,156 +16,112 @@ object PathInfo {
...
@@ -12,156 +16,112 @@ object PathInfo {
/**
/**
* Path to cache application.
* Path to cache application.
*/
*/
fun
getAppCache
():
String
{
fun
getAppCache
():
String
=
ac_path_info_get_app_cache
().
toKString
()
return
ac_path_info_get_app_cache
().
toKString
()
}
/**
/**
* Path to data application.
* Path to data application.
*/
*/
fun
getAppData
():
String
{
fun
getAppData
():
String
=
ac_path_info_get_app_data
().
toKString
()
return
ac_path_info_get_app_data
().
toKString
()
}
/**
/**
* Path to local cache application.
* Path to local cache application.
*/
*/
fun
appLocalCache
():
String
{
fun
appLocalCache
():
String
=
ac_path_info_get_app_local_cache
().
toKString
()
return
ac_path_info_get_app_local_cache
().
toKString
()
}
/**
/**
* Path to local data application.
* Path to local data application.
*/
*/
fun
getAppLocalData
():
String
{
fun
getAppLocalData
():
String
=
ac_path_info_get_app_local_data
().
toKString
()
return
ac_path_info_get_app_local_data
().
toKString
()
}
/**
/**
* Path to files application.
* Path to files application.
*/
*/
fun
getPackageFiles
():
String
{
fun
getPackageFiles
():
String
=
ac_path_info_get_package_files
().
toKString
()
return
ac_path_info_get_package_files
().
toKString
()
}
/**
/**
* Path to translations application.
* Path to translations application.
*/
*/
fun
getTranslations
():
String
{
fun
getTranslations
():
String
=
ac_path_info_get_translations
().
toKString
()
return
ac_path_info_get_translations
().
toKString
()
}
/**
/**
* Path to common org cache.
* Path to common org cache.
*/
*/
fun
getOrgCache
():
String
{
fun
getOrgCache
():
String
=
ac_path_info_get_org_cache
().
toKString
()
return
ac_path_info_get_org_cache
().
toKString
()
}
/**
/**
* Path to common org data.
* Path to common org data.
*/
*/
fun
getOrgData
():
String
{
fun
getOrgData
():
String
=
ac_path_info_get_org_data
().
toKString
()
return
ac_path_info_get_org_data
().
toKString
()
}
/**
/**
* Path to common org files.
* Path to common org files.
*/
*/
fun
getOrgFiles
():
String
{
fun
getOrgFiles
():
String
=
ac_path_info_get_org_files
().
toKString
()
return
ac_path_info_get_org_files
().
toKString
()
}
/**
/**
* Path to common org local cache.
* Path to common org local cache.
*/
*/
fun
getOrgLocalCache
():
String
{
fun
getOrgLocalCache
():
String
=
ac_path_info_get_org_local_cache
().
toKString
()
return
ac_path_info_get_org_local_cache
().
toKString
()
}
/**
/**
* Path to common org local data.
* Path to common org local data.
*/
*/
fun
getOrgLocalData
():
String
{
fun
getOrgLocalData
():
String
=
ac_path_info_get_org_local_data
().
toKString
()
return
ac_path_info_get_org_local_data
().
toKString
()
}
/**
/**
* Path to fonts folder.
* Path to fonts folder.
*/
*/
fun
getFonts
():
String
{
fun
getFonts
():
String
=
ac_path_info_get_fonts
().
toKString
()
return
ac_path_info_get_fonts
().
toKString
()
}
/**
/**
* Path to removable media folder.
* Path to removable media folder.
*/
*/
fun
getRemovableMedia
():
String
{
fun
getRemovableMedia
():
String
=
ac_path_info_get_removable_media
().
toKString
()
return
ac_path_info_get_removable_media
().
toKString
()
}
/**
/**
* Path to runtime folder.
* Path to runtime folder.
*/
*/
fun
getRuntime
():
String
{
fun
getRuntime
():
String
=
ac_path_info_get_runtime
().
toKString
()
return
ac_path_info_get_runtime
().
toKString
()
}
/**
/**
* Path to temp folder.
* Path to temp folder.
*/
*/
fun
getTemp
():
String
{
fun
getTemp
():
String
=
ac_path_info_get_temp
().
toKString
()
return
ac_path_info_get_temp
().
toKString
()
}
/**
/**
* Path to Home folder.
* Path to Home folder.
*/
*/
fun
getHome
():
String
{
fun
getHome
():
String
=
ac_path_info_get_home
().
toKString
()
return
ac_path_info_get_home
().
toKString
()
}
/**
/**
* Path to Desktop folder.
* Path to Desktop folder.
*/
*/
fun
getDesktop
():
String
{
fun
getDesktop
():
String
=
ac_path_info_get_desktop
().
toKString
()
return
ac_path_info_get_desktop
().
toKString
()
}
/**
/**
* Path to Documents folder.
* Path to Documents folder.
*/
*/
fun
getDocuments
():
String
{
fun
getDocuments
():
String
=
ac_path_info_get_documents
().
toKString
()
return
ac_path_info_get_documents
().
toKString
()
}
/**
/**
* Path to Downloads folder.
* Path to Downloads folder.
*/
*/
fun
getDownloads
():
String
{
fun
getDownloads
():
String
=
ac_path_info_get_downloads
().
toKString
()
return
ac_path_info_get_downloads
().
toKString
()
}
/**
/**
* Path to Videos folder.
* Path to Videos folder.
*/
*/
fun
getVideos
():
String
{
fun
getVideos
():
String
=
ac_path_info_get_movies
().
toKString
()
return
ac_path_info_get_movies
().
toKString
()
}
/**
/**
* Path to Music folder.
* Path to Music folder.
*/
*/
fun
getMusic
():
String
{
fun
getMusic
():
String
=
ac_path_info_get_music
().
toKString
()
return
ac_path_info_get_music
().
toKString
()
}
/**
/**
* Path to Pictures folder.
* Path to Pictures folder.
*/
*/
fun
getPictures
():
String
{
fun
getPictures
():
String
=
ac_path_info_get_pictures
().
toKString
()
return
ac_path_info_get_pictures
().
toKString
()
}
}
}
@OptIn
(
ExperimentalForeignApi
::
class
)
@OptIn
(
ExperimentalForeignApi
::
class
)
...
...
Пред
1
2
3
След
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать