fixed channel response; updated log RX
This commit is contained in:
+8
-26
@@ -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) {
|
||||||
|
|||||||
@@ -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,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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user