Working gammu adapter

This commit is contained in:
OsaAjani 2020-01-12 23:57:24 +01:00
parent 47e4f5a900
commit 99bb1bd46c
3 changed files with 91 additions and 2 deletions

View file

@ -166,6 +166,36 @@
{
return [];
}
$command_parts = [
PWD . '/bin/gammu_get_unread_sms.py',
escapeshellarg($this->datas['config_file']),
];
$return = $this->exec_command($command_parts);
if ($return['return'] != 0)
{
return [];
}
$smss = [];
foreach ($return['output'] as $line)
{
$decode = json_decode($line, true);
if ($decode === null)
{
continue;
}
$smss[] = [
'at' => $decode['at'],
'text' => $decode['text'],
'origin' => $decode['number'],
'destination' => $this->number,
];
}
return $smss;
}
@ -250,8 +280,6 @@
$return_var = null;
exec($command, $output, $return_var);
var_dump($output);
return ['return' => (int) $return_var, 'output' => $output];
}