mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Fix gammu adapter, first version of gammu sms parser
This commit is contained in:
parent
d252f88595
commit
fcc438af3c
4 changed files with 60 additions and 53 deletions
|
@ -60,4 +60,37 @@ namespace controllers\internals;
|
|||
|
||||
new \daemons\Phone($phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cette fonction retourne la fenetre de connexion.
|
||||
*/
|
||||
public function test($id_phone)
|
||||
{
|
||||
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD, 'UTF8');
|
||||
$internal_phone = new \controllers\internals\Phone($bdd);
|
||||
$phone = $internal_phone->get($id_phone);
|
||||
if (!$phone)
|
||||
{
|
||||
echo "No phone for id : $id_phone\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
echo "Found phone for id : $id_phone\n";
|
||||
|
||||
$adapter_classname = $phone['adapter'];
|
||||
$adapter = new $adapter_classname($phone['number'], $phone['adapter_datas']);
|
||||
|
||||
//Try send a message
|
||||
$destination = '+33669529042';
|
||||
$text = "Coucou c'est pour un test !";
|
||||
$flash = false;
|
||||
$uid = $adapter->send($destination, $text, $flash);
|
||||
|
||||
if (!$uid)
|
||||
{
|
||||
echo "Cannot send message to $destination\n";
|
||||
}
|
||||
|
||||
echo "Send a message to $destination with uid $uid \n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue