This commit is contained in:
Dwi Swandhana
2026-01-30 07:47:02 +07:00
parent 7e53d8e1da
commit 2752193752
+7 -6
View File
@@ -687,19 +687,20 @@ class AstmMessageService
protected function reassembleAstmFrames(string $raw): string protected function reassembleAstmFrames(string $raw): string
{ {
$buffer = ''; $buffer = '';
$frames = preg_split('/\x02\d/', $raw); // STX + sequence number $frames = [];
foreach ($frames as $frame) { // ambil semua frame
// buang ETX, checksum, EOT preg_match_all('/\x02(\d)(.*?)\x03(..)/s', $raw, $frames);
$frame = preg_replace('/\x03.*$/s', '', $frame);
$frame = preg_replace('/\x04/', '', $frame);
$buffer .= $frame; foreach ($frames[2] as $content) {
// gabungkan isi frame (tanpa ETX & checksum)
$buffer .= $content;
} }
return trim($buffer); return trim($buffer);
} }
protected function processBDAstmResponse(string $raw, $data): bool protected function processBDAstmResponse(string $raw, $data): bool
{ {
try { try {