|
@@ -0,0 +1,48 @@
|
|
1
|
+<?php
|
|
2
|
+/**
|
|
3
|
+ * Created by PhpStorm.
|
|
4
|
+ * User: robin
|
|
5
|
+ * Date: 8/21/16
|
|
6
|
+ * Time: 3:25 PM
|
|
7
|
+ */
|
|
8
|
+
|
|
9
|
+namespace App\Http\Business\Cameras\Elro;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+use App\Http\Business\Cameras\AbstractCamera;
|
|
13
|
+use App\Http\DBO\CamerasDbo;
|
|
14
|
+use GuzzleHttp\Client;
|
|
15
|
+use Luticate\Utils\LuLog;
|
|
16
|
+
|
|
17
|
+class C903IP extends AbstractCamera
|
|
18
|
+{
|
|
19
|
+ const URI = "/snapshot.cgi";
|
|
20
|
+
|
|
21
|
+ private $_client;
|
|
22
|
+ private $_url;
|
|
23
|
+
|
|
24
|
+ public function __construct(CamerasDbo $camera)
|
|
25
|
+ {
|
|
26
|
+ parent::__construct($camera);
|
|
27
|
+ $this->_client = new Client();
|
|
28
|
+ $data = $camera->getData();
|
|
29
|
+ $this->_url = "http://" . $data["Host"] . ":" . $data["Port"] . self::URI;
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ public function prepareImage()
|
|
33
|
+ {
|
|
34
|
+ $username = $this->_camera->getData()["Username"];
|
|
35
|
+ $passwd = $this->_camera->getData()["Password"];
|
|
36
|
+
|
|
37
|
+ try {
|
|
38
|
+ $response = $this->_client->request('GET', $this->_url, ['auth' => [
|
|
39
|
+ $username,
|
|
40
|
+ $passwd
|
|
41
|
+ ]]);
|
|
42
|
+ $data = (string)$response->getBody();
|
|
43
|
+ $this->_image = $this->_imagine->load($data);
|
|
44
|
+ } catch (\Exception $e) {
|
|
45
|
+ LuLog::log($e);
|
|
46
|
+ }
|
|
47
|
+ }
|
|
48
|
+}
|