mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-22 17:36:29 +02:00
Working gammu adapter
This commit is contained in:
parent
47e4f5a900
commit
99bb1bd46c
3 changed files with 91 additions and 2 deletions
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue