fixed channel response; updated log RX

This commit is contained in:
Ben Menking
2026-05-29 15:17:31 -04:00
parent a36bf8e77d
commit dda593e617
3 changed files with 16 additions and 27 deletions
+8 -26
View File
@@ -289,24 +289,6 @@ class CoreParser {
return $data; return $data;
} }
/**
*
* @param string $payload
* @return ChannelResponse
*/
protected static function parseGetChannel(string $payload): ChannelResponse {
$detail = explode("\0", substr($payload, 2, 32));
$data = new ChannelResponse();
$data->code = ord($payload[0]);
$data->channel_idx = ord($payload[1]);
$data->detail = $detail;
$data->channel_secret = base64_encode(substr($payload, 34, 16));
return $data;
}
/** /**
* *
* @param string $payload * @param string $payload
@@ -419,15 +401,15 @@ class CoreParser {
return $info; return $info;
} }
public static function parseChannelInfoResponse(string $payload) { public static function parseChannelInfoResponse(string $payload): ChannelResponse {
$info = [ $m = new ChannelResponse();
'code'=>ord($payload[0]),
'channel_idx'=>ord($payload[1]),
'channel_name'=>self::readCstring(substr($payload, 2, 32)),
'channel_secret'=>substr($payload, 34, 16)
];
return $info; $m->code = ord($payload[0]);
$m->channel_idx = ord($payload[1]);
$m->channel_name = self::readCstring(substr($payload, 2, 32));
$m->channel_secret = substr($payload, 34, 16);
return $m;
} }
public static function parseMessage(string $payload) { public static function parseMessage(string $payload) {
+1 -1
View File
@@ -5,6 +5,6 @@ namespace Menking\Meshcore\Model;
class ChannelResponse extends Response { class ChannelResponse extends Response {
public int $code; public int $code;
public int $channel_idx; public int $channel_idx;
public array $detail; public string $channel_name;
public string $channel_secret; public string $channel_secret;
} }
+7
View File
@@ -7,4 +7,11 @@ class LogReceiveResponse extends Response {
public int $flags; public int $flags;
public int $snr; public int $snr;
public string $raw; public string $raw;
public int $header;
public int $transport_id;
public int $path_len;
public string $path;
public string $payload;
} }