diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index f0e26dd..58b0125 100755
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,8 +1,8 @@
+ android:versionCode="14"
+ android:versionName="2.0.1">
@@ -105,17 +105,26 @@
-
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/server/php/EnvayaSMS.php b/server/php/EnvayaSMS.php
index d2ff8e9..5580050 100755
--- a/server/php/EnvayaSMS.php
+++ b/server/php/EnvayaSMS.php
@@ -11,12 +11,18 @@ class EnvayaSMS
const ACTION_INCOMING = 'incoming';
const ACTION_OUTGOING = 'outgoing';
const ACTION_SEND_STATUS = 'send_status';
+ const ACTION_DEVICE_STATUS = 'device_status';
const ACTION_TEST = 'test';
const STATUS_QUEUED = 'queued';
const STATUS_FAILED = 'failed';
const STATUS_SENT = 'sent';
+ const DEVICE_STATUS_POWER_CONNECTED = "power_connected";
+ const DEVICE_STATUS_POWER_DISCONNECTED = "power_disconnected";
+ const DEVICE_STATUS_BATTERY_LOW = "battery_low";
+ const DEVICE_STATUS_BATTERY_OKAY = "battery_okay";
+
const MESSAGE_TYPE_SMS = 'sms';
const MESSAGE_TYPE_MMS = 'mms';
@@ -49,11 +55,13 @@ class EnvayaSMS_Request
public $version;
public $phone_number;
+ public $log;
function __construct()
{
$this->version = $_POST['version'];
$this->phone_number = $_POST['phone_number'];
+ $this->log = @$_POST['log'];
}
function get_action()
@@ -77,6 +85,8 @@ class EnvayaSMS_Request
return new EnvayaSMS_Action_SendStatus($this);
case EnvayaSMS::ACTION_TEST:
return new EnvayaSMS_Action_Test($this);
+ case EnvayaSMS::ACTION_DEVICE_STATUS:
+ return new EnvayaSMS_Action_DeviceStatus($this);
default:
return new EnvayaSMS_Action($this);
}
@@ -247,4 +257,16 @@ class EnvayaSMS_Action_SendStatus extends EnvayaSMS_Action
$this->id = $_POST['id'];
$this->error = $_POST['error'];
}
-}
\ No newline at end of file
+}
+
+class EnvayaSMS_Action_DeviceStatus extends EnvayaSMS_Action
+{
+ public $status; // EnvayaSMS::DEVICE_STATUS_* values
+
+ function __construct($request)
+ {
+ parent::__construct($request);
+ $this->type = EnvayaSMS::ACTION_DEVICE_STATUS;
+ $this->status = $_POST['status'];
+ }
+}
diff --git a/server/php/example/log/.gitignore b/server/php/example/log/.gitignore
new file mode 100644
index 0000000..bf0824e
--- /dev/null
+++ b/server/php/example/log/.gitignore
@@ -0,0 +1 @@
+*.log
\ No newline at end of file
diff --git a/server/php/example/www/index.php b/server/php/example/www/index.php
index ff3c80c..510895f 100755
--- a/server/php/example/www/index.php
+++ b/server/php/example/www/index.php
@@ -22,6 +22,16 @@ if (!isset($password) || !$request->is_validated($password))
return;
}
+// append to EnvayaSMS app log
+$app_log = $request->log;
+if ($app_log)
+{
+ $log_file = dirname(__DIR__)."/log/sms_".preg_replace('#[^\w]#', '', $request->phone_number).".log";
+ $f = fopen($log_file, "a");
+ fwrite($f, $app_log);
+ fclose($f);
+}
+
$action = $request->get_action();
switch ($action->type)
@@ -79,6 +89,10 @@ switch ($action->type)
echo "invalid id";
}
return;
+ case EnvayaSMS::ACTION_DEVICE_STATUS:
+ error_log("device_status = {$action->status}");
+ echo "OK";
+ return;
case EnvayaSMS::ACTION_TEST:
echo "OK";
return;
diff --git a/server/php/example/www/test.html b/server/php/example/www/test.html
index b8e5bd0..4023439 100755
--- a/server/php/example/www/test.html
+++ b/server/php/example/www/test.html
@@ -1,6 +1,6 @@
-
+EnvayaSMS Request Simulator