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
{
$buffer = '';
$frames = preg_split('/\x02\d/', $raw); // STX + sequence number
$frames = [];
foreach ($frames as $frame) {
// buang ETX, checksum, EOT
$frame = preg_replace('/\x03.*$/s', '', $frame);
$frame = preg_replace('/\x04/', '', $frame);
// ambil semua frame
preg_match_all('/\x02(\d)(.*?)\x03(..)/s', $raw, $frames);
$buffer .= $frame;
foreach ($frames[2] as $content) {
// gabungkan isi frame (tanpa ETX & checksum)
$buffer .= $content;
}
return trim($buffer);
}
protected function processBDAstmResponse(string $raw, $data): bool
{
try {