push
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user