log rx work; added toArray() to model

This commit is contained in:
Ben Menking
2026-05-30 12:33:09 -04:00
parent 9f8f188177
commit 3ac38b7fb6
4 changed files with 31 additions and 5 deletions
+4 -4
View File
@@ -255,11 +255,11 @@ class CoreParser {
$data = new LogReceiveResponse(); $data = new LogReceiveResponse();
$data->code = ord($payload[0]); $data->code = ord($payload[0]);
//$data->snr = ord($payload[1]) / 4; $data->snr = ord($payload[1]) / 4;
//$data->rssi = (ord($payload[2]) >= 128) ? (ord($payload[2]) - 256): ord($payload[2]); $data->rssi = (ord($payload[2]) >= 128) ? (ord($payload[2]) - 256): ord($payload[2]);
$data->flags = ord($payload[1]); //$data->flags = ord($payload[1]);
$data->snr = ord($payload[2]) / 4; //$data->snr = ord($payload[2]) / 4;
$data->raw = base64_encode(substr($payload, 3, strlen($payload))); $data->raw = base64_encode(substr($payload, 3, strlen($payload)));
return $data; return $data;
+21
View File
@@ -290,4 +290,25 @@ class CoreProtocol {
const STATS_TYPE_CORE = 0; const STATS_TYPE_CORE = 0;
const STATS_TYPE_RADIO = 1; const STATS_TYPE_RADIO = 1;
const STATS_TYPE_PACKETS = 2; const STATS_TYPE_PACKETS = 2;
const PACKET_OK = 0x00;
const PACKET_ERROR = 0x01;
const PACKET_CONTACT_START = 0x02;
const PACKET_CONTACT = 0x03;
const PACKET_CONTACT_END = 0x04;
const PACKET_SELF_INFO = 0x05;
const PACKET_MSG_SENT = 0x06;
const PACKET_CONTACT_MSG_RECV = 0x07;
const PACKET_CHANNEL_MSG_RECV = 0x08;
const PACKET_CURRENT_TIME = 0x09;
const PACKET_NO_MORE_MSGS = 0x0A;
const PACKET_BATTERY = 0x0C;
const PACKET_DEVICE_INFO = 0x0D;
const PACKET_CONTACT_MSG_RECV_V3 = 0x10;
const PACKET_CHANNEL_MSG_RECV_V3 = 0x11;
const PACKET_CHANNEL_INFO = 0x12;
const PACKET_ADVERTISEMENT = 0x80;
const PACKET_ACK = 0x82;
const PACKET_MESSAGES_WAITING = 0x83;
const PACKET_LOG_DATA = 0x88;
} }
+2 -1
View File
@@ -4,8 +4,9 @@ namespace Menking\Meshcore\Model;
class LogReceiveResponse extends Response { class LogReceiveResponse extends Response {
public int $code; public int $code;
public int $flags; //public int $flags;
public int $snr; public int $snr;
public int $rssi;
public string $raw; public string $raw;
public int $header; public int $header;
+4
View File
@@ -14,4 +14,8 @@ class Response {
return $output; return $output;
} }
public function toArray(): array {
return get_object_vars($this);
}
} }