Browse Source

added Elo C903IP camera

tags/0.1.3^0
Robin Thoni 8 years ago
parent
commit
9b7a58d319

+ 48
- 0
app/Http/Business/Cameras/Elro/C903IP.php View File

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
+}

+ 1
- 2
app/Http/Business/Cameras/Trendnet/TVIP311PI.php View File

28
         $this->_client = new Client();
28
         $this->_client = new Client();
29
         $data = $camera->getData();
29
         $data = $camera->getData();
30
         $this->_url = "http://" . $data["Host"] . ":" . $data["Port"] . self::URI;
30
         $this->_url = "http://" . $data["Host"] . ":" . $data["Port"] . self::URI;
31
-        $this->_options = [];
32
     }
31
     }
33
 
32
 
34
     public function prepareImage()
33
     public function prepareImage()
42
         $nonce = "";
41
         $nonce = "";
43
 
42
 
44
         try {
43
         try {
45
-            $this->_client->request('GET', $this->_url, $this->_options);
44
+            $this->_client->request('GET', $this->_url);
46
         } catch (RequestException $e) {
45
         } catch (RequestException $e) {
47
             $response = $e->getResponse();
46
             $response = $e->getResponse();
48
             if ($response->getStatusCode() == 401) {
47
             if ($response->getStatusCode() == 401) {

Loading…
Cancel
Save