commit 14/10/2025

combine with coding steph
This commit is contained in:
2025-10-14 08:50:05 +07:00
parent a133f9a170
commit 5f57e1bf2e
3 changed files with 31 additions and 4 deletions

View File

@@ -588,11 +588,12 @@ class MainExtension01 {
Logger.info { logmessage }
db.Add_Log("AAS", logmessage)
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
return true
} else {
// file tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log(
"AAS",
"Cancelled paging message with index ${qp.index} due to invalid audio file"
@@ -602,11 +603,13 @@ class MainExtension01 {
} else {
// ada broadcast zone yang tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", "Cancelled paging message with index ${qp.index} due to invalid broadcast zone")
}
} else {
// file tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log(
"AAS",
"Cancelled paging message with index ${qp.index} due to invalid audio file"
@@ -615,6 +618,7 @@ class MainExtension01 {
} else {
// invalid broadcast zone, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", "Cancelled paging message with index ${qp.index} due to empty broadcast zone")
}
}
@@ -688,6 +692,7 @@ class MainExtension01 {
Logger.info { logmsg }
db.Add_Log("AAS", logmsg)
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
return true
} else {
db.Add_Log(
@@ -698,6 +703,7 @@ class MainExtension01 {
}
} else{
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", result.message)
}
}
@@ -706,6 +712,7 @@ class MainExtension01 {
} else {
// tidak ada messagebank dengan ann_id ini, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log(
"AAS",
"Cancelled Shalat message with index ${qp.index} due to ANN_ID $ann_id not found in Messagebank"
@@ -716,16 +723,19 @@ class MainExtension01 {
} else {
// invalid ann_id, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to invalid ANN_ID")
}
} else {
// ada broadcast zone yang tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to invalid broadcast zone")
}
} else {
// invalid broadcast zone, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to empty broadcast zone")
}
}
@@ -789,14 +799,17 @@ class MainExtension01 {
Logger.info { logmsg }
db.Add_Log("AAS", logmsg)
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
return true
}
} else{
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", result.message)
}
} else {
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", result.message)
}
@@ -805,6 +818,7 @@ class MainExtension01 {
} else {
// tidak ada messagebank dengan ann_id ini, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log(
"AAS",
"Cancelled TIMER with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank"
@@ -815,16 +829,19 @@ class MainExtension01 {
} else {
// invalid ann_id, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to invalid ANN_ID")
}
} else {
// ada broadcast zone yang tidak valid, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to invalid broadcast zone")
}
} else {
// invalid broadcast zone, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to empty broadcast zone")
}
}
@@ -903,6 +920,7 @@ class MainExtension01 {
"Cancelled SOUNDBANK message with index ${qa.index} due to missing or invalid ANN_ID in SB_TAGS"
)
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
return@forEach
}
// sampe sini punya ann_id valid
@@ -930,12 +948,14 @@ class MainExtension01 {
} else {
db.Add_Log("AAS", result.message)
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
}
}
if (listafi.isNotEmpty()){
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
// bikin nama file ada postifx nya dari SB_TAGS, tapi spasi diganti underscore
// dan titik dua diganti dash
val postfix = qa.SB_TAGS.replace(" ","_").replace(":","-")
@@ -972,6 +992,7 @@ class MainExtension01 {
} else {
println("Failed to write WAV file: ${result.message}")
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", result.message)
}
@@ -979,6 +1000,7 @@ class MainExtension01 {
} else {
// tidak ada messagebank dengan ann_id ini, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log(
"AAS",
"Cancelled SOUNDBANK message with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank"
@@ -990,11 +1012,13 @@ class MainExtension01 {
} else {
// ada broadcast zone yang tidak valid, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", "Cancelled SOUNDBANK message with index ${qa.index} due to invalid broadcast zone")
}
} else {
// invalid broadcast zone, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", "Cancelled SOUNDBANK message with index ${qa.index} due to empty broadcast zone")
}
}

View File

@@ -111,13 +111,13 @@ class BarixConnection(val index: UInt, var channel: String, val ipaddress: Strin
try {
val chunk = ByteArray(if (bb.remaining() > maxUDPsize) maxUDPsize else bb.remaining())
bb.get(chunk)
println("Buffer remain: $bufferRemain, sending chunk size: ${chunk.size}")
//println("Buffer remain: $bufferRemain, sending chunk size: ${chunk.size}")
while(bufferRemain<chunk.size){
delay(10)
println("Waiting until buffer enough..")
//println("Waiting until buffer enough..")
}
udp.send(DatagramPacket(chunk, chunk.size, inet))
//delay(1)
delay(2)
} catch (e: Exception) {
cbFail.accept("SendData to $ipaddress:$port failed, message: ${e.message}")
return@launch

View File

@@ -220,6 +220,7 @@ class TCP_Android_Command_Server {
pj.broadcastzones
)
if (db.queuepagingDB.Add(qp)) {
db.queuepagingDB.Resort()
logcb.accept("Paging audio inserted to queue paging table from Android $key, file ${pj.filePath.absolutePathString()}")
cb.accept("PCMFILE_STOP;OK@")
return
@@ -274,6 +275,7 @@ class TCP_Android_Command_Server {
pj.broadcastzones
)
if (db.queuepagingDB.Add(qp)){
db.queuepagingDB.Resort()
logcb.accept("Paging audio inserted to queue paging table from IPM $key, file ${pj.filePath.absolutePathString()}")
cb.accept("STOPPAGINGAND;OK@")
return
@@ -627,6 +629,7 @@ class TCP_Android_Command_Server {
lang
)
if (db.queuetableDB.Add(qt)){
db.queuetableDB.Resort()
logcb.accept("Broadcast request from Android $key username=${listUserLogin.find { it.ip==key }?.username ?: "UNKNOWN"} inserted. Message: $desc;$lang;$tags;$zone")
cb.accept("BROADCASTAND;OK@")
return