Initial commit

This commit is contained in:
2026-03-16 10:37:46 +08:00
commit c052a67816
508 changed files with 22987 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,28 @@
{
"id": "__UNI__95B2570",
"name": "akbleserver",
"description": "",
"version": {
"name": "1.0.1",
"code": "101"
},
"uni-app-x": {
"compilerVersion": "4.76"
},
"app-android": {
"distribute": {
"modules": {
"FileSystem": {}
},
"icons": {
"hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png"
},
"splashScreens": {
"default": {}
}
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,3 @@
{
"minSdkVersion": "21"
}

View File

@@ -0,0 +1,109 @@
@file:Suppress("UNCHECKED_CAST", "USELESS_CAST", "INAPPLICABLE_JVM_NAME", "UNUSED_ANONYMOUS_PARAMETER", "NAME_SHADOWING", "UNNECESSARY_NOT_NULL_ASSERTION")
package uts.sdk.modules.uniGetbatteryinfo
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import io.dcloud.uniapp.*
import io.dcloud.uniapp.extapi.*
import io.dcloud.uniapp.framework.*
import io.dcloud.uniapp.runtime.*
import io.dcloud.uniapp.vue.*
import io.dcloud.uniapp.vue.shared.*
import io.dcloud.unicloud.*
import io.dcloud.uts.*
import io.dcloud.uts.Map
import io.dcloud.uts.Set
import io.dcloud.uts.UTSAndroid
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
open class GetBatteryInfoSuccess (
@JsonNotNull
open var errMsg: String,
@JsonNotNull
open var level: Number,
@JsonNotNull
open var isCharging: Boolean = false,
) : UTSObject(), IUTSSourceMap {
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
return UTSSourceMapPosition("GetBatteryInfoSuccess", "uni_modules/uni-getbatteryinfo/utssdk/interface.uts", 1, 13)
}
}
open class GetBatteryInfoOptions (
open var success: ((res: GetBatteryInfoSuccess) -> Unit)? = null,
open var fail: ((res: UniError) -> Unit)? = null,
open var complete: ((res: Any) -> Unit)? = null,
) : UTSObject(), IUTSSourceMap {
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
return UTSSourceMapPosition("GetBatteryInfoOptions", "uni_modules/uni-getbatteryinfo/utssdk/interface.uts", 12, 13)
}
}
open class GetBatteryInfoResult (
@JsonNotNull
open var level: Number,
@JsonNotNull
open var isCharging: Boolean = false,
) : UTSObject(), IUTSSourceMap {
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
return UTSSourceMapPosition("GetBatteryInfoResult", "uni_modules/uni-getbatteryinfo/utssdk/interface.uts", 26, 13)
}
}
typealias GetBatteryInfoErrorCode = Number
interface GetBatteryInfoFail : IUniError {
override var errCode: GetBatteryInfoErrorCode
}
typealias GetBatteryInfo = (options: GetBatteryInfoOptions) -> Unit
typealias GetBatteryInfoSync = () -> GetBatteryInfoResult
val UniErrorSubject = "uni-getBatteryInfo"
val UniErrors: Map<GetBatteryInfoErrorCode, String> = Map(_uA(
_uA(
1001,
"getBatteryInfo:fail getAppContext is null"
)
))
open class GetBatteryInfoFailImpl : UniError, GetBatteryInfoFail, IUTSSourceMap {
override fun `__$getOriginalPosition`(): UTSSourceMapPosition? {
return UTSSourceMapPosition("GetBatteryInfoFailImpl", "uni_modules/uni-getbatteryinfo/utssdk/unierror.uts", 19, 14)
}
constructor(errCode: GetBatteryInfoErrorCode) : super() {
this.errSubject = UniErrorSubject
this.errCode = errCode
this.errMsg = UniErrors[errCode] ?: ""
}
}
val getBatteryInfo: GetBatteryInfo = fun(options: GetBatteryInfoOptions) {
val context = UTSAndroid.getAppContext()
if (context != null) {
val manager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
val level = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
var ifilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
var batteryStatus = context.registerReceiver(null, ifilter)
var status = batteryStatus?.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
var isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL
val res = GetBatteryInfoSuccess(errMsg = "getBatteryInfo:ok", level = level, isCharging = isCharging)
options.success?.invoke(res)
options.complete?.invoke(res)
} else {
var res = GetBatteryInfoFailImpl(1001)
options.fail?.invoke(res)
options.complete?.invoke(res)
}
}
val getBatteryInfoSync: GetBatteryInfoSync = fun(): GetBatteryInfoResult {
val context = UTSAndroid.getAppContext()
if (context != null) {
val manager = context.getSystemService(Context.BATTERY_SERVICE) as BatteryManager
val level = manager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
var ifilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
var batteryStatus = context.registerReceiver(null, ifilter)
var status = batteryStatus?.getIntExtra(BatteryManager.EXTRA_STATUS, -1)
var isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL
val res = GetBatteryInfoResult(level = level, isCharging = isCharging)
return res
} else {
val res = GetBatteryInfoResult(level = -1, isCharging = false)
return res
}
}