log rx work; added toArray() to model
This commit is contained in:
+4
-4
@@ -255,11 +255,11 @@ class CoreParser {
|
||||
$data = new LogReceiveResponse();
|
||||
|
||||
$data->code = ord($payload[0]);
|
||||
//$data->snr = ord($payload[1]) / 4;
|
||||
//$data->rssi = (ord($payload[2]) >= 128) ? (ord($payload[2]) - 256): ord($payload[2]);
|
||||
$data->snr = ord($payload[1]) / 4;
|
||||
$data->rssi = (ord($payload[2]) >= 128) ? (ord($payload[2]) - 256): ord($payload[2]);
|
||||
|
||||
$data->flags = ord($payload[1]);
|
||||
$data->snr = ord($payload[2]) / 4;
|
||||
//$data->flags = ord($payload[1]);
|
||||
//$data->snr = ord($payload[2]) / 4;
|
||||
$data->raw = base64_encode(substr($payload, 3, strlen($payload)));
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -290,4 +290,25 @@ class CoreProtocol {
|
||||
const STATS_TYPE_CORE = 0;
|
||||
const STATS_TYPE_RADIO = 1;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ namespace Menking\Meshcore\Model;
|
||||
|
||||
class LogReceiveResponse extends Response {
|
||||
public int $code;
|
||||
public int $flags;
|
||||
//public int $flags;
|
||||
public int $snr;
|
||||
public int $rssi;
|
||||
public string $raw;
|
||||
|
||||
public int $header;
|
||||
|
||||
@@ -14,4 +14,8 @@ class Response {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function toArray(): array {
|
||||
return get_object_vars($this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user