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 } Logger.info { logmessage }
db.Add_Log("AAS", logmessage) db.Add_Log("AAS", logmessage)
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
return true return true
} else { } else {
// file tidak valid, delete from queue paging // file tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log( db.Add_Log(
"AAS", "AAS",
"Cancelled paging message with index ${qp.index} due to invalid audio file" "Cancelled paging message with index ${qp.index} due to invalid audio file"
@@ -602,11 +603,13 @@ class MainExtension01 {
} else { } else {
// ada broadcast zone yang tidak valid, delete from queue paging // ada broadcast zone yang tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) 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") db.Add_Log("AAS", "Cancelled paging message with index ${qp.index} due to invalid broadcast zone")
} }
} else { } else {
// file tidak valid, delete from queue paging // file tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log( db.Add_Log(
"AAS", "AAS",
"Cancelled paging message with index ${qp.index} due to invalid audio file" "Cancelled paging message with index ${qp.index} due to invalid audio file"
@@ -615,6 +618,7 @@ class MainExtension01 {
} else { } else {
// invalid broadcast zone, delete from queue paging // invalid broadcast zone, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) 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") 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 } Logger.info { logmsg }
db.Add_Log("AAS", logmsg) db.Add_Log("AAS", logmsg)
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
return true return true
} else { } else {
db.Add_Log( db.Add_Log(
@@ -698,6 +703,7 @@ class MainExtension01 {
} }
} else{ } else{
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log("AAS", result.message) db.Add_Log("AAS", result.message)
} }
} }
@@ -706,6 +712,7 @@ class MainExtension01 {
} else { } else {
// tidak ada messagebank dengan ann_id ini, delete from queue paging // tidak ada messagebank dengan ann_id ini, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) db.queuepagingDB.DeleteByIndex(qp.index.toInt())
db.queuepagingDB.Resort()
db.Add_Log( db.Add_Log(
"AAS", "AAS",
"Cancelled Shalat message with index ${qp.index} due to ANN_ID $ann_id not found in Messagebank" "Cancelled Shalat message with index ${qp.index} due to ANN_ID $ann_id not found in Messagebank"
@@ -716,16 +723,19 @@ class MainExtension01 {
} else { } else {
// invalid ann_id, delete from queue paging // invalid ann_id, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) 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") db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to invalid ANN_ID")
} }
} else { } else {
// ada broadcast zone yang tidak valid, delete from queue paging // ada broadcast zone yang tidak valid, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) 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") db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to invalid broadcast zone")
} }
} else { } else {
// invalid broadcast zone, delete from queue paging // invalid broadcast zone, delete from queue paging
db.queuepagingDB.DeleteByIndex(qp.index.toInt()) 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") 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 } Logger.info { logmsg }
db.Add_Log("AAS", logmsg) db.Add_Log("AAS", logmsg)
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
return true return true
} }
} else{ } else{
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", result.message) db.Add_Log("AAS", result.message)
} }
} else { } else {
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", result.message) db.Add_Log("AAS", result.message)
} }
@@ -805,6 +818,7 @@ class MainExtension01 {
} else { } else {
// tidak ada messagebank dengan ann_id ini, delete from queue table // tidak ada messagebank dengan ann_id ini, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log( db.Add_Log(
"AAS", "AAS",
"Cancelled TIMER with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank" "Cancelled TIMER with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank"
@@ -815,16 +829,19 @@ class MainExtension01 {
} else { } else {
// invalid ann_id, delete from queue table // invalid ann_id, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) 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") db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to invalid ANN_ID")
} }
} else { } else {
// ada broadcast zone yang tidak valid, delete from queue table // ada broadcast zone yang tidak valid, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) 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") db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to invalid broadcast zone")
} }
} else { } else {
// invalid broadcast zone, delete from queue table // invalid broadcast zone, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) 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") 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" "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.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
return@forEach return@forEach
} }
// sampe sini punya ann_id valid // sampe sini punya ann_id valid
@@ -930,12 +948,14 @@ class MainExtension01 {
} else { } else {
db.Add_Log("AAS", result.message) db.Add_Log("AAS", result.message)
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
} }
} }
if (listafi.isNotEmpty()){ if (listafi.isNotEmpty()){
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
// bikin nama file ada postifx nya dari SB_TAGS, tapi spasi diganti underscore // bikin nama file ada postifx nya dari SB_TAGS, tapi spasi diganti underscore
// dan titik dua diganti dash // dan titik dua diganti dash
val postfix = qa.SB_TAGS.replace(" ","_").replace(":","-") val postfix = qa.SB_TAGS.replace(" ","_").replace(":","-")
@@ -972,6 +992,7 @@ class MainExtension01 {
} else { } else {
println("Failed to write WAV file: ${result.message}") println("Failed to write WAV file: ${result.message}")
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log("AAS", result.message) db.Add_Log("AAS", result.message)
} }
@@ -979,6 +1000,7 @@ class MainExtension01 {
} else { } else {
// tidak ada messagebank dengan ann_id ini, delete from queue table // tidak ada messagebank dengan ann_id ini, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) db.queuetableDB.DeleteByIndex(qa.index.toInt())
db.queuetableDB.Resort()
db.Add_Log( db.Add_Log(
"AAS", "AAS",
"Cancelled SOUNDBANK message with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank" "Cancelled SOUNDBANK message with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank"
@@ -990,11 +1012,13 @@ class MainExtension01 {
} else { } else {
// ada broadcast zone yang tidak valid, delete from queue table // ada broadcast zone yang tidak valid, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) 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") db.Add_Log("AAS", "Cancelled SOUNDBANK message with index ${qa.index} due to invalid broadcast zone")
} }
} else { } else {
// invalid broadcast zone, delete from queue table // invalid broadcast zone, delete from queue table
db.queuetableDB.DeleteByIndex(qa.index.toInt()) 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") 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 { try {
val chunk = ByteArray(if (bb.remaining() > maxUDPsize) maxUDPsize else bb.remaining()) val chunk = ByteArray(if (bb.remaining() > maxUDPsize) maxUDPsize else bb.remaining())
bb.get(chunk) 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){ while(bufferRemain<chunk.size){
delay(10) delay(10)
println("Waiting until buffer enough..") //println("Waiting until buffer enough..")
} }
udp.send(DatagramPacket(chunk, chunk.size, inet)) udp.send(DatagramPacket(chunk, chunk.size, inet))
//delay(1) delay(2)
} catch (e: Exception) { } catch (e: Exception) {
cbFail.accept("SendData to $ipaddress:$port failed, message: ${e.message}") cbFail.accept("SendData to $ipaddress:$port failed, message: ${e.message}")
return@launch return@launch

View File

@@ -220,6 +220,7 @@ class TCP_Android_Command_Server {
pj.broadcastzones pj.broadcastzones
) )
if (db.queuepagingDB.Add(qp)) { if (db.queuepagingDB.Add(qp)) {
db.queuepagingDB.Resort()
logcb.accept("Paging audio inserted to queue paging table from Android $key, file ${pj.filePath.absolutePathString()}") logcb.accept("Paging audio inserted to queue paging table from Android $key, file ${pj.filePath.absolutePathString()}")
cb.accept("PCMFILE_STOP;OK@") cb.accept("PCMFILE_STOP;OK@")
return return
@@ -274,6 +275,7 @@ class TCP_Android_Command_Server {
pj.broadcastzones pj.broadcastzones
) )
if (db.queuepagingDB.Add(qp)){ if (db.queuepagingDB.Add(qp)){
db.queuepagingDB.Resort()
logcb.accept("Paging audio inserted to queue paging table from IPM $key, file ${pj.filePath.absolutePathString()}") logcb.accept("Paging audio inserted to queue paging table from IPM $key, file ${pj.filePath.absolutePathString()}")
cb.accept("STOPPAGINGAND;OK@") cb.accept("STOPPAGINGAND;OK@")
return return
@@ -627,6 +629,7 @@ class TCP_Android_Command_Server {
lang lang
) )
if (db.queuetableDB.Add(qt)){ 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") 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@") cb.accept("BROADCASTAND;OK@")
return return