Browse Source

camera play

tags/0.1.0
Robin Thoni 9 years ago
parent
commit
75d2b3bc27

+ 17
- 0
app/Http/Business/CamerasBusiness.php View File

2
 
2
 
3
 namespace App\Http\Business;
3
 namespace App\Http\Business;
4
 
4
 
5
+use App\Http\DBO\CameraTypesDbo;
6
+use App\Http\DBO\HostsDbo;
5
 use Luticate\Utils\LuBusiness;
7
 use Luticate\Utils\LuBusiness;
6
 use App\Http\DataAccess\CamerasDataAccess;
8
 use App\Http\DataAccess\CamerasDataAccess;
7
 use App\Http\DBO\CamerasDbo;
9
 use App\Http\DBO\CamerasDbo;
10
+use Luticate\Utils\LuRequest;
8
 
11
 
9
 class CamerasBusiness extends LuBusiness {
12
 class CamerasBusiness extends LuBusiness {
10
     protected static function getDataAccess()
13
     protected static function getDataAccess()
48
         $camera->setId($camera_id);
51
         $camera->setId($camera_id);
49
         return CamerasDataAccess::editById($camera_id, $camera);
52
         return CamerasDataAccess::editById($camera_id, $camera);
50
     }
53
     }
54
+
55
+    public static function getImage($camera_id)
56
+    {
57
+        /**
58
+         * @var $camera CamerasDbo
59
+         * @var $host HostsDbo
60
+         * @var $type CameraTypesDbo
61
+         */
62
+        $camera = self::getById($camera_id);
63
+        $host = HostsBusiness::getById($camera->getHostId());
64
+        $type = CameraTypesBusiness::getById($camera->getCameraTypeId());
65
+        return LuRequest::proxy('POST', $host->getUrl() . "/cameras/image", [],
66
+            ["camera" => $camera->__toString(), "type" => $type->__toString()], ["X-Token" => $host->getToken()]);
67
+    }
51
 }
68
 }

+ 10
- 0
app/Http/Controller/CamerasController.php View File

78
     {
78
     {
79
         return CamerasBusiness::deleteById($camera_id);
79
         return CamerasBusiness::deleteById($camera_id);
80
     }
80
     }
81
+
82
+    /**
83
+     * Get an image from the camera
84
+     * @param $camera_id int The camera id
85
+     * @return mixed
86
+     */
87
+    public function getImage($camera_id)
88
+    {
89
+        return CamerasBusiness::getImage($camera_id);
90
+    }
81
 }
91
 }

+ 1
- 0
app/Http/routes.php View File

30
 $route->post("/cameras/add", "Cameras", "add", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_ADD));
30
 $route->post("/cameras/add", "Cameras", "add", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_ADD));
31
 $route->post("/cameras/$camera_id/edit", "Cameras", "edit", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_EDIT));
31
 $route->post("/cameras/$camera_id/edit", "Cameras", "edit", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_EDIT));
32
 $route->post("/cameras/$camera_id/del", "Cameras", "del", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_DEL));
32
 $route->post("/cameras/$camera_id/del", "Cameras", "del", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_DEL));
33
+$route->post("/cameras/$camera_id/image", "Cameras", "getImage", array(CamotionPermissions::CAMERA_GET, CamotionPermissions::CAMERA_EXEC));
33
 
34
 
34
 
35
 
35
 $route->get("/sensors/types", "Sensors", "getAllTypes", array(CamotionPermissions::SENSOR_GET, CamotionPermissions::SENSOR_ADD));
36
 $route->get("/sensors/types", "Sensors", "getAllTypes", array(CamotionPermissions::SENSOR_GET, CamotionPermissions::SENSOR_ADD));

Loading…
Cancel
Save