Initial commit

main
zhangxn 3 weeks ago
parent 795c836f0c
commit c012581026

@ -15,7 +15,7 @@ android {
ndk {
//SOso
abiFilters "arm64-v8a"
abiFilters "arm64-v8a",'x86_64'
}
}

@ -21,6 +21,7 @@
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- wifi -->
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
@ -123,6 +124,10 @@
android:name=".watcher.ui.HistoryVideoActivity"
android:exported="false"
android:screenOrientation="landscape" />
<activity
android:name=".watcher.ui.VideoStorageActivity"
android:exported="false"
android:screenOrientation="landscape" />
<activity
android:name=".watcher.ui.ChooseParamsActivity"
android:exported="false"
@ -131,6 +136,14 @@
android:name=".watcher.ui.NetSettingActivity"
android:exported="false"
android:screenOrientation="landscape" />
<activity
android:name=".watcher.ui.RecoveryActivity"
android:exported="false"
android:screenOrientation="landscape" />
<activity
android:name=".watcher.ui.VideoRestoreActivity"
android:exported="false"
android:screenOrientation="landscape" />
<activity
android:name=".watcher.player.ProVideoActivity"
android:exported="false"

@ -244,29 +244,45 @@ abstract class BaseActivity : AppCompatActivity() {
// LogUtils.w("cyy dispatchKeyEvent keyCode = ${event?.keyCode} count = ${event?.repeatCount} acton = ${event?.action}")
val action = event.action
if (KeyEvent.ACTION_DOWN == action) {
LogUtils.w("enter dealActionDown")
return dealActionDown(event)
} else if (KeyEvent.ACTION_UP == action) {
LogUtils.w("enter dealActionUp")
return dealActionUp(event)
}
return super.dispatchKeyEvent(event)
}
private fun dealActionUp(event: KeyEvent): Boolean {
private var sosUpTime = 0L
if(baseBinding.sosArea.visibility == View.VISIBLE){
return true
}
private fun dealActionUp(event: KeyEvent): Boolean {
LogUtils.w("enter dealActionUp")
//if(baseBinding.sosArea.visibility == View.VISIBLE){
// LogUtils.w("SOS is visible")
//return true
//}
val repeatCount = event.repeatCount
val keyCode = event.keyCode
LogUtils.w("keyCodeup is $keyCode")
LogUtils.w("repeatCountup is $repeatCount")
/*if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode || KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) {
if (isLeftRightLongPress && baseBinding.areaSound.visibility == View.VISIBLE) {
baseBinding.areaSound.postDelayed(hideVoiceAreaRunnable, 1500)
return true
}
} else */
if (keyCode == KeyEvent.KEYCODE_F1) {
LogUtils.w("BaseActivity F1 up")
if(System.currentTimeMillis() - sosDownTime > 5000){
if (keyCode == KeyEvent.KEYCODE_DPAD_UP) {
LogUtils.w("sosDownTimeup00 is $sosDownTime")
if(sosDownTime.toInt() == 0){
sosDownTime = System.currentTimeMillis()-100
}
LogUtils.w("BaseActivity KEYCODE_DPAD_UP")
LogUtils.w("sosDownTimeup22 is $sosDownTime")
sosUpTime = System.currentTimeMillis()
LogUtils.w("sosUpTimeup is $sosUpTime")
if(sosUpTime - sosDownTime > 5000){
LogUtils.w("closesos")
onSosHelp(false)
SoundUtils.stopSoundIo()
}
@ -277,10 +293,13 @@ abstract class BaseActivity : AppCompatActivity() {
private var centerDownTime = 0L
private var sosDownTime = 0L
private var F1repeatcount =0
private fun dealActionDown(event: KeyEvent): Boolean {
LogUtils.w("enter dealActionDown")
val repeatCount = event.repeatCount
val keyCode = event.keyCode
LogUtils.w("keyCodeis $keyCode")
/*if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode || KeyEvent.KEYCODE_DPAD_RIGHT == keyCode) {
isLeftRightLongPress = repeatCount > 8
if (isLeftRightLongPress && currentFocus !is SeekBar) {
@ -301,13 +320,20 @@ abstract class BaseActivity : AppCompatActivity() {
}
}
} else if (keyCode == KeyEvent.KEYCODE_F1) {
sosDownTime == System.currentTimeMillis();
LogUtils.w("BaseActivity F111 pressed")
onSosHelp()
SoundUtils.playSoundIo()
F1repeatcount = repeatCount
}else if(keyCode == KeyEvent.KEYCODE_DPAD_UP){
LogUtils.w("BaseActivity up pressed")
if(baseBinding.sosArea.visibility == View.VISIBLE){
LogUtils.w("F1repeatcount is $F1repeatcount,repeatCount is $repeatCount,currentTimeMillis is ${System.currentTimeMillis()}")
if(repeatCount == 0 || sosDownTime.toInt() == 0) {
sosDownTime = System.currentTimeMillis()
}
LogUtils.w("sosDownTimeup11 is $sosDownTime")
return true
}
LogUtils.w("BaseActivity F1 pressed")
onSosHelp()
SoundUtils.playSoundIo()
}
return super.dispatchKeyEvent(event)
}

@ -58,7 +58,8 @@ const val VOCS_MAX_PPM = 6f
// 单位
const val UNIT_VOL = "%VOL"
const val UNIT_PPM = "ppm"
const val UNIT_PPM = "μmol/mol"
const val UNIT_UMOL = "ppm"
const val UNIT_MGM3 = "mg/m3"
const val UNIT_LEL = "%LEL"

@ -2,6 +2,7 @@ package com.yinuo.safetywatcher.watcher.port
import android.os.Process
import com.common.commonlib.db.DBUtils
import com.common.commonlib.utils.LogUtils
import com.common.serialport.ComMultiPortUtils
import com.yinuo.safetywatcher.watcher.port.cmd.CMD
import com.yinuo.safetywatcher.watcher.port.cmd.CMD.Companion.buildSensorRangeDecimalCmd
@ -53,6 +54,7 @@ object GasPortUtils {
ComMultiPortUtils.releaseAll()
ComMultiPortUtils.openPort(PORT_PATH, BAUD_RATE) { array ->
mInitFlag = true
LogUtils.w("Received data length: ${array.size}")
listeners.forEach {
it.invoke(array)
}

@ -2,6 +2,7 @@ package com.yinuo.safetywatcher.watcher.port
import android.content.Context
import com.common.commonlib.db.entity.Warning
import com.common.commonlib.utils.LogUtils
import com.common.commonlib.utils.MMKVUtils
import com.common.commonlib.utils.forShowStr
import com.common.commonlib.utils.getGasShowName
@ -145,6 +146,17 @@ fun getLocalGasUnit(gasType: String): String {
return getDefaultUnit(gasType)
}
//保存当前气体value值
fun saveGasValue(gasType: String, value: Float) {
MMKVUtils.put("value_$gasType", value)
}
//获取当前气体value值
fun getLocalGasValue(gasType: String): Float {
val localValue = MMKVUtils.getFloat("value_$gasType")
return localValue
}
private fun getDefaultUnit(gasType: String): String {
return when (gasType.uppercase()) {
O2 -> UNIT_VOL
@ -229,6 +241,7 @@ fun getShowWarnTxt(warn: Warning?): String {
"请注意,${it.gasName.getGasShowName()}浓度过高,已超过传感器量程"
} else {
if (it.gasValue < it.thresholdLow) {
LogUtils.w("it.gasValue is ${it.gasValue}")
"请注意,${it.gasName.getGasShowName()}浓度过低:${it.gasValue.forShowStr()} ${it.unit},有缺氧风险"
} else {
"请注意,${it.gasName.getGasShowName()}浓度过高:${it.gasValue.forShowStr()} ${it.unit},有醉氧风险"

@ -45,12 +45,14 @@ object ParseHelper {
fun setGasChangeListener(onChange: (String, Gas?) -> Unit) {
mGasListener = onChange
}
val abnormalValues = mutableMapOf<String, Pair<Float, Long>>()
fun parse(it: ByteArray) {
try {
Thread.sleep(0)
if (it.isNotEmpty() && it.size >= GasPortUtils.FULL_MSG_SIZE) {
val gasIndex = it[20].toInt()
LogUtils.w("gasIndexis ${gasIndex}")
val status = it[14].toInt()
val gasType = getGasTypeEnumByCode(it[19].toInt())
if (gasType == GasTypeEnum.TYPE_UNKNOW) {
@ -87,11 +89,18 @@ object ParseHelper {
}
}
private var flag = 0
private var count = 0
private var num = 0
private fun parseGasData(type: GasTypeEnum, it: ByteArray, status: Int) {
val unitHex: String = HexUtils.byteArrToHex(it, 3, 3 + 2)
val unitToLong: Long = HexUtils.hexToLong(unitHex)
val gasIndex = it[20].toInt()
LogUtils.w("gasIndexui is ${gasIndex}")
// 10000000000000
var unitBinaryString = java.lang.Long.toBinaryString(unitToLong)
//LogUtils.w("unitBinaryString is $unitBinaryString")
if (unitBinaryString.length < 16) {
val offset = 16 - unitBinaryString.length
repeat(offset) {
@ -99,10 +108,13 @@ object ParseHelper {
}
}
unitBinaryString = unitBinaryString.reversed()
LogUtils.w("unitBinaryString is $unitBinaryString")
//小数点
val subSequence = unitBinaryString.subSequence(8, 12).reversed()
val pointNum = ResponseHelper.getPointNum(subSequence)
LogUtils.w("subSequence is $subSequence")
//val pointNum = ResponseHelper.getPointNum(subSequence)
val pointNum = 1
LogUtils.w("pointNum is $pointNum")
// 单位
val subSequence2 = unitBinaryString.subSequence(12, 16).reversed()
val unit = ResponseHelper.getGasUnit(subSequence2)
@ -111,12 +123,15 @@ object ParseHelper {
val c18 = unitBinaryString[7].toString()
// 气体浓度
val valueHex: String = HexUtils.byteArrToHex(it, 5, 5 + 2)
val valueHexLong: Long = HexUtils.hexToLong(valueHex)
LogUtils.w("valueHex is $valueHex")
val valueHexLong: Long = HexUtils.hexToLong(valueHex) / 10
LogUtils.w("valueHexLong is $valueHexLong")
// 浓度
var value =
c18.plus(c17).plus(java.lang.Long.toBinaryString(valueHexLong)).toInt(2) / 10f.pow(
pointNum
)
//var value =
// c18.plus(c17).plus(java.lang.Long.toBinaryString(valueHexLong)).toInt(2) / 10f.pow(
// pointNum
//)
var value: Float = c18.plus(c17).plus(java.lang.Long.toBinaryString(valueHexLong)).toInt(2).toFloat() / 10f.pow(pointNum)
// 初始化的前20s钟浓度强制设置成0避免开机就显示浓度满量程
if (!GasPortUtils.isInitOver20Second()) {
// 氧气特殊处理氧气为0会报警氧气不置0
@ -124,6 +139,7 @@ object ParseHelper {
value = 0f
}
}
// 量程
val rangHex: String = HexUtils.byteArrToHex(it, 25, 25 + 4)
val rangHexLong: Long = HexUtils.hexToLong(rangHex)
@ -132,6 +148,12 @@ object ParseHelper {
// val temperatureHex: String = HexUtils.byteArrToHex(it, 17, 17 + 2)
// val temperature: Long = HexUtils.hexToLong(temperatureHex)
// 是否超量程
if(value>=19 && value<=22){
flag = 1
}
if(flag == 0 && type == GasTypeEnum.TYPE_O2){
value = 20.9f
}
val overRange = value > rangHexLong || status == 8
LogUtils.w("receive msg 单位转换前 $type, 浓度 = $value $unit, 最大量程 = $rangHexLong")
if (overRange) {
@ -142,6 +164,12 @@ object ParseHelper {
LogUtils.w("receive msg 多气体矫正后 $type, 浓度 = $value $unit")
unConvertValueMap[type.desc] = value
//val Gasvalue: Float = value.toFloat()
//LogUtils.w("valueis $Gasvalue")
//根据单位进行数值转换
val localGasUnit = getLocalGasUnit(type.desc)
if (localGasUnit != unit) {
@ -149,8 +177,90 @@ object ParseHelper {
LogUtils.w("receive msg 单位转换后 $type, 浓度 = $value $localGasUnit")
}
//获取当前气体value值
var localGasValue = getLocalGasValue(type.desc)
LogUtils.w("当前气体的值为 $localGasValue")
//当前气体值若异常小于3或大于30
if(type == GasTypeEnum.TYPE_O2){
if(value<3){
localGasValue = getLocalGasValue(type.desc)
if(localGasValue>=3){
value = (localGasValue - 0.2).toFloat()
}
Thread.sleep(500)
}else if(value>30){
localGasValue = getLocalGasValue(type.desc)
if(localGasValue>30){
value = 30F
}else{
value = (localGasValue + 0.2).toFloat()
}
Thread.sleep(500)
}
}
var localH2SValue = getLocalGasValue(type.desc)
var localCOValue = getLocalGasValue(type.desc)
//当前气体是H2S大于7是低报大于15是高报警正常值为0
if(type == GasTypeEnum.TYPE_H2S){
localH2SValue = getLocalGasValue(type.desc)
LogUtils.w("localH2SValueis $localH2SValue")
if(value > 10){
count = count+1
Thread.sleep(500)
}else{
count = 0
}
}
if(type == GasTypeEnum.TYPE_CO){
localCOValue = getLocalGasValue(type.desc)
LogUtils.w("localCOValueis $localCOValue")
if(value > 35){
num = num+1
Thread.sleep(500)
}else{
num = 0
}
}
LogUtils.w("当前计数值是 $count")
val gasValue = String.format("%.1f", value)
value = gasValue.toFloat()
LogUtils.w("gasvalueis $gasValue")
LogUtils.w("valueis $value")
if(value <= 0){
value = 0.0f
}
//插入当前气体value值
saveGasValue(type.desc,value)
LogUtils.w("当前插入的值是 $value")
if(type == GasTypeEnum.TYPE_H2S){
if(count>1 || count == 0){
insertGasData(type,value, localGasUnit, overRange)
}else{
LogUtils.w("localH2SValue22is $localH2SValue")
insertGasData(type,localH2SValue, localGasUnit, overRange)
}
}else if(type == GasTypeEnum.TYPE_CO){
if(num>1 || num == 0){
insertGasData(type,value, localGasUnit, overRange)
}else{
LogUtils.w("localCOValue22is $localH2SValue")
insertGasData(type,localCOValue, localGasUnit, overRange)
}
}else{
insertGasData(type,value, localGasUnit, overRange)
}
// 插入
insertGasData(type, value, localGasUnit, overRange)
//insertGasData(type, value, localGasUnit, overRange)
}
private fun setOverlayData(gas: Gas) {
@ -172,6 +282,7 @@ object ParseHelper {
// 构造气体数据
val timeMillis = System.currentTimeMillis()
val gas = Gas(timeMillis, typeEnum.desc, value, unit, min, max)
LogUtils.w("gas is $gas")
// 设置水印数据
setOverlayData(gas)

@ -13,7 +13,6 @@ const val NO = "NO"
const val HF = "HF"
const val CO2 = "CO2"
const val VOCS = "可挥发性有机物"
/**
* 气体分子质量
*/

@ -19,7 +19,7 @@ object ResponseHelper {
*/
fun getGasUnit(sequence: CharSequence): String {
return when (sequence.toString()) {
"0000" -> "ppm"
"0000" -> "μmol/mol"
"0010" -> "%LEL"
"0100" -> "%VOL"
"0110" -> "mg/m3"

@ -4,14 +4,17 @@ import android.graphics.Color
import android.view.KeyEvent
import android.view.View
import com.common.commonlib.db.entity.Gas
import com.common.commonlib.utils.LogUtils
import com.github.mikephil.charting.components.XAxis
import com.github.mikephil.charting.data.Entry
import com.github.mikephil.charting.data.LineData
import com.github.mikephil.charting.data.LineDataSet
import com.github.mikephil.charting.formatter.IndexAxisValueFormatter
import com.github.mikephil.charting.formatter.ValueFormatter
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityChartBinding
import com.yinuo.safetywatcher.watcher.base.NoOptionsActivity
import com.yinuo.safetywatcher.watcher.port.getLocalGasUnit
import com.yinuo.safetywatcher.watcher.utils.ChartBridge
import java.text.SimpleDateFormat
import java.util.Locale
@ -50,6 +53,8 @@ class ChartActivity : NoOptionsActivity() {
mSelectGas = ChartBridge.getSelectGas()
val mapData = ChartBridge.getMapData()
mGases = mapData?.get(mSelectGas)
LogUtils.w("mapData11 is $mapData")
LogUtils.w("mGases11 is $mGases")
}
private fun setKeyControl() {
@ -115,6 +120,7 @@ class ChartActivity : NoOptionsActivity() {
valueFormatter = object : IndexAxisValueFormatter() {
override fun getFormattedValue(value: Float): String {
val index = value.toInt();
LogUtils.w("index11 is $index")
if (index >= 0 && index < (mGases?.size ?: 0)) {
val baseTime = mGases?.get(index)?.time
return dataFormat.format(baseTime)
@ -123,7 +129,18 @@ class ChartActivity : NoOptionsActivity() {
}
}
}
axisLeft.apply{
valueFormatter = object : ValueFormatter() {
override fun getFormattedValue(value: Float): String {
val index = value.toInt();
if (index >= 0 && index < (mGases?.size ?: 0)) {
val gasUnit = mGases?.get(index)?.unit
return "$value$gasUnit" // 在每个标签后面添加单位 "°C" //
}
return ""
}
}
}
axisRight.isEnabled = false
axisLeft.textColor = Color.WHITE
axisLeft.textSize = 20f
@ -149,9 +166,11 @@ class ChartActivity : NoOptionsActivity() {
) else (
(index + pointCountPerPage) / pointCountPerPage
)
LogUtils.w("scale11 is $scale")
mBinding.chart.xAxis.axisMaximum = (scale * pointCountPerPage).toFloat()
mXScale = scale.toFloat()
val data = LineData(lineDataSet);
LogUtils.w("data11 is $data")
setData(data)
val mMatrix = mBinding.chart.viewPortHandler.matrixTouch

@ -20,6 +20,7 @@ import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import java.io.File
import java.util.concurrent.atomic.AtomicBoolean
class CloudActivity : NoOptionsActivity() {
@ -102,7 +103,9 @@ class CloudActivity : NoOptionsActivity() {
}
private suspend fun uploadVideo() {
LogUtils.w("entervideo")
if (!uploadingVideo.get()) {
LogUtils.w("videoget")
uploadingVideo.set(true)
// 1.拿到云端最新数据时间
val timeResponse = devicesApi.getVideoLastTime()
@ -169,6 +172,7 @@ class CloudActivity : NoOptionsActivity() {
}
private suspend fun getFileListAndUpload(cloudTime: Long) {
LogUtils.w("enterfilelist")
val videoDao = DBUtils.videoDao()
val videoList = videoDao.getAllByTime(cloudTime, System.currentTimeMillis())
// 上传
@ -178,11 +182,17 @@ class CloudActivity : NoOptionsActivity() {
}
private suspend fun uploadFile(video: Video) {
val response = uploadApi.singleUpload(video.path, video.time)
if (response.isOk()) {
val videoDaoImpl = DBUtils.videoDao()
video.uploaded = true
videoDaoImpl.update(video)
LogUtils.w("videopath is ${video.path}")
val file = File(video.path)
if (file.exists()){
LogUtils.w("uploadvideoenternew")
val response = uploadApi.singleUpload(video.path, video.time)
if (response.isOk()) {
LogUtils.w("responseok")
val videoDaoImpl = DBUtils.videoDao()
video.uploaded = true
videoDaoImpl.update(video)
}
}
}
}

@ -8,6 +8,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.common.commonlib.db.DBUtils
import com.common.commonlib.db.entity.Video
import com.common.commonlib.utils.LogUtils
import com.common.commonlib.utils.StorageUtils
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityHistoryVideoBinding
@ -131,6 +132,7 @@ class HistoryVideoActivity : BaseActivity() {
private fun export2Upan() {
val usbPath = StorageUtils.getStoragePath(this@HistoryVideoActivity)
LogUtils.w("usbPathiiis $usbPath");
if (usbPath.isNullOrEmpty()) {
showToast(getString(R.string.no_upan_tip))
return

@ -3,6 +3,7 @@ package com.yinuo.safetywatcher.watcher.ui
import android.content.Intent
import android.os.Build
import android.os.Process
import android.preference.PreferenceManager
import android.view.View
import androidx.annotation.RequiresApi
import androidx.core.view.postDelayed
@ -107,16 +108,24 @@ class HomeActivity : NoOptionsActivity() {
}
private fun onPumpClose() {
SpeedUtils.setPumpState(0)
SpeedUtils.setSpeed(0)
GasPortUtils.setSpeed(0)
}
private fun onPumpOpen() {
val localSpeed = SpeedUtils.getLocalSpeed()
//val localSpeed = SpeedUtils.getLocalSpeed()
SpeedUtils.setPumpState(1)
val localSpeed = SpeedUtils.getPageSpeed()
SpeedUtils.setSpeed(localSpeed)
GasPortUtils.setSpeed(localSpeed)
}
fun getSavedPathFromPreferences(): String? {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
return sharedPreferences.getString("usbFilePath", null)
}
private fun onCameraOpen() {
// 启动推送
PushHelper.opSwitch(true)
@ -124,12 +133,24 @@ class HomeActivity : NoOptionsActivity() {
GPIOUtils.openCamera()
setForCamera()
// 启动录制编码
RecordHelper.startRecording()
val filePaths = getSavedPathFromPreferences()
LogUtils.w("filePathsaa is $filePaths")
if (filePaths == null || filePaths == "/storage/0/video") {
RecordHelper.startRecording(this)
}else{
RecordHelper.startRecordingUSB(this,filePaths)
}
}
private fun onCameraClose() {
// 暂停录制编码
RecordHelper.stopRecording()
val filePaths = getSavedPathFromPreferences()
LogUtils.w("filePathsbb is $filePaths")
if (filePaths == null || filePaths == "/storage/0/video"){
RecordHelper.stopRecording()
}else{
RecordHelper.stopRecordingUSB()
}
// 关闭推流
PushHelper.opSwitch(false)
PushHelper.stop()
@ -310,7 +331,18 @@ class HomeActivity : NoOptionsActivity() {
Process.killProcess(Process.myPid())
}
override fun onSosHelp(sos: Boolean) {
super.onSosHelp(sos)
if (sos) {
if (mBinding.tvSos.visibility == View.GONE) {
mBinding.tvSos.visibility = View.VISIBLE
}
} else {
if (mBinding.tvSos.visibility == View.VISIBLE) {
mBinding.tvSos.visibility = View.GONE
}
}
}
override fun onBackPressed() {
// super.onBackPressed()

@ -10,6 +10,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.common.commonlib.db.DBUtils
import com.common.commonlib.db.entity.Gas
import com.common.commonlib.utils.LogUtils
import com.common.commonlib.utils.StorageUtils
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityQueryDataBinding
@ -233,17 +234,20 @@ class QueryDataActivity : BaseActivity() {
private fun doExportData() {
val usbPath = StorageUtils.getStoragePath(this@QueryDataActivity)
LogUtils.w("doExportDatausbPathiiis $usbPath");
if (usbPath.isNullOrEmpty()) {
showToast(getString(R.string.no_upan_tip))
return
}
showLoadingDialog(R.string.export_data_tip, false)
lifecycleScope.launch(Dispatchers.IO) {
LogUtils.w("enterexportgas")
val exportGasExcelPath = ExportUtils.testExportExcel(
this@QueryDataActivity,
usbPath,
mAdapter._data,
)
LogUtils.w("exportGasExcelPathis $exportGasExcelPath")
var delayTime: Int = (mAdapter._data.size / 10) * 35
if (delayTime < 9000) {
delayTime = 9000

@ -0,0 +1,81 @@
package com.yinuo.safetywatcher.watcher.ui
import android.view.View
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityRecoveryBinding
import com.common.commonlib.utils.LogUtils
import com.yinuo.safetywatcher.watcher.base.NoOptionsActivity
import com.yinuo.safetywatcher.watcher.utils.showToast
import android.content.Intent
import android.util.Log
import androidx.lifecycle.lifecycleScope
import com.common.commonlib.db.DBUtils
import com.common.commonlib.db.dao.VideoDao
import kotlinx.coroutines.launch
import java.io.File
import android.os.Bundle
import android.preference.PreferenceManager
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.common.commonlib.utils.MMKVUtils
import com.common.commonlib.utils.StorageUtils
import com.yinuo.safetywatcher.watcher.ui.view.ConfirmDialog
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class RecoveryActivity : NoOptionsActivity() {
private val recoveryFactoryDialog by lazy {
ConfirmDialog(getString(R.string.confirm_clear_data_tip)) {
resetEverything()
}
}
private val mBinding by lazy {
ActivityRecoveryBinding.inflate(layoutInflater)
}
override fun getTopBarTitle(): String? {
return getString(R.string.back)
}
override fun generateContentView(): View {
return mBinding.root
}
var sensorIndex = -1
var showRbView: View? = null
override fun initView() {
setListener()
}
private fun setListener() {
mBinding.tvSave.setOnClickListener {
saveSetting()
}
}
private fun resetEverything() {
val intent = Intent("android.intent.action.FACTORY_RESET")
intent.setPackage("android")
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
intent.putExtra("android.intent.extra.REASON", "MasterClearConfirm")
intent.putExtra("com.android.internal.intent.extra.WIPE_ESIMS", false)
sendBroadcast(intent);
}
private fun saveSetting(){
val password = "pwyingjibao"
val passwd = mBinding.etPw.text.toString()
LogUtils.w("passwdis $passwd")
if(passwd == password){
recoveryFactoryDialog.show(supportFragmentManager, "resetDialog")
}else{
showToast("密码错误")
}
}
}

@ -17,6 +17,7 @@ import com.yinuo.safetywatcher.watcher.port.ParseHelper
import com.yinuo.safetywatcher.watcher.port.UNIT_LEL
import com.yinuo.safetywatcher.watcher.port.UNIT_MGM3
import com.yinuo.safetywatcher.watcher.port.UNIT_PPM
import com.yinuo.safetywatcher.watcher.port.UNIT_UMOL
import com.yinuo.safetywatcher.watcher.port.UNIT_VOL
import com.yinuo.safetywatcher.watcher.port.cmd.GasPortStatus
import com.yinuo.safetywatcher.watcher.port.getLocalGasUnit
@ -78,9 +79,12 @@ class SensorSettingActivity : NoOptionsActivity() {
} else if (localGasUnit == UNIT_LEL) {
mBinding.rbLel.isChecked = true
showRbView = mBinding.rbLel
} else {
} else if (localGasUnit == UNIT_MGM3){
mBinding.rbMgm3.isChecked = true
showRbView = mBinding.rbMgm3
} else {
mBinding.rbUmol.isChecked = true
showRbView = mBinding.rbUmol
}
// }
@ -286,6 +290,8 @@ class SensorSettingActivity : NoOptionsActivity() {
selectedUnit = UNIT_VOL
} else if (checkedRadioButtonId == R.id.rb_lel) {
selectedUnit = UNIT_LEL
} else if (checkedRadioButtonId == R.id.rb_umol) {
selectedUnit = UNIT_UMOL
}
saveGasUnit(gasName, selectedUnit)
MMKVUtils.sync()

@ -49,14 +49,18 @@ class SettingActivity : NoOptionsActivity() {
itemVideo.setOnClickListener {
startActivity(Intent(this@SettingActivity, HistoryVideoActivity::class.java))
}
itemStorage.setOnClickListener {
startActivity(Intent(this@SettingActivity, VideoStorageActivity::class.java))
}
itemSensor.setOnClickListener {
startActivity(Intent(this@SettingActivity, SensorActivity::class.java))
}
itemSpeed.setOnClickListener {
startActivity(Intent(this@SettingActivity, SpeedSettingActivity::class.java))
}
itemSpeed.visibility = if (speed == 0) View.GONE else View.VISIBLE
itemLink.setOnClickListener {
// itemSpeed.visibility = if (speed == 0) View.GONE else View.VISIBLE
itemSpeed.visibility = View.VISIBLE
itemLink.setOnClickListener {
startActivity(Intent(this@SettingActivity, LinkSettingActivity::class.java))
}
itemLink.visibility = if (!LztekUtil.isLinkSwitchOpen()) View.GONE else View.VISIBLE
@ -67,8 +71,15 @@ class SettingActivity : NoOptionsActivity() {
startActivity(Intent(this@SettingActivity, NetSettingActivity::class.java))
}
//itemVideoRestore.setOnClickListener {
//startActivity(Intent(this@SettingActivity, VideoRestoreActivity::class.java))
//}
//itemRecovery.setOnClickListener {
// resetFactoryDialog.show(supportFragmentManager, "resetDialog")
//}
itemRecovery.setOnClickListener {
resetFactoryDialog.show(supportFragmentManager, "resetDialog")
startActivity(Intent(this@SettingActivity, RecoveryActivity::class.java))
}
itemAbout.setOnClickListener {

@ -58,6 +58,11 @@ class SpeedSettingActivity : NoOptionsActivity() {
return localSpeed
}
private fun getDefaultState(): Int{
var localState = SpeedUtils.getState()
return localState
}
/**
* 设置转速
*/
@ -69,9 +74,15 @@ class SpeedSettingActivity : NoOptionsActivity() {
legalSpeed = 9
}
val speed = SpeedUtils.getSpeed()
val state = getDefaultState()
if (speed != legalSpeed) {
SpeedUtils.setSpeed(legalSpeed)
GasPortUtils.setSpeed(legalSpeed)
if(state == 1){
SpeedUtils.setSpeed(legalSpeed)
SpeedUtils.setPageSpeed(legalSpeed)
GasPortUtils.setSpeed(legalSpeed)
}else{
SpeedUtils.setPageSpeed(legalSpeed)
}
}
}

@ -2,6 +2,7 @@ package com.yinuo.safetywatcher.watcher.ui
import android.view.KeyEvent
import android.view.View
import com.common.commonlib.utils.LogUtils
import com.loper7.date_time_picker.DateTimeConfig
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityTimeSettingBinding
@ -34,6 +35,9 @@ class TimeSettingActivity : NoOptionsActivity() {
override fun initView() {
// 初始化默认时间
val time = System.currentTimeMillis()
//+ 8997120500
//LogUtils.w("times is $time")
setShowTime(time)
mBingding.picker.setOnDateTimeChangedListener {

@ -0,0 +1,106 @@
package com.yinuo.safetywatcher.watcher.ui
import android.view.View
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityVideoStorageBinding
import com.common.commonlib.utils.LogUtils
import com.yinuo.safetywatcher.watcher.base.NoOptionsActivity
import com.yinuo.safetywatcher.watcher.utils.showToast
import android.content.Intent
import android.util.Log
import androidx.lifecycle.lifecycleScope
import com.common.commonlib.db.DBUtils
import com.common.commonlib.db.dao.VideoDao
import kotlinx.coroutines.launch
import java.io.File
import android.os.Bundle
import android.preference.PreferenceManager
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import com.common.commonlib.utils.MMKVUtils
import com.common.commonlib.utils.StorageUtils
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
class VideoStorageActivity : NoOptionsActivity() {
private val mBinding by lazy {
ActivityVideoStorageBinding.inflate(layoutInflater)
}
private val videoDao = DBUtils.videoDao()
override fun getTopBarTitle(): String? {
return getString(R.string.back)
}
override fun generateContentView(): View {
return mBinding.root
}
var sensorIndex = -1
var showRbView: View? = null
override fun initView() {
lifecycleScope.launch {
try {
//val filePaths = videoDao.getAllFilePathsOnce()
val filePaths = getSavedPathFromPreferences()
if (filePaths!=null) {
if(filePaths == "/storage/0/video"){
mBinding.typeInter.isChecked = true
showRbView = mBinding.typeInter
}else{
val usbPath = StorageUtils.getStoragePath(this@VideoStorageActivity)
LogUtils.w("videousbpath is $usbPath")
if(usbPath.isNullOrEmpty()){
mBinding.typeInter.isChecked = true
showRbView = mBinding.typeInter
}else{
mBinding.typeExter.isChecked = true
showRbView = mBinding.typeExter
}
}
} else {
mBinding.typeInter.isChecked = true
showRbView = mBinding.typeInter
}
} catch (e: Exception) {
Log.e("VideoStorageActivity", "Failed to fetch file paths", e)
}
}
setListener()
}
private fun setListener() {
mBinding.tvSave.setOnClickListener {
saveSetting()
}
}
fun savePathToPreferences(path: String) {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
sharedPreferences.edit().putString("usbFilePath", path).apply()
}
// 从 SharedPreferences 中读取路径
fun getSavedPathFromPreferences(): String? {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
return sharedPreferences.getString("usbFilePath", null)
}
private fun saveSetting(){
val checkedRadioButtonId = mBinding.storageType.checkedRadioButtonId
var videopath = "/storage/0/video"
if(checkedRadioButtonId == R.id.type_exter){
val usbPath = StorageUtils.getStoragePath(this@VideoStorageActivity)
if(usbPath.isNullOrEmpty()){
showToast(getString(R.string.no_upan_tip))
return
}
videopath = usbPath + "/video"
LogUtils.w("videopathis $videopath")
}
savePathToPreferences(videopath)
showToast("保存成功")
}
}

@ -7,6 +7,7 @@ import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.common.commonlib.db.DBUtils
import com.common.commonlib.db.entity.Warning
import com.common.commonlib.utils.LogUtils
import com.common.commonlib.utils.StorageUtils
import com.yinuo.safetywatcher.R
import com.yinuo.safetywatcher.databinding.ActivityWarndataBinding
@ -131,11 +132,15 @@ class WarnDataActivity : BaseActivity() {
}
showLoadingDialog(R.string.export_data_tip, false)
lifecycleScope.launch(Dispatchers.IO) {
LogUtils.w("enterlifecycle")
val exportWarnExcelPath = ExportUtils.testExportWarnExcel(
this@WarnDataActivity,
usbPath,
mAdapter._data,
)
LogUtils.w("exportWarnExcelPathis $exportWarnExcelPath")
var delayTime: Int = (mAdapter._data.size / 10) * 35
if (delayTime < 9000) {
delayTime = 9000

@ -22,6 +22,7 @@ import com.yinuo.safetywatcher.watcher.interfaces.NetworkStateCallback
import com.yinuo.safetywatcher.watcher.utils.BatteryHelper
import com.yinuo.safetywatcher.watcher.utils.NetworkHelper
import com.yinuo.safetywatcher.watcher.utils.trySetCommonBg
import kotlinx.coroutines.delay
class CommonTopBar : LinearLayout {
constructor(context: Context?) : this(context, null)
@ -85,18 +86,32 @@ class CommonTopBar : LinearLayout {
override fun onEnable(enable: Boolean) {
LogUtils.w("wifiCallback onEnable = $enable")
mBinding?.root?.post {
// mBinding?.wifi?.visibility = if (enable) View.VISIBLE else View.GONE
mBinding?.wifi?.setImageLevel(0)
//mBinding?.wifi?.visibility = if (enable) View.VISIBLE else View.GONE
if (!enable){
LogUtils.w("enbale未打开")
mBinding?.wifi?.setImageLevel(0)
}
mBinding?.wifi?.visibility = View.VISIBLE
}
LogUtils.w("wifiEnable is ${mBinding?.wifi?.visibility}")
}
override fun onLevel(level: Int) {
LogUtils.w("wifiCallback onLevel = $level")
mBinding?.root?.post {
// mBinding?.wifi?.visibility = if (level > 0) VISIBLE else GONE
val showLevel = (level + 1) * 20
mBinding?.wifi?.setImageLevel(showLevel)
//mBinding?.wifi?.visibility = if (level > 0) VISIBLE else GONE
mBinding?.wifi?.visibility = VISIBLE
if(level > 0){
val showLevel = (level + 1) * 20
mBinding?.wifi?.setImageLevel(showLevel)
}else{
mBinding?.wifi?.setImageLevel(0)
}
//val showLevel = (level + 1) * 20
//mBinding?.wifi?.setImageLevel(showLevel)
}
LogUtils.w("wifilever is ${mBinding?.wifi?.visibility}")
LogUtils.w("wifishowlevel is $level")
}
}
@ -104,25 +119,46 @@ class CommonTopBar : LinearLayout {
* sim卡状态和信号
* **/
private val simCallback = object : NetworkStateCallback {
var simState = 0
override fun onEnable(enable: Boolean) {
LogUtils.w("sim enable callback : $enable")
mBinding?.root?.post {
// mBinding?.fourG?.visibility = if (enable) View.VISIBLE else View.GONE
mBinding?.fourG?.setImageLevel(0)
//mBinding?.fourG?.visibility = if (enable) View.VISIBLE else View.GONE
if(!enable){
mBinding?.fourG?.setImageLevel(0)
}else{
simState = 1
}
mBinding?.fourG?.visibility = View.VISIBLE
}
}
override fun onLevel(level: Int) {
LogUtils.w("simCallback onLevel = $level")
mBinding?.root?.post {
var showLevel = (level + 1) * 20
/* var showLevel = (level + 1) * 20
// var showLevel =
// if (AppData.hasCameraData()) (level / 15 + 1) * 20 else (level + 1) * 20
if (showLevel > 100) {
showLevel = 100
}
mBinding?.fourG?.setImageLevel(showLevel)
mBinding?.fourG?.setImageLevel(showLevel)*/
mBinding?.fourG?.visibility = View.VISIBLE
if(simState == 1){
if(level > 0){
var showLevel = level * 20
if (showLevel > 100) {
showLevel = 100
}
mBinding?.fourG?.setImageLevel(showLevel)
}else{
mBinding?.fourG?.setImageLevel(0)
}
}
else{
mBinding?.fourG?.setImageLevel(0)
}
}
}
}

@ -30,6 +30,7 @@ object ExportUtils {
}
LogUtils.w("testExportExcel ori data size = ${datas.size}, cell data size = ${allData.size}")
val excelPath = ExcelUtils.writeStringListToExcel(allData, usbPath, context)
LogUtils.w("excelPathis $excelPath")
return excelPath
}

@ -2,6 +2,7 @@ package com.yinuo.safetywatcher.watcher.utils
import android.os.Environment
import com.common.commonlib.CommonApplication
import com.common.commonlib.utils.LogUtils
import com.common.commonlib.utils.MMKVUtils
import com.common.commonlib.utils.StorageUtils
import com.lztek.toolkit.Lztek
@ -70,6 +71,7 @@ object LztekUtil {
fun setRtspUrl(str: String?) {
this.rtspUrl = str
LogUtils.w("rtspUrl is $str")
rtspUrl?.let {
PushHelper.setPushUrl(it)
}

@ -1,9 +1,13 @@
package com.yinuo.safetywatcher.watcher.utils
import android.content.Context
import android.graphics.Bitmap
import android.view.TextureView
import com.common.commonlib.utils.LogUtils
import org.easydarwin.TxtOverlay
import org.easydarwin.push.HWConsumer
import com.yinuo.library.vlc.encoder.CameraHelper
object RecordHelper {
@ -12,6 +16,7 @@ object RecordHelper {
private const val overlayOffset = 20
private var recording = false;
private var consumer: HWConsumer? = null
private var camera: CameraHelper? = null
fun onFrameAvailable(view: TextureView, nv12Data: ByteArray) {
if (!recording) {
@ -43,14 +48,23 @@ object RecordHelper {
consumer?.onVideo(nv12Data, 0)
}
fun startRecording() {
fun startRecording(context: Context) {
if (!recording) {
recording = true
consumer = HWConsumer()
consumer = HWConsumer(context)
consumer?.onVideoStart(width, height)
}
}
fun startRecordingUSB(context: Context,path:String){
if(!recording){
LogUtils.w("contextis $context")
recording = true
consumer = HWConsumer(context)
consumer?.onUSBStart(path)
}
}
fun stopRecording() {
if (recording) {
recording = false
@ -58,4 +72,13 @@ object RecordHelper {
consumer = null
}
}
fun stopRecordingUSB() {
if (recording) {
recording = false
consumer?.onUSBStop()
consumer = null
}
}
}

@ -4,11 +4,16 @@ import com.common.commonlib.utils.MMKVUtils
object SpeedUtils {
private var speed = 0
private var pumpState = 0
fun getSpeed(): Int {
return speed
}
fun getState(): Int {
return pumpState
}
fun setSpeed(legalSpeed: Int) {
this.speed = legalSpeed
if (legalSpeed != 0) {
@ -16,6 +21,22 @@ object SpeedUtils {
}
}
fun setPageSpeed(legalSpeed: Int) {
if (legalSpeed != 0) {
MMKVUtils.put("PageSpeed", legalSpeed)
}
}
fun setPumpState(legalState: Int){
this.pumpState = legalState
MMKVUtils.put("pumpState", legalState)
}
fun getPumpState(): Int{
var stateValue = MMKVUtils.getInt("pumpState")
return stateValue
}
fun getLocalSpeed(): Int {
var localValue = MMKVUtils.getInt("LocalSpeed")
if (localValue<0){
@ -23,4 +44,12 @@ object SpeedUtils {
}
return localValue
}
fun getPageSpeed(): Int {
var pageValue = MMKVUtils.getInt("PageSpeed")
if (pageValue<0){
pageValue = 1
}
return pageValue
}
}

@ -14,6 +14,10 @@ import jxl.write.WriteException
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import android.Manifest
import android.app.Activity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
/**
@ -92,7 +96,9 @@ object ExcelUtils {
}
}
fun writeStringListToExcel(
private const val REQUEST_EXTERNAL_STORAGE_PERMISSION = 1
/*fun writeStringListToExcel(
allRowsData: List<List<ICellValue>>,
usbPath: String,
context: Context,
@ -128,13 +134,105 @@ object ExcelUtils {
writebook.write()
Log.i(TAG, "Excelel 写入成功 $filePath")
return filePath
} catch (e: Exception) {
Log.e(TAG, "writeStringListToExcel() e==" + e.message)
} finally {
}
catch (e: Exception) {
Log.e(TAG, "writeStringListToExcel() e==" + e.message)
}
finally {
Log.i(TAG, "Excelelfinally")
writebook?.close()
inputStream?.close()
Log.i(TAG, "Excelel 写入完成")
}
return null
}*/
fun writeStringListToExcel(
allRowsData: List<List<ICellValue>>,
usbPath: String,
context: Context,
isWarnData: Boolean = false
): String? {
// 检查权限是否已经授予
if (ContextCompat.checkSelfPermission(
context,
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != android.content.pm.PackageManager.PERMISSION_GRANTED ||
ContextCompat.checkSelfPermission(
context,
Manifest.permission.READ_EXTERNAL_STORAGE
) != android.content.pm.PackageManager.PERMISSION_GRANTED
) {
Log.i(TAG, "权限未授予")
// 如果权限未开启,则请求权限
if (context is Activity) {
Log.i(TAG, "请求权限")
ActivityCompat.requestPermissions(
context,
arrayOf(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
),
REQUEST_EXTERNAL_STORAGE_PERMISSION
)
return null // 权限未开启时,直接返回
} else {
Log.e(TAG, "Context is not an Activity. Cannot request permissions.")
return null
}
}
Log.i(TAG, "开启权限")
// 如果权限已经开启,继续执行写入操作
val fileName =
if (!isWarnData)
"气体浓度_${PathUtils.getNowTimeFormat(PathUtils.DATE_TO_STRING_LONG_PATTERN)}.xls"
else "告警数据_${PathUtils.getNowTimeFormat(PathUtils.DATE_TO_STRING_LONG_PATTERN)}.xls"
val filePath =
usbPath + File.separator + fileName
val columns = context.resources.getStringArray(R.array.excel_column)
initExcel(columns, filePath, PathUtils.SHEET_NAME) // 需要写入权限
if (PathUtils.isListEmpty(allRowsData) || context == null)
return null
var writebook: WritableWorkbook? = null
var inputStream: InputStream? = null
try {
val setEncode = WorkbookSettings()
setEncode.encoding = UTF8_ENCODING
inputStream = FileInputStream(File(filePath))
val workbook = Workbook.getWorkbook(inputStream)
val file = File(filePath)
writebook = Workbook.createWorkbook(file, workbook)
val sheet = writebook.getSheet(0)
for ((row, item) in allRowsData.withIndex()) {
item.forEachIndexed { index, cellValue ->
sheet.addCell(Label(index, row + 1, cellValue.getValue(), arial12format))
}
}
writebook.write()
Log.i(TAG, "Excel 写入成功 $filePath")
return filePath
} catch (e: Exception) {
Log.e(TAG, "writeStringListToExcel() Exception occurred", e)
} finally {
Log.i(TAG, "Excel finally")
try {
writebook?.close()
Log.i(TAG, "Excel workbook closed successfully")
} catch (e: Exception) {
Log.e(TAG, "Failed to close workbook", e)
}
try {
inputStream?.close()
Log.i(TAG, "Input stream closed successfully")
} catch (e: Exception) {
Log.e(TAG, "Failed to close input stream", e)
}
Log.i(TAG, "Excel 写入完成")
}
return null
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/net_0"
android:maxLevel="0"
android:minLevel="0" />
<item
android:drawable="@drawable/net_1"
android:maxLevel="20"

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/wifi_0" android:minLevel="0" android:maxLevel="0"/>
<item android:drawable="@drawable/wifi_1" android:minLevel="0" android:maxLevel="33"/>
<item android:drawable="@drawable/wifi_2" android:minLevel="34" android:maxLevel="66"/>
<item android:drawable="@drawable/wifi_3" android:minLevel="67" android:maxLevel="100"/>

@ -115,6 +115,19 @@
android:textColor="@color/white"
android:textSize="@dimen/_132dp"
/>
<TextView
android:id="@+id/tv_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/msg_sos"
android:layout_below="@id/tv_sos"
android:minHeight="@dimen/_100dp"
android:layout_centerHorizontal="true"
android:padding="@dimen/_12dp"
android:textColor="@color/black"
android:textSize="@dimen/_40dp"
/>
</RelativeLayout>
</RelativeLayout>

@ -47,8 +47,8 @@
android:paddingStart="@dimen/_66dp">
<ImageView
android:layout_width="@dimen/_29dp"
android:layout_height="@dimen/_29dp"
android:layout_width="@dimen/_36dp"
android:layout_height="@dimen/_36dp"
android:src="@mipmap/ic_setting" />
<TextView
@ -57,7 +57,7 @@
android:layout_marginStart="@dimen/_13dp"
android:text="@string/setting"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
</LinearLayout>
<LinearLayout
@ -70,8 +70,8 @@
android:paddingStart="@dimen/_66dp">
<ImageView
android:layout_width="@dimen/_29dp"
android:layout_height="@dimen/_29dp"
android:layout_width="@dimen/_36dp"
android:layout_height="@dimen/_36dp"
android:src="@mipmap/ic_query" />
<TextView
@ -80,7 +80,7 @@
android:layout_marginStart="@dimen/_13dp"
android:text="@string/query"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
</LinearLayout>
@ -94,8 +94,8 @@
android:paddingStart="@dimen/_66dp">
<ImageView
android:layout_width="@dimen/_29dp"
android:layout_height="@dimen/_29dp"
android:layout_width="@dimen/_36dp"
android:layout_height="@dimen/_36dp"
android:src="@mipmap/ic_wraning" />
<TextView
@ -104,7 +104,7 @@
android:layout_marginStart="@dimen/_13dp"
android:text="@string/wraning"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
</LinearLayout>
<LinearLayout
@ -117,8 +117,8 @@
android:paddingStart="@dimen/_66dp">
<ImageView
android:layout_width="@dimen/_29dp"
android:layout_height="@dimen/_29dp"
android:layout_width="@dimen/_36dp"
android:layout_height="@dimen/_36dp"
android:src="@mipmap/ic_recovery" />
<TextView
@ -127,7 +127,7 @@
android:layout_marginStart="@dimen/_13dp"
android:text="@string/recovery"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
</LinearLayout>
<LinearLayout
@ -144,7 +144,7 @@
android:layout_height="wrap_content"
android:text="@string/camera"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/camera_switch"
@ -168,7 +168,7 @@
android:layout_height="wrap_content"
android:text="@string/pump_switch"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/pump_switch"
@ -193,7 +193,7 @@
android:layout_height="wrap_content"
android:text="@string/link_switch"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
android:textSize="@dimen/_40dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/link_switch"
@ -220,7 +220,7 @@
android:minHeight="@dimen/_100dp"
android:padding="@dimen/_12dp"
android:textColor="@color/white"
android:textSize="@dimen/_30dp"
android:textSize="@dimen/_40dp"
android:visibility="gone" />
<TextView

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/_303852"
android:orientation="vertical">
<com.yinuo.safetywatcher.watcher.ui.view.CommonTopBar
android:id="@+id/topBar"
android:layout_width="match_parent"
android:layout_height="@dimen/_120dp" />
<RelativeLayout
android:id="@+id/area_sound"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/warn_setting_btn_bg"
android:padding="@dimen/_20dp"
android:visibility="gone">
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="音量"
android:textColor="@color/white"
android:textSize="@dimen/_40dp" />
<SeekBar
android:id="@+id/sb_sound"
style="@style/LightSeekbarStyle"
android:layout_width="@dimen/_630dp"
android:layout_height="@dimen/_100dp"
android:layout_below="@+id/tv"
android:layout_marginTop="@dimen/_20dp"
android:focusable="true"
android:nextFocusRight="@id/sb_sound"
android:nextFocusLeft="@id/sb_sound"
android:min="0"
android:padding="0dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout_shutdown"
android:layout_width="@dimen/_960dp"
android:layout_height="200px"
android:layout_centerInParent="true"
android:background="@drawable/warn_setting_btn_bg"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/_32dp"
android:layout_marginBottom="@dimen/_32dp"
android:text="您的设备将会关机!"
android:textColor="@color/white"
android:textSize="@dimen/_36dp" />
<TextView
android:id="@+id/tv_cancel"
android:layout_width="@dimen/_480dp"
android:layout_height="@dimen/_81dp"
android:layout_alignParentBottom="true"
android:background="@drawable/cancel_btn_bg"
android:focusable="true"
android:gravity="center"
android:text="@string/cancel"
android:nextFocusLeft="@id/tv_cancel"
android:textColor="@color/white_30"
android:textSize="@dimen/_36dp" />
<TextView
android:id="@+id/tv_confirm"
android:layout_width="@dimen/_480dp"
android:layout_height="@dimen/_81dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="@drawable/confirm_btn_bg"
android:focusable="true"
android:gravity="center"
android:text="@string/confirm"
android:nextFocusRight="@id/tv_confirm"
android:textColor="@color/white"
android:textSize="@dimen/_36dp" />
</RelativeLayout>
</RelativeLayout>

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="@dimen/_121dp"
android:paddingTop="@dimen/_61dp">
<TextView
android:id="@+id/tv_pass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/admin_passwd"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
<EditText
android:id="@+id/et_pw"
android:layout_width="@dimen/_600dp"
android:layout_height="@dimen/_100dp"
android:layout_marginTop="@dimen/_20dp"
android:background="@drawable/cloud_sync_btn_bg"
android:paddingStart="@dimen/_12dp"
android:focusable="true"
android:nextFocusDown="@id/et_pw"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
<TextView
android:id="@+id/tv_save"
android:layout_width="@dimen/_160dp"
android:layout_height="@dimen/_80dp"
android:layout_marginTop="@dimen/_40dp"
android:background="@drawable/save_btn_bg"
android:focusable="true"
android:gravity="center"
android:text="@string/confirm"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
</LinearLayout>

@ -0,0 +1,19 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="保存视频"
android:textSize="18sp" />
<Button
android:id="@+id/btn_save_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="保存视频" />
</LinearLayout>

@ -168,6 +168,18 @@
android:text="@string/unit_mg_m3"
android:textColor="@color/white"
android:textSize="@dimen/_28dp" />
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/rb_umol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_40dp"
android:focusable="true"
android:paddingHorizontal="@dimen/_6dp"
android:text="@string/unit_μmol_mol"
android:textColor="@color/white"
android:textSize="@dimen/_28dp" />
</RadioGroup>
<!--<RelativeLayout

@ -145,6 +145,34 @@
android:textSize="@dimen/_36dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/_2dp"
android:background="@color/_242f4d" />
<LinearLayout
android:id="@+id/item_storage"
android:layout_width="match_parent"
android:layout_height="@dimen/_108dp"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@dimen/_121dp">
<ImageView
android:layout_width="@dimen/_32dp"
android:layout_height="@dimen/_32dp"
android:src="@mipmap/ic_videostorage" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_21dp"
android:text="@string/video_storage"
android:textColor="@color/white"
android:textSize="@dimen/_36dp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/_2dp"

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:id="@+id/storage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/font_46dp">
<RadioGroup
android:id="@+id/storage_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_20dp"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/type_exter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/_6dp"
android:focusable="true"
android:text="@string/external_storage"
android:textColor="@color/white"
android:textSize="@dimen/_28dp"
android:layout_marginEnd="46dp"/>
<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/type_inter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="@dimen/_6dp"
android:focusable="true"
android:text="@string/internal_storage"
android:textColor="@color/white"
android:textSize="@dimen/_28dp" />
</RadioGroup>
</LinearLayout>
<TextView
android:id="@+id/tv_save"
android:layout_width="@dimen/_160dp"
android:layout_height="@dimen/_80dp"
android:layout_marginTop="@dimen/_40dp"
android:background="@drawable/save_btn_bg"
android:focusable="true"
android:gravity="center"
android:text="@string/save"
android:textColor="@color/white"
android:textSize="@dimen/_30dp" />
</LinearLayout>

@ -6,6 +6,7 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/back_area"
android:layout_width="wrap_content"
@ -76,20 +77,35 @@
</LinearLayout>
<ImageView
android:id="@+id/wifi"
android:layout_width="@dimen/_37dp"
android:layout_height="@dimen/_27dp"
android:layout_marginStart="@dimen/_40dp"
android:src="@drawable/wifi"
/>
<ImageView
android:id="@+id/four_g"
android:layout_width="@dimen/_33dp"
android:layout_height="@dimen/_33dp"
android:layout_marginStart="@dimen/_40dp"
android:src="@drawable/net"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginStart="@dimen/_40dp">
<ImageView
android:id="@+id/wifi"
android:layout_width="@dimen/_37dp"
android:layout_height="@dimen/_27dp"
android:src="@drawable/wifi"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginStart="@dimen/_40dp">
<ImageView
android:id="@+id/four_g"
android:layout_width="@dimen/_37dp"
android:layout_height="@dimen/_27dp"
android:src="@drawable/net"/>
</LinearLayout>
<Space
android:layout_width="@dimen/_36dp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -60,6 +60,7 @@
<dimen name="_320dp">320px</dimen>
<dimen name="_1920dp">1920px</dimen>
<dimen name="_1080dp">1080px</dimen>
<dimen name="_1500dp">1500px</dimen>
<dimen name="_120dp">120px</dimen>
<dimen name="_624dp">624px</dimen>
<dimen name="_712dp">712px</dimen>

@ -12,6 +12,7 @@
<string name="query_data">查询数据</string>
<string name="warn_data">报警数据</string>
<string name="history_video">历史视频</string>
<string name="video_storage">视频存储</string>
<string name="sensor">传感器</string>
<string name="speed_setting">气泵转速设置</string>
<string name="sensor_data">传感器数据详情</string>
@ -22,6 +23,7 @@
<string name="wifi_setting">WIFI设置</string>
<string name="recovery_setting">恢复出厂设置</string>
<string name="about_setting">关于本机</string>
<string name="video_restore">视频存储</string>
<string name="sync_sensor_txt">同步传感器数据</string>
<string name="sync_warn_txt">同步报警数据</string>
<string name="sync_video_txt">同步视频</string>
@ -65,6 +67,11 @@
<string name="sync_data_tip">数据同步中</string>
<string name="export_data_tip">数据导出中</string>
<string name="external_storage">外置存储</string>
<string name="internal_storage">内部存储</string>
<string name="admin_passwd">请输入管理员密码:</string>
<string name="connecting_camera">正在连接摄像头...</string>
<string name="repeat_click_sync_tip">正在同步中,请勿重复点击</string>
@ -72,7 +79,8 @@
<string name="low_threshold">低报警值(单位:</string>
<string name="high_threshold">高报警值(单位:</string>
<string name="gas_unit">气体单位</string>
<string name="unit_ppm">ppm</string>
<string name="unit_ppm">μmol/mol</string>
<string name="unit_μmol_mol">ppm</string>
<string name="unit_mg_m3">mg/m3</string>
<string name="unit_vol">%VOL</string>
<string name="unit_lel">%LEL</string>
@ -101,4 +109,5 @@
<string name="link_setting">联动开关设置</string>
<string name="link_delay_setting">联动开关延时,单位:秒</string>
<string name="text_sos">SOS</string>
<string name="msg_sos">需长按上键5s可解除报警</string>
</resources>

@ -1,9 +1,17 @@
apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
buildscript {
repositories {
// google()
// jcenter()
// maven { url "https://jitpack.io" }
google()
jcenter()
maven { url "https://jitpack.io" }
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public' } // Maven
maven { url 'https://maven.aliyun.com/repository/google' } // Google
maven { url 'https://maven.aliyun.com/repository/central' } // Maven Central
maven { url 'https://maven.aliyun.com/repository/jcenter' } // JCenter
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } // Gradle
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
@ -16,7 +24,12 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public' } // Maven
maven { url 'https://maven.aliyun.com/repository/google' } // Google
maven { url 'https://maven.aliyun.com/repository/central' } // Maven Central
maven { url 'https://maven.aliyun.com/repository/jcenter' } // JCenter
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } // Gradle
maven { url "https://jitpack.io" }
flatDir {

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
distributionUrl=https://services.gradle.org/distributions/gradle-7.2-all.zip

@ -0,0 +1,538 @@
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 289936 bytes. Error detail: Chunk::new
# Possible reasons:
# The system is out of physical RAM or swap space
# This process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# JVM is running with Unscaled Compressed Oops mode in which the Java heap is
# placed in the first 4GB address space. The Java Heap base address is the
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
# to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
# Out of Memory Error (arena.cpp:191), pid=25076, tid=23532
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.13+11 (17.0.13+11) (build 17.0.13+11)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (17.0.13+11, mixed mode, tiered, compressed oops, compressed class ptrs, parallel gc, windows-amd64)
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
--------------- S U M M A R Y ------------
Command Line: --add-modules=ALL-SYSTEM --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -DDetectVMInstallationsJob.disabled=true -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable -javaagent:c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\lombok\lombok-1.18.34.jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=c:\Users\28454\AppData\Roaming\Code\User\workspaceStorage\b58f7291be61a3d0acd7d49de26e9001\redhat.java -Daether.dependencyCollector.impl=bf c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\server\plugins\org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar -configuration c:\Users\28454\AppData\Roaming\Code\User\globalStorage\redhat.java\1.38.0\config_win -data c:\Users\28454\AppData\Roaming\Code\User\workspaceStorage\b58f7291be61a3d0acd7d49de26e9001\redhat.java\jdt_ws --pipe=\\.\pipe\lsp-26311645a2c3d8793ed79a5223161af5-sock
Host: 13th Gen Intel(R) Core(TM) i5-13420H, 12 cores, 15G, Windows 11 , 64 bit Build 22621 (10.0.22621.4391)
Time: Tue Jan 7 15:58:46 2025 Windows 11 , 64 bit Build 22621 (10.0.22621.4391) elapsed time: 3.769477 seconds (0d 0h 0m 3s)
--------------- T H R E A D ---------------
Current thread (0x000001efdb863e50): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=23532, stack(0x000000c659c00000,0x000000c659d00000)]
Current CompileTask:
C2: 3769 1334 4 lombok.patcher.PatchScript::classMatches (41 bytes)
Stack: [0x000000c659c00000,0x000000c659d00000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x682a19]
V [jvm.dll+0x839538]
V [jvm.dll+0x83afe3]
V [jvm.dll+0x83b653]
V [jvm.dll+0x24704f]
V [jvm.dll+0xace34]
V [jvm.dll+0xad4cc]
V [jvm.dll+0x2ac84f]
V [jvm.dll+0x588a79]
V [jvm.dll+0x220ea2]
V [jvm.dll+0x22129f]
V [jvm.dll+0x21a2b0]
V [jvm.dll+0x21738b]
V [jvm.dll+0x1a3070]
V [jvm.dll+0x22788c]
V [jvm.dll+0x2259eb]
V [jvm.dll+0x7eec98]
V [jvm.dll+0x7e8ffc]
V [jvm.dll+0x6818f7]
C [ucrtbase.dll+0x29333]
C [KERNEL32.DLL+0x1259d]
C [ntdll.dll+0x5af38]
--------------- P R O C E S S ---------------
Threads class SMR info:
_java_thread_list=0x000001efddf16ea0, length=13, elements={
0x000001efc2ac4f20, 0x000001efdb819d00, 0x000001efdb81ad10, 0x000001efdb856550,
0x000001efdb8572e0, 0x000001efdb85a820, 0x000001efdb85cc00, 0x000001efdb863e50,
0x000001efdb867010, 0x000001efdb867920, 0x000001efc2b27620, 0x000001efdba7cdf0,
0x000001efddfdd620
}
Java Threads: ( => current thread )
0x000001efc2ac4f20 JavaThread "main" [_thread_in_native, id=23288, stack(0x000000c659300000,0x000000c659400000)]
0x000001efdb819d00 JavaThread "Reference Handler" daemon [_thread_blocked, id=22196, stack(0x000000c659600000,0x000000c659700000)]
0x000001efdb81ad10 JavaThread "Finalizer" daemon [_thread_blocked, id=24900, stack(0x000000c659700000,0x000000c659800000)]
0x000001efdb856550 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=21912, stack(0x000000c659800000,0x000000c659900000)]
0x000001efdb8572e0 JavaThread "Attach Listener" daemon [_thread_blocked, id=19860, stack(0x000000c659900000,0x000000c659a00000)]
0x000001efdb85a820 JavaThread "Service Thread" daemon [_thread_blocked, id=8556, stack(0x000000c659a00000,0x000000c659b00000)]
0x000001efdb85cc00 JavaThread "Monitor Deflation Thread" daemon [_thread_blocked, id=6656, stack(0x000000c659b00000,0x000000c659c00000)]
=>0x000001efdb863e50 JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=23532, stack(0x000000c659c00000,0x000000c659d00000)]
0x000001efdb867010 JavaThread "C1 CompilerThread0" daemon [_thread_in_native, id=23704, stack(0x000000c659d00000,0x000000c659e00000)]
0x000001efdb867920 JavaThread "Sweeper thread" daemon [_thread_blocked, id=15868, stack(0x000000c659e00000,0x000000c659f00000)]
0x000001efc2b27620 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=10700, stack(0x000000c659f00000,0x000000c65a000000)]
0x000001efdba7cdf0 JavaThread "Notification Thread" daemon [_thread_blocked, id=3700, stack(0x000000c65a000000,0x000000c65a100000)]
0x000001efddfdd620 JavaThread "Active Thread: Equinox Container: 5a0892c7-aadb-4811-ad48-f9f392fab6e5" [_thread_blocked, id=22208, stack(0x000000c65a800000,0x000000c65a900000)]
Other Threads:
0x000001efdb8130f0 VMThread "VM Thread" [stack: 0x000000c659500000,0x000000c659600000] [id=25128]
0x000001efdba7d2d0 WatcherThread [stack: 0x000000c65a100000,0x000000c65a200000] [id=12240]
0x000001efc2ad98a0 GCTaskThread "GC Thread#0" [stack: 0x000000c659400000,0x000000c659500000] [id=25072]
0x000001efdde11560 GCTaskThread "GC Thread#1" [stack: 0x000000c65a200000,0x000000c65a300000] [id=16908]
0x000001efddb76390 GCTaskThread "GC Thread#2" [stack: 0x000000c65a300000,0x000000c65a400000] [id=6948]
0x000001efddb76650 GCTaskThread "GC Thread#3" [stack: 0x000000c65a400000,0x000000c65a500000] [id=25216]
0x000001efddb76910 GCTaskThread "GC Thread#4" [stack: 0x000000c65a500000,0x000000c65a600000] [id=22888]
0x000001efddb76bd0 GCTaskThread "GC Thread#5" [stack: 0x000000c65a600000,0x000000c65a700000] [id=22148]
0x000001efddb76e90 GCTaskThread "GC Thread#6" [stack: 0x000000c65a700000,0x000000c65a800000] [id=8580]
Threads with active compile tasks:
C2 CompilerThread0 3935 1334 4 lombok.patcher.PatchScript::classMatches (41 bytes)
VM state: not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap address: 0x00000000c0000000, size: 1024 MB, Compressed Oops mode: 32-bit
CDS archive(s) not mapped
Compressed class space mapped at: 0x0000000100000000-0x0000000140000000, reserved size: 1073741824
Narrow klass base: 0x0000000000000000, Narrow klass shift: 3, Narrow klass range: 0x140000000
GC Precious Log:
CPUs: 12 total, 12 available
Memory: 16107M
Large Page Support: Disabled
NUMA Support: Disabled
Compressed Oops: Enabled (32-bit)
Alignments: Space 512K, Generation 512K, Heap 2M
Heap Min Capacity: 100M
Heap Initial Capacity: 100M
Heap Max Capacity: 1G
Pre-touch: Disabled
Parallel Workers: 10
Heap:
PSYoungGen total 29696K, used 20501K [0x00000000eab00000, 0x00000000ecc00000, 0x0000000100000000)
eden space 25600K, 67% used [0x00000000eab00000,0x00000000ebbcfe30,0x00000000ec400000)
from space 4096K, 80% used [0x00000000ec400000,0x00000000ec735980,0x00000000ec800000)
to space 4096K, 0% used [0x00000000ec800000,0x00000000ec800000,0x00000000ecc00000)
ParOldGen total 68608K, used 16K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
object space 68608K, 0% used [0x00000000c0000000,0x00000000c0004000,0x00000000c4300000)
Metaspace used 13307K, committed 13504K, reserved 1114112K
class space used 1311K, committed 1408K, reserved 1048576K
Card table byte_map: [0x000001efc2430000,0x000001efc2640000] _byte_map_base: 0x000001efc1e30000
Marking Bits: (ParMarkBitMap*) 0x00007ffed9c66940
Begin Bits: [0x000001efd4730000, 0x000001efd5730000)
End Bits: [0x000001efd5730000, 0x000001efd6730000)
Polling page: 0x000001efc21e0000
Metaspace:
Usage:
Non-class: 11.72 MB used.
Class: 1.28 MB used.
Both: 13.00 MB used.
Virtual space:
Non-class space: 64.00 MB reserved, 11.81 MB ( 18%) committed, 1 nodes.
Class space: 1.00 GB reserved, 1.38 MB ( <1%) committed, 1 nodes.
Both: 1.06 GB reserved, 13.19 MB ( 1%) committed.
Chunk freelists:
Non-Class: 3.64 MB
Class: 14.53 MB
Both: 18.17 MB
MaxMetaspaceSize: unlimited
CompressedClassSpaceSize: 1.00 GB
Initial GC threshold: 21.00 MB
Current GC threshold: 21.00 MB
CDS: off
MetaspaceReclaimPolicy: balanced
- commit_granule_bytes: 65536.
- commit_granule_words: 8192.
- virtual_space_node_default_size: 8388608.
- enlarge_chunks_in_place: 1.
- new_chunks_are_fully_committed: 0.
- uncommit_free_chunks: 1.
- use_allocation_guard: 0.
- handle_deallocations: 1.
Internal statistics:
num_allocs_failed_limit: 0.
num_arena_births: 54.
num_arena_deaths: 0.
num_vsnodes_births: 2.
num_vsnodes_deaths: 0.
num_space_committed: 211.
num_space_uncommitted: 0.
num_chunks_returned_to_freelist: 0.
num_chunks_taken_from_freelist: 193.
num_chunk_merges: 0.
num_chunk_splits: 136.
num_chunks_enlarged: 114.
num_inconsistent_stats: 0.
CodeHeap 'non-profiled nmethods': size=120000Kb used=550Kb max_used=550Kb free=119450Kb
bounds [0x000001efcd200000, 0x000001efcd470000, 0x000001efd4730000]
CodeHeap 'profiled nmethods': size=120000Kb used=2474Kb max_used=2474Kb free=117525Kb
bounds [0x000001efc5730000, 0x000001efc59a0000, 0x000001efccc60000]
CodeHeap 'non-nmethods': size=5760Kb used=1154Kb max_used=1171Kb free=4605Kb
bounds [0x000001efccc60000, 0x000001efcced0000, 0x000001efcd200000]
total_blobs=1858 nmethods=1410 adapters=363
compilation: enabled
stopped_count=0, restarted_count=0
full_count=0
Compilation events (20 events):
Event: 3.658 Thread 0x000001efdb867010 1338 3 jdk.internal.loader.Resource::<init> (5 bytes)
Event: 3.658 Thread 0x000001efdb867010 nmethod 1338 0x000001efc5970a10 code [0x000001efc5970ba0, 0x000001efc5970cf8]
Event: 3.662 Thread 0x000001efdb867010 1340 3 java.util.jar.JarFile::getManifest (5 bytes)
Event: 3.663 Thread 0x000001efdb867010 nmethod 1340 0x000001efc5970d90 code [0x000001efc5970f20, 0x000001efc5971068]
Event: 3.663 Thread 0x000001efdb867010 1342 s 3 java.util.Hashtable::remove (133 bytes)
Event: 3.663 Thread 0x000001efdb867010 nmethod 1342 0x000001efc5971110 code [0x000001efc5971300, 0x000001efc5971a18]
Event: 3.663 Thread 0x000001efdb867010 1343 3 jdk.internal.loader.URLClassPath::getResource (74 bytes)
Event: 3.664 Thread 0x000001efdb867010 nmethod 1343 0x000001efc5971c90 code [0x000001efc5971e60, 0x000001efc59721b8]
Event: 3.664 Thread 0x000001efdb867010 1341 3 java.lang.String::getBytes (25 bytes)
Event: 3.664 Thread 0x000001efdb867010 nmethod 1341 0x000001efc5972310 code [0x000001efc59724e0, 0x000001efc5972798]
Event: 3.664 Thread 0x000001efdb867010 1344 3 java.lang.ClassLoader::getParent (32 bytes)
Event: 3.665 Thread 0x000001efdb867010 nmethod 1344 0x000001efc5972890 code [0x000001efc5972ac0, 0x000001efc5973438]
Event: 3.665 Thread 0x000001efdb867010 1347 3 java.util.Base64$Decoder::decodeBlock (186 bytes)
Event: 3.665 Thread 0x000001efdb867010 nmethod 1347 0x000001efc5973790 code [0x000001efc5973960, 0x000001efc5973dd8]
Event: 3.665 Thread 0x000001efdb867010 1348 3 java.util.zip.ZipFile$ZipFileInputStream::initDataOffset (117 bytes)
Event: 3.666 Thread 0x000001efdb867010 nmethod 1348 0x000001efc5974090 code [0x000001efc59742c0, 0x000001efc5974ac8]
Event: 3.666 Thread 0x000001efdb867010 1345 3 sun.security.util.ManifestEntryVerifier::<init> (65 bytes)
Event: 3.666 Thread 0x000001efdb867010 nmethod 1345 0x000001efc5974e10 code [0x000001efc5975040, 0x000001efc5975768]
Event: 3.666 Thread 0x000001efdb867010 1346 3 java.security.MessageDigest::reset (10 bytes)
Event: 3.666 Thread 0x000001efdb867010 nmethod 1346 0x000001efc5975a10 code [0x000001efc5975bc0, 0x000001efc5975e88]
GC Heap History (2 events):
Event: 2.192 GC heap before
{Heap before GC invocations=1 (full 0):
PSYoungGen total 29696K, used 25600K [0x00000000eab00000, 0x00000000ecc00000, 0x0000000100000000)
eden space 25600K, 100% used [0x00000000eab00000,0x00000000ec400000,0x00000000ec400000)
from space 4096K, 0% used [0x00000000ec800000,0x00000000ec800000,0x00000000ecc00000)
to space 4096K, 0% used [0x00000000ec400000,0x00000000ec400000,0x00000000ec800000)
ParOldGen total 68608K, used 0K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
object space 68608K, 0% used [0x00000000c0000000,0x00000000c0000000,0x00000000c4300000)
Metaspace used 10905K, committed 11072K, reserved 1114112K
class space used 1083K, committed 1152K, reserved 1048576K
}
Event: 2.201 GC heap after
{Heap after GC invocations=1 (full 0):
PSYoungGen total 29696K, used 3286K [0x00000000eab00000, 0x00000000ecc00000, 0x0000000100000000)
eden space 25600K, 0% used [0x00000000eab00000,0x00000000eab00000,0x00000000ec400000)
from space 4096K, 80% used [0x00000000ec400000,0x00000000ec735980,0x00000000ec800000)
to space 4096K, 0% used [0x00000000ec800000,0x00000000ec800000,0x00000000ecc00000)
ParOldGen total 68608K, used 16K [0x00000000c0000000, 0x00000000c4300000, 0x00000000eab00000)
object space 68608K, 0% used [0x00000000c0000000,0x00000000c0004000,0x00000000c4300000)
Metaspace used 10905K, committed 11072K, reserved 1114112K
class space used 1083K, committed 1152K, reserved 1048576K
}
Dll operation events (8 events):
Event: 0.109 Loaded shared library c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\java.dll
Event: 0.465 Loaded shared library c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\zip.dll
Event: 0.478 Loaded shared library C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\instrument.dll
Event: 0.506 Loaded shared library C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\net.dll
Event: 0.535 Loaded shared library C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\nio.dll
Event: 0.552 Loaded shared library C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\zip.dll
Event: 0.581 Loaded shared library C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\jimage.dll
Event: 0.729 Loaded shared library c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\verify.dll
Deoptimization events (20 events):
Event: 2.609 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efcd23a48c sp=0x000000c6593f84e0
Event: 2.609 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb66a3 sp=0x000000c6593f84a0 mode 2
Event: 2.609 Thread 0x000001efc2ac4f20 Uncommon trap: trap_request=0xffffff45 fr.pc=0x000001efcd234414 relative=0x0000000000000074
Event: 2.609 Thread 0x000001efc2ac4f20 Uncommon trap: reason=unstable_if action=reinterpret pc=0x000001efcd234414 method=lombok.patcher.scripts.MethodLevelPatchScript.patch(Ljava/lang/String;[BLlombok/patcher/TransplantMapper;)[B @ 8 c2
Event: 2.609 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efcd234414 sp=0x000000c6593f8550
Event: 2.609 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb66a3 sp=0x000000c6593f84e0 mode 2
Event: 2.615 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efc57a47a1 sp=0x000000c6593f79c0
Event: 2.615 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb6e43 sp=0x000000c6593f6e70 mode 0
Event: 2.647 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efc57a47a1 sp=0x000000c6593f3dd0
Event: 2.647 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb6e43 sp=0x000000c6593f3280 mode 0
Event: 2.658 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efc57a47a1 sp=0x000000c6593f3dd0
Event: 2.658 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb6e43 sp=0x000000c6593f3280 mode 0
Event: 2.743 Thread 0x000001efc2ac4f20 Uncommon trap: trap_request=0xffffffc6 fr.pc=0x000001efcd23249c relative=0x000000000000027c
Event: 2.743 Thread 0x000001efc2ac4f20 Uncommon trap: reason=bimorphic_or_optimized_type_check action=maybe_recompile pc=0x000001efcd23249c method=java.util.Collections$UnmodifiableCollection$1.next()Ljava/lang/Object; @ 4 c2
Event: 2.743 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efcd23249c sp=0x000000c6593f7fa0
Event: 2.743 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb66a3 sp=0x000000c6593f7f50 mode 2
Event: 2.743 Thread 0x000001efc2ac4f20 Uncommon trap: trap_request=0xffffffc6 fr.pc=0x000001efcd23249c relative=0x000000000000027c
Event: 2.743 Thread 0x000001efc2ac4f20 Uncommon trap: reason=bimorphic_or_optimized_type_check action=maybe_recompile pc=0x000001efcd23249c method=java.util.Collections$UnmodifiableCollection$1.next()Ljava/lang/Object; @ 4 c2
Event: 2.743 Thread 0x000001efc2ac4f20 DEOPT PACKING pc=0x000001efcd23249c sp=0x000000c6593f7fa0
Event: 2.743 Thread 0x000001efc2ac4f20 DEOPT UNPACKING pc=0x000001efcccb66a3 sp=0x000000c6593f7f50 mode 2
Classes loaded (20 events):
Event: 2.891 Loading class java/security/SignatureException done
Event: 2.891 Loading class java/security/cert/CertificateException
Event: 2.891 Loading class java/security/cert/CertificateException done
Event: 2.891 Loading class java/security/NoSuchAlgorithmException
Event: 2.891 Loading class java/security/NoSuchAlgorithmException done
Event: 2.892 Loading class java/security/NoSuchProviderException
Event: 2.892 Loading class java/security/NoSuchProviderException done
Event: 2.919 Loading class java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet
Event: 2.921 Loading class java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet done
Event: 2.921 Loading class java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet$1
Event: 2.922 Loading class java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet$1 done
Event: 2.922 Loading class java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry
Event: 2.922 Loading class java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry done
Event: 2.972 Loading class java/lang/reflect/TypeVariable
Event: 2.978 Loading class java/lang/reflect/TypeVariable done
Event: 2.979 Loading class java/lang/reflect/AnnotatedType
Event: 2.985 Loading class java/lang/reflect/AnnotatedType done
Event: 2.991 Loading class java/util/ArrayList$SubList$1
Event: 2.995 Loading class java/util/ArrayList$SubList$1 done
Event: 3.666 Loading class java/util/concurrent/Executors
Classes unloaded (0 events):
No events
Classes redefined (0 events):
No events
Internal exceptions (20 events):
Event: 1.385 Thread 0x000001efc2ac4f20 Exception <a 'java/io/FileNotFoundException'{0x00000000eb8c0d70}> (0x00000000eb8c0d70)
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
Event: 1.389 Thread 0x000001efc2ac4f20 Exception <a 'java/io/FileNotFoundException'{0x00000000eb8c1d30}> (0x00000000eb8c1d30)
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
Event: 1.391 Thread 0x000001efc2ac4f20 Exception <a 'java/io/FileNotFoundException'{0x00000000eb8c2ce8}> (0x00000000eb8c2ce8)
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
Event: 1.392 Thread 0x000001efc2ac4f20 Exception <a 'java/io/FileNotFoundException'{0x00000000eb8c3c70}> (0x00000000eb8c3c70)
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
Event: 1.430 Thread 0x000001efc2ac4f20 Exception <a 'java/io/FileNotFoundException'{0x00000000eb8fcd20}> (0x00000000eb8fcd20)
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
Event: 2.060 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/ClassNotFoundException'{0x00000000ec13c738}: sun/net/www/protocol/c/Handler> (0x00000000ec13c738)
thrown [s\src\hotspot\share\classfile\systemDictionary.cpp, line 256]
Event: 2.061 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/ClassNotFoundException'{0x00000000ec13da50}: sun/net/www/protocol/d/Handler> (0x00000000ec13da50)
thrown [s\src\hotspot\share\classfile\systemDictionary.cpp, line 256]
Event: 2.063 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/ClassNotFoundException'{0x00000000ec13eb80}: sun/net/www/protocol/c/Handler> (0x00000000ec13eb80)
thrown [s\src\hotspot\share\classfile\systemDictionary.cpp, line 256]
Event: 2.090 Thread 0x000001efc2ac4f20 Exception <a 'java/io/FileNotFoundException'{0x00000000ec167848}> (0x00000000ec167848)
thrown [s\src\hotspot\share\prims\jni.cpp, line 516]
Event: 2.131 Thread 0x000001efc2ac4f20 Implicit null exception at 0x000001efcd25727b to 0x000001efcd257c00
Event: 2.131 Thread 0x000001efc2ac4f20 Implicit null exception at 0x000001efcd258bec to 0x000001efcd258dc8
Event: 2.131 Thread 0x000001efc2ac4f20 Implicit null exception at 0x000001efcd24650c to 0x000001efcd24671c
Event: 2.131 Thread 0x000001efc2ac4f20 Implicit null exception at 0x000001efcd244b0f to 0x000001efcd244b85
Event: 2.219 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/NoSuchMethodError'{0x00000000eab43498}: 'int java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)'> (0x00000000eab43498)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
Event: 2.222 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/NoSuchMethodError'{0x00000000eab4dc00}: 'java.lang.Object java.lang.invoke.DirectMethodHandle$Holder.invokeInterface(java.lang.Object, java.lang.Object)'> (0x00000000eab4dc00)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
Event: 2.223 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/IncompatibleClassChangeError'{0x00000000eab513f8}: Found class java.lang.Object, but interface was expected> (0x00000000eab513f8)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 826]
Event: 2.225 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/NoSuchMethodError'{0x00000000eab558d8}: 'void java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(java.lang.Object, java.lang.Object)'> (0x00000000eab558d8)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
Event: 2.226 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/NoSuchMethodError'{0x00000000eab590d8}: 'void java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object)'> (0x00000000eab590d8)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
Event: 2.227 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/NoSuchMethodError'{0x00000000eab60638}: 'int java.lang.invoke.DirectMethodHandle$Holder.invokeStaticInit(java.lang.Object, java.lang.Object)'> (0x00000000eab60638)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
Event: 2.499 Thread 0x000001efc2ac4f20 Exception <a 'java/lang/NoSuchMethodError'{0x00000000eacecbb8}: 'void java.lang.invoke.DirectMethodHandle$Holder.invokeSpecial(java.lang.Object, java.lang.Object, java.lang.Object)'> (0x00000000eacecbb8)
thrown [s\src\hotspot\share\interpreter\linkResolver.cpp, line 759]
VM Operations (16 events):
Event: 0.441 Executing VM operation: HandshakeAllThreads
Event: 0.441 Executing VM operation: HandshakeAllThreads done
Event: 0.604 Executing VM operation: HandshakeAllThreads
Event: 0.604 Executing VM operation: HandshakeAllThreads done
Event: 1.257 Executing VM operation: HandshakeAllThreads
Event: 1.257 Executing VM operation: HandshakeAllThreads done
Event: 1.257 Executing VM operation: Cleanup
Event: 1.257 Executing VM operation: Cleanup done
Event: 1.303 Executing VM operation: HandshakeAllThreads
Event: 1.303 Executing VM operation: HandshakeAllThreads done
Event: 2.034 Executing VM operation: HandshakeAllThreads
Event: 2.034 Executing VM operation: HandshakeAllThreads done
Event: 2.192 Executing VM operation: ParallelGCFailedAllocation
Event: 2.201 Executing VM operation: ParallelGCFailedAllocation done
Event: 3.216 Executing VM operation: Cleanup
Event: 3.216 Executing VM operation: Cleanup done
Memory protections (0 events):
No events
Nmethod flushes (0 events):
No events
Events (12 events):
Event: 0.181 Thread 0x000001efc2ac4f20 Thread added: 0x000001efc2ac4f20
Event: 0.199 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb819d00
Event: 0.200 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb81ad10
Event: 0.299 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb856550
Event: 0.299 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb8572e0
Event: 0.299 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb85a820
Event: 0.300 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb85cc00
Event: 0.300 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb863e50
Event: 0.300 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb867010
Event: 0.300 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdb867920
Event: 0.390 Thread 0x000001efc2ac4f20 Thread added: 0x000001efc2b27620
Event: 1.022 Thread 0x000001efc2ac4f20 Thread added: 0x000001efdba7cdf0
Dynamic libraries:
0x00007ff7404f0000 - 0x00007ff7404fe000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\java.exe
0x00007fff4ccb0000 - 0x00007fff4cec7000 C:\Windows\SYSTEM32\ntdll.dll
0x00007fff4c090000 - 0x00007fff4c154000 C:\Windows\System32\KERNEL32.DLL
0x00007fff4a3b0000 - 0x00007fff4a76a000 C:\Windows\System32\KERNELBASE.dll
0x00007fff4a770000 - 0x00007fff4a881000 C:\Windows\System32\ucrtbase.dll
0x00007fff30200000 - 0x00007fff30217000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\jli.dll
0x00007fff4c1f0000 - 0x00007fff4c39e000 C:\Windows\System32\USER32.dll
0x00007fff4a890000 - 0x00007fff4a8b6000 C:\Windows\System32\win32u.dll
0x00007fff4c160000 - 0x00007fff4c189000 C:\Windows\System32\GDI32.dll
0x00007fff4a000000 - 0x00007fff4a11b000 C:\Windows\System32\gdi32full.dll
0x00007fff4a310000 - 0x00007fff4a3aa000 C:\Windows\System32\msvcp_win.dll
0x00007fff30070000 - 0x00007fff3008e000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\VCRUNTIME140.dll
0x00007fff31cb0000 - 0x00007fff31f42000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.4541_none_2710d1c57384c085\COMCTL32.dll
0x00007fff4bb50000 - 0x00007fff4bbf7000 C:\Windows\System32\msvcrt.dll
0x00007fff4cc20000 - 0x00007fff4cc51000 C:\Windows\System32\IMM32.DLL
0x00007ffed32c0000 - 0x00007ffed375a000 C:\Windows\SysWOW64\5097\DseFileSystemExt64.dll
0x00007fff4ae60000 - 0x00007fff4af12000 C:\Windows\System32\ADVAPI32.dll
0x00007fff4ba20000 - 0x00007fff4bac7000 C:\Windows\System32\sechost.dll
0x00007fff4a8c0000 - 0x00007fff4a8e8000 C:\Windows\System32\bcrypt.dll
0x00007fff4af20000 - 0x00007fff4b034000 C:\Windows\System32\RPCRT4.dll
0x00007fff4bad0000 - 0x00007fff4bb41000 C:\Windows\System32\WS2_32.dll
0x00007fff4a1a0000 - 0x00007fff4a306000 C:\Windows\System32\CRYPT32.dll
0x00007fff231e0000 - 0x00007fff23287000 C:\Windows\SYSTEM32\WINSPOOL.DRV
0x00007fff4aad0000 - 0x00007fff4ae5f000 C:\Windows\System32\combase.dll
0x00007fff4a9b0000 - 0x00007fff4aaaa000 C:\Windows\System32\shcore.dll
0x00007fff490d0000 - 0x00007fff49104000 C:\Windows\SYSTEM32\ntmarta.dll
0x00007fff3c500000 - 0x00007fff3c50c000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\vcruntime140_1.dll
0x00007fff2d1e0000 - 0x00007fff2d26d000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\msvcp140.dll
0x00007ffed90c0000 - 0x00007ffed9d2b000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\server\jvm.dll
0x00007fff49e50000 - 0x00007fff49e9d000 C:\Windows\SYSTEM32\POWRPROF.dll
0x00007fff3c4a0000 - 0x00007fff3c4d4000 C:\Windows\SYSTEM32\WINMM.dll
0x00007fff3bae0000 - 0x00007fff3baea000 C:\Windows\SYSTEM32\VERSION.dll
0x00007fff49e30000 - 0x00007fff49e43000 C:\Windows\SYSTEM32\UMPDC.dll
0x00007fff48fc0000 - 0x00007fff48fd8000 C:\Windows\SYSTEM32\kernel.appcore.dll
0x00007fff37bf0000 - 0x00007fff37bfa000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\jimage.dll
0x00007fff478a0000 - 0x00007fff47ad2000 C:\Windows\SYSTEM32\DBGHELP.DLL
0x00007fff4b7d0000 - 0x00007fff4b8a7000 C:\Windows\System32\OLEAUT32.dll
0x00007fff27db0000 - 0x00007fff27de2000 C:\Windows\SYSTEM32\dbgcore.DLL
0x00007fff4a120000 - 0x00007fff4a19b000 C:\Windows\System32\bcryptPrimitives.dll
0x00007fff37820000 - 0x00007fff3782e000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\instrument.dll
0x00007fff2d0c0000 - 0x00007fff2d0e5000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\java.dll
0x00007fff2d1c0000 - 0x00007fff2d1d8000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\zip.dll
0x000001efdd0b0000 - 0x000001efdd928000 C:\Windows\System32\SHELL32.dll
0x00007fff47ec0000 - 0x00007fff487c8000 C:\Windows\SYSTEM32\windows.storage.dll
0x00007fff47d80000 - 0x00007fff47ebf000 C:\Windows\SYSTEM32\wintypes.dll
0x00007fff4bc00000 - 0x00007fff4bc5e000 C:\Windows\System32\shlwapi.dll
0x00007fff49eb0000 - 0x00007fff49edb000 C:\Windows\SYSTEM32\profapi.dll
0x00007fff2d1a0000 - 0x00007fff2d1b9000 C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\net.dll
0x00007fff3fd60000 - 0x00007fff3fe96000 C:\Windows\SYSTEM32\WINHTTP.dll
0x00007fff49440000 - 0x00007fff494a9000 C:\Windows\system32\mswsock.dll
0x00007fff2d0a0000 - 0x00007fff2d0b6000 C:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\nio.dll
0x00007fff31a30000 - 0x00007fff31a40000 c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\verify.dll
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.4541_none_2710d1c57384c085;C:\Windows\SysWOW64\5097;c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\jre\17.0.13-win32-x86_64\bin\server
VM Arguments:
jvm_args: --add-modules=ALL-SYSTEM --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Djava.import.generatesMetadataFilesAtProjectRoot=false -DDetectVMInstallationsJob.disabled=true -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable -javaagent:c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\lombok\lombok-1.18.34.jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=c:\Users\28454\AppData\Roaming\Code\User\workspaceStorage\b58f7291be61a3d0acd7d49de26e9001\redhat.java -Daether.dependencyCollector.impl=bf
java_command: c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\server\plugins\org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar -configuration c:\Users\28454\AppData\Roaming\Code\User\globalStorage\redhat.java\1.38.0\config_win -data c:\Users\28454\AppData\Roaming\Code\User\workspaceStorage\b58f7291be61a3d0acd7d49de26e9001\redhat.java\jdt_ws --pipe=\\.\pipe\lsp-26311645a2c3d8793ed79a5223161af5-sock
java_class_path (initial): c:\Users\28454\.vscode\extensions\redhat.java-1.38.0-win32-x64\server\plugins\org.eclipse.equinox.launcher_1.6.900.v20240613-2009.jar
Launcher Type: SUN_STANDARD
[Global flags]
uintx AdaptiveSizePolicyWeight = 90 {product} {command line}
intx CICompilerCount = 4 {product} {ergonomic}
uintx GCTimeRatio = 4 {product} {command line}
bool HeapDumpOnOutOfMemoryError = true {manageable} {command line}
ccstr HeapDumpPath = c:\Users\28454\AppData\Roaming\Code\User\workspaceStorage\b58f7291be61a3d0acd7d49de26e9001\redhat.java {manageable} {command line}
size_t InitialHeapSize = 104857600 {product} {command line}
size_t MaxHeapSize = 1073741824 {product} {command line}
size_t MaxNewSize = 357564416 {product} {ergonomic}
size_t MinHeapDeltaBytes = 524288 {product} {ergonomic}
size_t MinHeapSize = 104857600 {product} {command line}
size_t NewSize = 34603008 {product} {ergonomic}
uintx NonNMethodCodeHeapSize = 5839372 {pd product} {ergonomic}
uintx NonProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
size_t OldSize = 70254592 {product} {ergonomic}
uintx ProfiledCodeHeapSize = 122909434 {pd product} {ergonomic}
uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic}
bool SegmentedCodeCache = true {product} {ergonomic}
size_t SoftMaxHeapSize = 1073741824 {manageable} {ergonomic}
bool UseCompressedClassPointers = true {product lp64_product} {ergonomic}
bool UseCompressedOops = true {product lp64_product} {ergonomic}
bool UseLargePagesIndividualAllocation = false {pd product} {ergonomic}
bool UseParallelGC = true {product} {command line}
Logging:
Log output configuration:
#0: stdout all=off uptime,level,tags
#1: stderr all=off uptime,level,tags
Environment Variables:
JAVA_HOME=D:\tool\java
CLASSPATH=.;D:\tool\java\lib\dt.jar;D:\tool\java\lib\tools.jar
PATH=C:\Program Files\Common Files\Oracle\Java\javapath;D:\tool\vmware\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Windows\SysWOW64\5097;C:\Windows\SysWOW64\5097;C:\Windows\SysWOW64;D:\tool\java\bin;D:\tool\java\jre\bin;C:\Program Files\Git\cmd;D:\tool\3ba4a-main\3ba4a-main\gradle-7.2-all\gradle-7.2\bin;D:\tool\3ba4a-main\3ba4a-main\gradle-7.2-all\repository;C:\platform-tools;C:\Users\28454\AppData\Local\Microsoft\WindowsApps;C:\Users\28454\AppData\Local\Programs\Microsoft VS Code\bin;D:\tool\3ba4a-main\3ba4a-main\gradle-7.2-all\gradle-7.2\bin;
USERNAME=28454
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 186 Stepping 2, GenuineIntel
TMP=C:\Users\28454\AppData\Local\Temp
TEMP=C:\Users\28454\AppData\Local\Temp
Periodic native trim disabled
--------------- S Y S T E M ---------------
OS:
Windows 11 , 64 bit Build 22621 (10.0.22621.4391)
OS uptime: 0 days 1:30 hours
CPU: total 12 (initial active 12) (6 cores per cpu, 2 threads per core) family 6 model 186 stepping 2 microcode 0x4112, cx8, cmov, fxsr, ht, mmx, 3dnowpref, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, lzcnt, tsc, tscinvbit, avx, avx2, aes, erms, clmul, bmi1, bmi2, adx, sha, fma, vzeroupper, clflush, clflushopt, clwb
Processor Information for processor 0
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 1
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 2
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 3
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 4
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 5
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 6
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 7
Max Mhz: 2100, Current Mhz: 2100, Mhz Limit: 2100
Processor Information for processor 8
Max Mhz: 2100, Current Mhz: 1500, Mhz Limit: 1491
Processor Information for processor 9
Max Mhz: 2100, Current Mhz: 1500, Mhz Limit: 1491
Processor Information for processor 10
Max Mhz: 2100, Current Mhz: 1500, Mhz Limit: 1491
Processor Information for processor 11
Max Mhz: 2100, Current Mhz: 1500, Mhz Limit: 1491
Memory: 4k page, system-wide physical 16107M (7M free)
TotalPageFile size 30623M (AvailPageFile size 2M)
current process WorkingSet (physical memory assigned to process): 39M, peak: 56M
current process commit charge ("private bytes"): 209M, peak: 209M
vm_info: OpenJDK 64-Bit Server VM (17.0.13+11) for windows-amd64 JRE (17.0.13+11), built on Oct 16 2024 00:10:08 by "admin" with MS VC++ 17.7 (VS2022)
END.

@ -1,3 +1,5 @@
host=http://47.122.20.47:8080
host=http://47.122.76.133:8080
#host=http://47.122.76.133:9000
#host=http://47.122.20.47:8080
#host=http://192.168.1.102:8080
#host=http://192.168.51.123:8080

@ -78,7 +78,7 @@ object RequestManager {
.client(builder.build())
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.baseUrl("http://47.122.20.47:8080")
.baseUrl("http://47.122.76.133:8080/")
.build()
}

@ -38,7 +38,7 @@ val Int.dp: Float
get() = this.toFloat().dp
val decimalFormat = DecimalFormat("#0.00")
val decimalFormat = DecimalFormat("#0.0")
fun Float.forShowValue(): Float {
return this.forShowStr().toFloat()
}

@ -1,6 +1,7 @@
package org.easydarwin
import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Color
import android.util.Log
import com.common.commonlib.db.entity.Gas
@ -11,6 +12,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.easydarwin.util.YUVUtils
import org.easydarwin.util.YUVUtils.generateBitmap
import java.text.SimpleDateFormat
import java.util.concurrent.ConcurrentHashMap
@ -22,7 +24,8 @@ object TxtOverlay {
private var mTipChangeListener: (() -> Unit)? = null;
private const val bmpWidth: Int = 600
private const val bmpHeight: Int = 330
//private const val bmpHeight: Int = 330
private const val bmpHeight: Int = 500
// 文字生成的bitmap
private var bmp: Bitmap? = Bitmap.createBitmap(bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
@ -39,7 +42,7 @@ object TxtOverlay {
YUVUtils.generateBitmap(
bmp,
"$timeFormat@$tipStr",
42,
50,
Color.WHITE
)
yuv = YUVUtils.getYUVByBitmap(bmp)
@ -64,7 +67,7 @@ object TxtOverlay {
private val gasMap = ConcurrentHashMap<String, Gas>()
// 外部调用,设置待显示水印文字
fun startShow(gas: Gas?) {
/*fun startShow(gas: Gas?) {
gas?.let {
gasMap[it.gasName] = it
}
@ -74,25 +77,71 @@ object TxtOverlay {
while (true) {
val currentTimeMillis = System.currentTimeMillis()
overlayBuilder.clear()
// Log.i("cyy", "gasMap size = ${gasMap.size}")
Log.i("cyy", "gasMap size = ${gasMap.size}")
gasMap.forEach { item ->
val gas = item.value
// 3S内的数据我们认为有效
// Log.i("cyy", "gasTime = ${dateFormat.format(gas.time)}")
Log.i("cyy", "gasTime = ${dateFormat.format(gas.time)}")
if (currentTimeMillis - gas.time <= 3000) {
overlayBuilder.append("${gas.gasName.getGasShowName()}: ${gas.gasValue.forShowStr()} ${gas.unit}")
.append("@")
}
}
val tipStr = overlayBuilder.toString()
// Log.i(
// "cyy",
// "time = ${dateFormat.format(currentTimeMillis)} mToDoShowTip = $tipStr"
// )
Log.i(
"cyy",
"time = ${dateFormat.format(currentTimeMillis)} mToDoShowTip = $tipStr"
)
buildOverlayBitmap(currentTimeMillis, tipStr)
delay(1000)
}
}
}
}*/
fun startShow(gas: Gas?) {
gas?.let {
gasMap[it.gasName] = it
}
if (!looping) {
looping = true
GlobalScope.launch(Dispatchers.IO) {
while (true) {
val currentTimeMillis = System.currentTimeMillis()
overlayBuilder.clear()
Log.i("cyy", "gasMap size = ${gasMap.size}")
gasMap.forEach { item ->
val gas = item.value
// 3S内的数据我们认为有效
Log.i("cyy", "gasTime = ${dateFormat.format(gas.time)}")
if (currentTimeMillis - gas.time <= 3000) {
val gasName = gas.gasName.getGasShowName()
val gasValue = gas.gasValue.forShowStr()
val unit = gas.unit
// 在 CO 和 O2 后面加上空格
val formattedGasName = if (gasName == "CO") {
"$gasName "
}else if(gasName == "O2"){
"$gasName "
}else if(gasName == "H2S"){
"$gasName "
}else {
gasName
}
overlayBuilder.append("$formattedGasName: $gasValue $unit")
.append("@")
}
}
val tipStr = overlayBuilder.toString()
Log.i(
"cyy",
"time = ${dateFormat.format(currentTimeMillis)} mToDoShowTip = $tipStr"
)
buildOverlayBitmap(currentTimeMillis, tipStr)
delay(1000)
}
}
}
}
}

@ -6,7 +6,13 @@ import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.text.TextPaint;
import android.util.Pair;
import java.util.Arrays;
import java.util.List;
public class YUVUtils {
//缩小图片到制定长宽

@ -4,17 +4,31 @@ import android.content.Context;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.common.commonlib.db.DBUtils;
import com.common.commonlib.db.entity.Video;
import com.yinuo.library.vlc.encoder.AndroidMuxer;
import org.easydarwin.PushHelper;
import org.easydarwin.muxer.EasyMuxer;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;
import java.util.Locale;
import android.content.Context;
import android.os.storage.StorageManager;
import android.util.Log;
import java.io.File;
import java.lang.reflect.Method;
/**
* Created by apple on 2017/5/13.
@ -22,6 +36,7 @@ import java.nio.ByteBuffer;
public class HWConsumer extends Thread implements VideoConsumer {
private static final String TAG = "HWConsumer";
private static final String MIME_TYPE = "video/hevc";
private static final long DEFAULT_RECORD_DURATION = 5 * 60 * 1000;;
private int mHeight;
private int mWidth;
private MediaCodec mMediaCodec;
@ -32,8 +47,12 @@ public class HWConsumer extends Thread implements VideoConsumer {
private AndroidMuxer androidMuxer;
private int mTrackIndex = -1;
private long mStartRecordTime = 0L;
private String mCurrentPath;
private Context context;
public HWConsumer() {
public HWConsumer(Context context) {
this.context = context;
}
@Override
@ -53,6 +72,62 @@ public class HWConsumer extends Thread implements VideoConsumer {
mVideoStarted = true;
}
/*private String getUsbStoragePath() {
String[] paths = new String[]{"/storage/78C8ED8FC8ED4BC6", "/storage/usb1"};
for (String path : paths) {
File file = new File(path);
if (file.exists() && file.isDirectory()) {
return path;
}
}
return null;
}*/
public void onUSBStart(String usbPath) {
Log.i("cyy", "usbPath = " + usbPath);
if (usbPath == null) {
//Toast.makeText(this, "USB设备未连接或不可用", Toast.LENGTH_SHORT).show();
return;
}
long time = System.currentTimeMillis();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA);
String timeStamp = format.format(time);
String endTimeStamp = format.format(time + DEFAULT_RECORD_DURATION);
File usbStoragePath = new File(usbPath, "video");
if (!usbStoragePath.exists()) {
usbStoragePath.mkdirs();
}
File videoFile = new File(usbStoragePath, "VID_" + timeStamp + "_" + endTimeStamp + ".mp4");
mCurrentPath = videoFile.getAbsolutePath();
Log.d("mCurrentPathusbis",mCurrentPath);
MediaRecorder mediaRecorder = new MediaRecorder();
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mediaRecorder.setOutputFile(videoFile.getAbsolutePath());
if (mStartRecordTime <= 0L) {
mStartRecordTime = System.currentTimeMillis();
}else{
long recordTime = System.currentTimeMillis() - mStartRecordTime;
if (recordTime > DEFAULT_RECORD_DURATION){
mStartRecordTime = 0L;
}
}
try {
mediaRecorder.prepare();
mediaRecorder.start();
//Toast.makeText(this, "正在录制视频...", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
//Toast.makeText(this, "录制失败:" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
// final int millisPerframe = 1000 / 17;
// long lastPush = 0;
@ -177,6 +252,28 @@ public class HWConsumer extends Thread implements VideoConsumer {
}
}
private void insertToDB(long timeMillis, String filePath) {
String[] splits = filePath.split("/");
Video cacheVideo = new Video(timeMillis, splits[splits.length - 1], false, filePath);
DBUtils.INSTANCE.insertCacheVideo(cacheVideo);
}
public void onUSBStop() {
do {
newFormat = null;
mVideoStarted = false;
try {
join();
} catch (InterruptedException e) {
e.printStackTrace();
}
} while (isAlive());
if (mStartRecordTime > 0 && mStartRecordTime < System.currentTimeMillis() && !TextUtils.isEmpty(mCurrentPath)) {
Log.d("mCurrentPathiss",mCurrentPath);
insertToDB(mStartRecordTime, mCurrentPath);
}
}
@Override
public synchronized void setMuxer(EasyMuxer muxer) {
}

@ -0,0 +1,28 @@
import android.content.Context;
import android.os.storage.StorageManager;
import android.util.Log;
import java.io.File;
import java.lang.reflect.Method;
public class USBStoragePathFinder {
public static String getUSBStoragePath(Context context) {
StorageManager storageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
try {
// 获取所有存储路径
Method getVolumePaths = storageManager.getClass().getMethod("getVolumePaths");
String[] paths = (String[]) getVolumePaths.invoke(storageManager);
for (String path : paths) {
File file = new File(path);
if (file.exists() && file.isDirectory() && path.contains("usb")) {
Log.d("USBStoragePath", "Found USB storage path: " + path);
return path;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save