fix gammu adapter to remove number and update adapters to support or not sms reception

This commit is contained in:
osaajani 2020-03-31 02:22:40 +02:00
parent 2ae2baa6c4
commit f6e96c1133
5 changed files with 36 additions and 6 deletions

View File

@ -51,6 +51,11 @@ namespace adapters;
*/
public static function meta_datas_fields(): array;
/**
* Does the implemented service support reading smss.
*/
public static function meta_support_read(): bool;
/**
* Does the implemented service support flash smss.
*/

View File

@ -20,11 +20,6 @@ namespace adapters;
*/
class GammuAdapter implements AdapterInterface
{
/**
* Phone number using the adapter.
*/
private $number;
/**
* Datas used to configure interaction with the implemented service. (e.g : Api credentials, ports numbers, etc.).
*/
@ -35,7 +30,7 @@ namespace adapters;
*
* @param json string $datas : JSON string of the datas to configure interaction with the implemented service
*/
public function __construct(string $number, string $datas)
public function __construct(string $datas)
{
$this->datas = json_decode($datas, true);
}
@ -89,6 +84,14 @@ namespace adapters;
];
}
/**
* Does the implemented service support reading smss.
*/
public static function meta_support_read(): bool
{
return true;
}
/**
* Does the implemented service support flash smss.
*/

View File

@ -133,6 +133,14 @@ namespace adapters;
];
}
/**
* Does the implemented service support reading smss.
*/
public static function meta_support_read(): bool
{
return true;
}
/**
* Does the implemented service support flash smss.
*/

View File

@ -80,6 +80,15 @@ namespace adapters;
{
return [];
}
/**
* Does the implemented service support reading smss.
*/
public static function meta_support_read(): bool
{
return true;
}
/**
* Does the implemented service support flash smss.

View File

@ -173,6 +173,11 @@ class Phone extends AbstractDaemon
$internal_received = new \controllers\internals\Received($this->bdd);
$internal_setting = new \controllers\internals\Setting($this->bdd);
if (!$this->adapter->meta_support_read())
{
return true;
}
$smss = $this->adapter->read();
if (!$smss)
{