more implementation

This commit is contained in:
Ben Menking
2026-05-10 15:27:51 -04:00
parent d053f7e3eb
commit 9eeb383ee4
7 changed files with 293 additions and 18 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
use Menking\Meshcore\Environment;
use Menking\Meshcore\Meshcore;
require(__DIR__ . '/../vendor/autoload.php');
if( !isset($argv[1]) ) die("{$argv[0]} <port>\n");
Environment::configure($argv[1]);
$mc = Meshcore::getInstance();
$mc->appStart("send message");
$contacts = $mc->getContacts();
echo "Found " . count($contacts) . " contacts\n";
$idx = 1;
foreach($contacts as $contact) {
echo "(" . $idx++ . ") {$contact['contact_name']} [" . substr($contact['pub_key'], 0, 6) . "]\n";
}
$choice = readline("\nPlease select contact to attempt remote login: ");
$contact = $contacts[$choice - 1];
$resp = $mc->getAdvertPath($contact['pub_key']);
print_r($resp);
+26
View File
@@ -0,0 +1,26 @@
<?php
use Menking\Meshcore\CoreProtocol;
use Menking\Meshcore\Environment;
use Menking\Meshcore\Meshcore;
require(__DIR__ . '/../vendor/autoload.php');
if( !isset($argv[1]) ) die("{$argv[0]} <port>\n");
Environment::configure($argv[1]);
$mc = Meshcore::getInstance();
$resp = $mc->appStart("battery storage");
$resp = $mc->getStats(CoreProtocol::STATS_TYPE_CORE);
print_r($resp);
usleep(250000);
$resp = $mc->getStats(CoreProtocol::STATS_TYPE_RADIO);
print_r($resp);
usleep(250000);
$resp = $mc->getStats(CoreProtocol::STATS_TYPE_PACKETS);
print_r($resp);
+9 -3
View File
@@ -6,12 +6,18 @@ use Menking\Meshcore\Util\Debug;
require(__DIR__ . '/../vendor/autoload.php');
Environment::configure('/dev/ttyUSB0');
if( !isset($argv[1]) ) die("{$argv[0]} <port>\n");
Environment::configure($argv[1]);
$mc = Meshcore::getInstance();
$mc->appStart("send message");
$resp = $mc->sendChannelTxtMessage("Ping", 0); // default channel Public on 0
echo Debug::hexDump($resp);
exit;
echo "Send Channel Txt Message result: " . print_r($resp, true) . "\n";
$msgs = $mc->pollForMessage('');
print_r($msgs);