Открыть боковую панель
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
A Multiplatform library that provides convenient functionality for Kotlin Multiplatform applications
to interact with the Aurora OS via
[
Aurora Cinterop
](
https://os-git.omprussia.ru/non-oss/kmp/aurora-cinterop
)
.
Kotlin Multiplatform libraries provide convenient functionality for interacting with Aurora OS.
### 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
import
kotlinx.cinterop.CValue
...
...
@@ -17,25 +21,24 @@ object BatteryInfo {
/**
* Battery charge level.
*/
fun
getLevel
():
Int
{
return
libac
.
ac_battery_info_level
()
}
fun
getLevel
():
Int
=
libac
.
ac_battery_info_level
()
/**
* Battery charger status.
*/
fun
isCharger
():
Boolean
{
return
libac
.
ac_battery_info_charger_state
().
toKString
().
lowercase
()
==
"on"
}
fun
isCharger
():
Boolean
=
libac
.
ac_battery_info_charger_state
().
toKString
().
lowercase
()
==
"on"
/**
* Listen charger state.
*/
fun
listenCharger
(
callback
:
(
ULong
,
Boolean
)
->
Unit
):
ULong
{
val
stableRef
=
StableRef
.
create
(
callback
)
val
id
=
libac
.
ac_battery_info_listen_charger
(
staticCFunction
{
id
,
value
,
data
->
data
?.
asStableRef
<(
ULong
,
Boolean
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
value
.
toKString
().
lowercase
()
==
"on"
)
},
stableRef
.
asCPointer
())
val
id
=
libac
.
ac_battery_info_listen_charger
(
staticCFunction
{
id
,
value
,
data
->
data
?.
asStableRef
<(
ULong
,
Boolean
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
value
.
toKString
().
lowercase
()
==
"on"
)
},
stableRef
.
asCPointer
(),
)
if
(
id
!=
0UL
)
{
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
import
kotlinx.cinterop.ExperimentalForeignApi
...
...
@@ -10,16 +14,12 @@ object CameraInfo {
/**
* Getting information about cameras.
*/
fun
getInfoList
():
List
<
CameraInfoData
>
{
return
memScoped
{
libac
.
ac_camera_info_list
().
toKListCameraInfoData
()
}
fun
getInfoList
():
List
<
CameraInfoData
>
=
memScoped
{
libac
.
ac_camera_info_list
().
toKListCameraInfoData
()
}
/**
* Getting information about the number of cameras.
*/
fun
getInfoCount
():
ULong
{
return
libac
.
ac_camera_info_count
()
}
fun
getInfoCount
():
ULong
=
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
import
kotlinx.cinterop.CValue
...
...
@@ -27,7 +31,7 @@ internal fun CValue<libac.Vec_AcciCameraInfo>?.toKListCameraInfoData(): List<Cam
name
=
value
.
name
.
toKString
(),
provider
=
value
.
provider
.
toKString
(),
mountAngle
=
value
.
mount_angle
,
)
)
,
)
}
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
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
import
kotlinx.cinterop.ExperimentalForeignApi
...
...
@@ -6,7 +10,13 @@ import kotlinx.cinterop.asStableRef
import
kotlinx.cinterop.staticCFunction
enum
class
ConnectivityInfoState
{
None
,
Bluetooth
,
Wifi
,
Ethernet
,
Mobile
,
Vpn
,
Other
None
,
Bluetooth
,
Wifi
,
Ethernet
,
Mobile
,
Vpn
,
Other
,
}
@OptIn
(
ExperimentalForeignApi
::
class
)
...
...
@@ -16,19 +26,20 @@ object ConnectivityInfo {
/**
* State is online.
*/
fun
isOnline
():
Boolean
{
return
libac
.
ac_connectivity_info_is_online
()
}
fun
isOnline
():
Boolean
=
libac
.
ac_connectivity_info_is_online
()
/**
* Listen change state.
*/
fun
listen
(
callback
:
(
ULong
,
ConnectivityInfoState
)
->
Unit
):
ULong
{
val
stableRef
=
StableRef
.
create
(
callback
)
val
id
=
libac
.
ac_connectivity_info_listen
(
staticCFunction
{
id
,
value
,
data
->
val
state
=
ConnectivityInfoState
.
entries
.
toTypedArray
().
getOrElse
(
value
)
{
ConnectivityInfoState
.
None
}
data
?.
asStableRef
<(
ULong
,
ConnectivityInfoState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
state
)
},
stableRef
.
asCPointer
())
val
id
=
libac
.
ac_connectivity_info_listen
(
staticCFunction
{
id
,
value
,
data
->
val
state
=
ConnectivityInfoState
.
entries
.
toTypedArray
().
getOrElse
(
value
)
{
ConnectivityInfoState
.
None
}
data
?.
asStableRef
<(
ULong
,
ConnectivityInfoState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
state
)
},
stableRef
.
asCPointer
(),
)
if
(
id
!=
0UL
)
{
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
import
kotlinx.cinterop.ExperimentalForeignApi
...
...
@@ -11,105 +15,75 @@ object DeviceInfo {
/**
* Unique device identifier.
*/
fun
id
():
String
{
return
libac
.
ac_device_info_device_id
().
toKString
()
}
fun
id
():
String
=
libac
.
ac_device_info_device_id
().
toKString
()
/**
* Global Navigation Satellite System.
*/
fun
hasGNSS
():
Boolean
{
return
libac
.
ac_device_info_has_gnss
()
}
fun
hasGNSS
():
Boolean
=
libac
.
ac_device_info_has_gnss
()
/**
* Near Field Communication.
*/
fun
hasNFC
():
Boolean
{
return
libac
.
ac_device_info_has_nfc
()
}
fun
hasNFC
():
Boolean
=
libac
.
ac_device_info_has_nfc
()
/**
* Short-range wireless technology standard.
*/
fun
hasBluetooth
():
Boolean
{
return
libac
.
ac_device_info_has_bluetooth
()
}
fun
hasBluetooth
():
Boolean
=
libac
.
ac_device_info_has_bluetooth
()
/**
* Wireless Local Area Network.
*/
fun
hasWlan
():
Boolean
{
return
libac
.
ac_device_info_has_wlan
()
}
fun
hasWlan
():
Boolean
=
libac
.
ac_device_info_has_wlan
()
/**
* The highest reported CPU clock speed.
*/
fun
getMaxCpuClockSpeed
():
UInt
{
return
libac
.
ac_device_info_get_max_cpu_clock_speed
()
}
fun
getMaxCpuClockSpeed
():
UInt
=
libac
.
ac_device_info_get_max_cpu_clock_speed
()
/**
* Number of cores of the system.
*/
fun
getNumberCpuCores
():
UInt
{
return
libac
.
ac_device_info_get_number_cpu_cores
()
}
fun
getNumberCpuCores
():
UInt
=
libac
.
ac_device_info_get_number_cpu_cores
()
/**
* Current battery charge in percentage.
*/
fun
getBatteryChargePercentage
():
UInt
{
return
libac
.
ac_device_info_get_battery_charge_percentage
()
}
fun
getBatteryChargePercentage
():
UInt
=
libac
.
ac_device_info_get_battery_charge_percentage
()
/**
* Main camera resolution.
*/
fun
getMainCameraResolution
():
Double
{
return
libac
.
ac_device_info_get_main_camera_resolution
()
}
fun
getMainCameraResolution
():
Double
=
libac
.
ac_device_info_get_main_camera_resolution
()
/**
* Frontal camera resolution.
*/
fun
getFrontalCameraResolution
():
Double
{
return
libac
.
ac_device_info_get_frontal_camera_resolution
()
}
fun
getFrontalCameraResolution
():
Double
=
libac
.
ac_device_info_get_frontal_camera_resolution
()
/**
* Random-access memory total size.
*/
fun
getRamTotalSize
():
ULong
{
return
libac
.
ac_device_info_get_ram_total_size
()
}
fun
getRamTotalSize
():
ULong
=
libac
.
ac_device_info_get_ram_total_size
()
/**
* Random-access memory free size.
*/
fun
getRamFreeSize
():
ULong
{
return
libac
.
ac_device_info_get_ram_free_size
()
}
fun
getRamFreeSize
():
ULong
=
libac
.
ac_device_info_get_ram_free_size
()
/**
* The clarity and detail of visuals displayed on a device.
*/
fun
getScreenResolution
():
String
{
return
libac
.
ac_device_info_get_screen_resolution
().
toKString
()
}
fun
getScreenResolution
():
String
=
libac
.
ac_device_info_get_screen_resolution
().
toKString
()
/**
* Operating system version.
*/
fun
getOsVersion
():
String
{
return
libac
.
ac_device_info_get_os_version
().
toKString
()
}
fun
getOsVersion
():
String
=
libac
.
ac_device_info_get_os_version
().
toKString
()
/**
* Device model name.
*/
fun
getDeviceModel
():
String
{
return
libac
.
ac_device_info_get_device_model
().
toKString
()
}
fun
getDeviceModel
():
String
=
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
import
kotlinx.cinterop.ExperimentalForeignApi
...
...
@@ -13,9 +17,7 @@ object DeviceSim {
/**
* Information about the device's SIM cards.
*/
fun
getSimCardsInfo
():
List
<
SimCardData
>
{
return
memScoped
{
libac
.
ac_device_info_get_sim_cards_info
().
toKListSimCardData
()
}
fun
getSimCardsInfo
():
List
<
SimCardData
>
=
memScoped
{
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
import
kotlinx.cinterop.CValue
...
...
@@ -29,7 +33,7 @@ internal fun CValue<libac.Vec_AcdiSimCard>?.toKListSimCardData(): List<SimCardDa
preferredDataTransfer
=
value
.
preferred_data_transfer
,
preferredVoiceCall
=
value
.
preferred_voice_call
,
simName
=
value
.
sim_name
.
toKString
(),
)
)
,
)
}
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
import
kotlinx.cinterop.ExperimentalForeignApi
...
...
@@ -15,18 +19,14 @@ object DeviceStorage {
/**
* Information on external storage the device.
*/
fun
getExternalInfo
():
ExternalStorageInfoData
{
return
memScoped
{
libac
.
ac_device_info_get_external_storage_info
().
toKExternalStorageInfoData
()
}
fun
getExternalInfo
():
ExternalStorageInfoData
=
memScoped
{
libac
.
ac_device_info_get_external_storage_info
().
toKExternalStorageInfoData
()
}
/**
* Information on internal storage the device.
*/
fun
getInternalInfo
():
InternalStorageInfoData
{
return
memScoped
{
libac
.
ac_device_info_get_internal_storage_info
().
toKInternalStorageInfoData
()
}
fun
getInternalInfo
():
InternalStorageInfoData
=
memScoped
{
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
import
kotlinx.cinterop.CValue
...
...
@@ -15,13 +19,11 @@ data class ExternalStorageInfoData(
)
@OptIn
(
ExperimentalForeignApi
::
class
)
internal
fun
CValue
<
libac
.
AcdiExternalStorageInfo
>
?.
toKExternalStorageInfoData
():
ExternalStorageInfoData
{
return
ExternalStorageInfoData
(
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
countMountedPartitions
=
this
?.
useContents
{
count_mounted_partitions
}
?:
0U
,
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
mounted
=
this
?.
useContents
{
mounted
}
?:
false
,
)
}
internal
fun
CValue
<
libac
.
AcdiExternalStorageInfo
>
?.
toKExternalStorageInfoData
():
ExternalStorageInfoData
=
ExternalStorageInfoData
(
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
countMountedPartitions
=
this
?.
useContents
{
count_mounted_partitions
}
?:
0U
,
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
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
import
kotlinx.cinterop.CValue
...
...
@@ -14,12 +18,10 @@ data class InternalStorageInfoData(
)
@OptIn
(
ExperimentalForeignApi
::
class
)
internal
fun
CValue
<
libac
.
AcdiInternalStorageInfo
>
?.
toKInternalStorageInfoData
():
InternalStorageInfoData
{
return
InternalStorageInfoData
(
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
deviceLabel
=
this
?.
useContents
{
device_label
}.
toKString
(),
filesystemType
=
this
?.
useContents
{
filesystem_type
}.
toKString
(),
)
}
internal
fun
CValue
<
libac
.
AcdiInternalStorageInfo
>
?.
toKInternalStorageInfoData
():
InternalStorageInfoData
=
InternalStorageInfoData
(
bytesAvailable
=
this
?.
useContents
{
bytes_available
}
?:
0UL
,
bytesTotal
=
this
?.
useContents
{
bytes_total
}
?:
0UL
,
bytesUsed
=
this
?.
useContents
{
bytes_used
}
?:
0UL
,
deviceLabel
=
this
?.
useContents
{
device_label
}.
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
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
import
kotlinx.cinterop.*
...
...
@@ -11,22 +15,18 @@ object LocalNotification {
title
:
String
,
summary
:
String
,
body
:
String
,
):
UInt
{
return
memScoped
{
libac
.
ac_local_notification_notify
(
stringToSaferC
(
title
),
stringToSaferC
(
summary
),
stringToSaferC
(
body
),
)
}
):
UInt
=
memScoped
{
libac
.
ac_local_notification_notify
(
stringToSaferC
(
title
),
stringToSaferC
(
summary
),
stringToSaferC
(
body
),
)
}
/**
* Close local notification by ID.
*/
fun
close
(
id
:
UInt
):
Boolean
{
return
libac
.
ac_local_notification_close
(
id
)
}
fun
close
(
id
:
UInt
):
Boolean
=
libac
.
ac_local_notification_close
(
id
)
}
@OptIn
(
ExperimentalForeignApi
::
class
)
...
...
@@ -38,4 +38,3 @@ internal fun MemScope.stringToSaferC(value: String): CPointer<libac.Vec_uint8> {
cStruct
.
ptr
=
cValues
.
ptr
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
import
kotlinx.cinterop.ExperimentalForeignApi
...
...
@@ -6,7 +10,10 @@ import kotlinx.cinterop.asStableRef
import
kotlinx.cinterop.staticCFunction
enum
class
LocationMethod
{
Undefined
,
Network
,
Satellite
,
All
Undefined
,
Network
,
Satellite
,
All
,
}
data class
LocationState
(
...
...
@@ -22,25 +29,24 @@ object LocationInfo {
/**
* Check is supported.
*/
fun
isSupported
():
Boolean
{
return
libac
.
ac_location_info_is_supported
()
}
fun
isSupported
():
Boolean
=
libac
.
ac_location_info_is_supported
()
/**
* Get listen location method.
*/
fun
getMethod
(
id
:
ULong
):
LocationMethod
{
return
LocationMethod
.
entries
[
libac
.
ac_location_info_get_method
(
id
).
toInt
()]
}
fun
getMethod
(
id
:
ULong
):
LocationMethod
=
LocationMethod
.
entries
[
libac
.
ac_location_info_get_method
(
id
).
toInt
()]
/**
* Listen change state.
*/
fun
listen
(
callback
:
(
ULong
,
LocationState
)
->
Unit
):
ULong
{
val
stableRef
=
StableRef
.
create
(
callback
)
val
id
=
libac
.
ac_location_info_listen
(
staticCFunction
{
id
,
latitude
,
longitude
,
altitude
,
data
->
data
?.
asStableRef
<(
ULong
,
LocationState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
LocationState
(
latitude
,
longitude
,
altitude
))
},
stableRef
.
asCPointer
())
val
id
=
libac
.
ac_location_info_listen
(
staticCFunction
{
id
,
latitude
,
longitude
,
altitude
,
data
->
data
?.
asStableRef
<(
ULong
,
LocationState
)
->
Unit
>()
?.
get
()
?.
invoke
(
id
,
LocationState
(
latitude
,
longitude
,
altitude
))
},
stableRef
.
asCPointer
(),
)
if
(
id
!=
0UL
)
{
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
import
kotlinx.cinterop.CValue
...
...
@@ -11,65 +15,47 @@ object PackageInfo {
/**
* Full package identifier.
*/
fun
getApplicationId
():
String
{
return
libac
.
ac_package_info_application_id
().
toKString
()
}
fun
getApplicationId
():
String
=
libac
.
ac_package_info_application_id
().
toKString
()
/**
* Application name identifier.
*/
fun
getAppName
():
String
{
return
libac
.
ac_package_info_app_name
().
toKString
()
}
fun
getAppName
():
String
=
libac
.
ac_package_info_app_name
().
toKString
()
/**
* Application Organization ID.
*/
fun
getOrgName
():
String
{
return
libac
.
ac_package_info_org_name
().
toKString
()
}
fun
getOrgName
():
String
=
libac
.
ac_package_info_org_name
().
toKString
()
/**
* Version of the application with the release.
*/
fun
getVersion
():
String
{
return
libac
.
ac_package_info_version
().
toKString
()
}
fun
getVersion
():
String
=
libac
.
ac_package_info_version
().
toKString
()
/**
* Package group.
*/
fun
getSubgroup
():
String
{
return
libac
.
ac_package_info_subgroup
().
toKString
()
}
fun
getSubgroup
():
String
=
libac
.
ac_package_info_subgroup
().
toKString
()
/**
* The size of the entire directory of the installed package.
*/
fun
getSize
():
ULong
{
return
libac
.
ac_package_info_size
()
}
fun
getSize
():
ULong
=
libac
.
ac_package_info_size
()
/**
* Size of bin directory with executable file.
*/
fun
getSizeBin
():
ULong
{
return
libac
.
ac_package_info_size_bin
()
}
fun
getSizeBin
():
ULong
=
libac
.
ac_package_info_size_bin
()
/**
* Size of package data directory.
*/
fun
getSizeData
():
ULong
{
return
libac
.
ac_package_info_size_data
()
}
fun
getSizeData
():
ULong
=
libac
.
ac_package_info_size_data
()
/**
* Size of the directory with package libraries.
*/
fun
getSizeDataLib
():
ULong
{
return
libac
.
ac_package_info_size_data_lib
()
}
fun
getSizeDataLib
():
ULong
=
libac
.
ac_package_info_size_data_lib
()
}
@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
import
kotlinx.cinterop.CValue
...
...
@@ -12,156 +16,112 @@ object PathInfo {
/**
* Path to cache application.
*/
fun
getAppCache
():
String
{
return
ac_path_info_get_app_cache
().
toKString
()
}
fun
getAppCache
():
String
=
ac_path_info_get_app_cache
().
toKString
()
/**
* Path to data application.
*/
fun
getAppData
():
String
{
return
ac_path_info_get_app_data
().
toKString
()
}
fun
getAppData
():
String
=
ac_path_info_get_app_data
().
toKString
()
/**
* Path to local cache application.
*/
fun
appLocalCache
():
String
{
return
ac_path_info_get_app_local_cache
().
toKString
()
}
fun
appLocalCache
():
String
=
ac_path_info_get_app_local_cache
().
toKString
()
/**
* Path to local data application.
*/
fun
getAppLocalData
():
String
{
return
ac_path_info_get_app_local_data
().
toKString
()
}
fun
getAppLocalData
():
String
=
ac_path_info_get_app_local_data
().
toKString
()
/**
* Path to files application.
*/
fun
getPackageFiles
():
String
{
return
ac_path_info_get_package_files
().
toKString
()
}
fun
getPackageFiles
():
String
=
ac_path_info_get_package_files
().
toKString
()
/**
* Path to translations application.
*/
fun
getTranslations
():
String
{
return
ac_path_info_get_translations
().
toKString
()
}
fun
getTranslations
():
String
=
ac_path_info_get_translations
().
toKString
()
/**
* Path to common org cache.
*/
fun
getOrgCache
():
String
{
return
ac_path_info_get_org_cache
().
toKString
()
}
fun
getOrgCache
():
String
=
ac_path_info_get_org_cache
().
toKString
()
/**
* Path to common org data.
*/
fun
getOrgData
():
String
{
return
ac_path_info_get_org_data
().
toKString
()
}
fun
getOrgData
():
String
=
ac_path_info_get_org_data
().
toKString
()
/**
* Path to common org files.
*/
fun
getOrgFiles
():
String
{
return
ac_path_info_get_org_files
().
toKString
()
}
fun
getOrgFiles
():
String
=
ac_path_info_get_org_files
().
toKString
()
/**
* Path to common org local cache.
*/
fun
getOrgLocalCache
():
String
{
return
ac_path_info_get_org_local_cache
().
toKString
()
}
fun
getOrgLocalCache
():
String
=
ac_path_info_get_org_local_cache
().
toKString
()
/**
* Path to common org local data.
*/
fun
getOrgLocalData
():
String
{
return
ac_path_info_get_org_local_data
().
toKString
()
}
fun
getOrgLocalData
():
String
=
ac_path_info_get_org_local_data
().
toKString
()
/**
* Path to fonts folder.
*/
fun
getFonts
():
String
{
return
ac_path_info_get_fonts
().
toKString
()
}
fun
getFonts
():
String
=
ac_path_info_get_fonts
().
toKString
()
/**
* Path to removable media folder.
*/
fun
getRemovableMedia
():
String
{
return
ac_path_info_get_removable_media
().
toKString
()
}
fun
getRemovableMedia
():
String
=
ac_path_info_get_removable_media
().
toKString
()
/**
* Path to runtime folder.
*/
fun
getRuntime
():
String
{
return
ac_path_info_get_runtime
().
toKString
()
}
fun
getRuntime
():
String
=
ac_path_info_get_runtime
().
toKString
()
/**
* Path to temp folder.
*/
fun
getTemp
():
String
{
return
ac_path_info_get_temp
().
toKString
()
}
fun
getTemp
():
String
=
ac_path_info_get_temp
().
toKString
()
/**
* Path to Home folder.
*/
fun
getHome
():
String
{
return
ac_path_info_get_home
().
toKString
()
}
fun
getHome
():
String
=
ac_path_info_get_home
().
toKString
()
/**
* Path to Desktop folder.
*/
fun
getDesktop
():
String
{
return
ac_path_info_get_desktop
().
toKString
()
}
fun
getDesktop
():
String
=
ac_path_info_get_desktop
().
toKString
()
/**
* Path to Documents folder.
*/
fun
getDocuments
():
String
{
return
ac_path_info_get_documents
().
toKString
()
}
fun
getDocuments
():
String
=
ac_path_info_get_documents
().
toKString
()
/**
* Path to Downloads folder.
*/
fun
getDownloads
():
String
{
return
ac_path_info_get_downloads
().
toKString
()
}
fun
getDownloads
():
String
=
ac_path_info_get_downloads
().
toKString
()
/**
* Path to Videos folder.
*/
fun
getVideos
():
String
{
return
ac_path_info_get_movies
().
toKString
()
}
fun
getVideos
():
String
=
ac_path_info_get_movies
().
toKString
()
/**
* Path to Music folder.
*/
fun
getMusic
():
String
{
return
ac_path_info_get_music
().
toKString
()
}
fun
getMusic
():
String
=
ac_path_info_get_music
().
toKString
()
/**
* Path to Pictures folder.
*/
fun
getPictures
():
String
{
return
ac_path_info_get_pictures
().
toKString
()
}
fun
getPictures
():
String
=
ac_path_info_get_pictures
().
toKString
()
}
@OptIn
(
ExperimentalForeignApi
::
class
)
...
...
Пред
1
2
3
След
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать