12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
-
- namespace App\Http\Controller;
-
- use App\Http\Business\SensorTypesBusiness;
- use Luticate\Utils\LuController;
- use App\Http\Business\SensorsBusiness;
- use App\Http\DBO\SensorsDbo;
- use Luticate\Utils\LuMultipleDbo;
-
- class SensorsController extends LuController {
- protected function getBusiness()
- {
- return new SensorsBusiness();
- }
-
- /**
- * Get all sensor types
- * @param int $page The page number, 0 based
- * @param int $perPage The number of items per page
- * @param string $query The filter query
- * @return LuMultipleDbo
- */
- public function getAllTypes($page = 0, $perPage = PHP_INT_MAX, $query = "")
- {
- return SensorTypesBusiness::getAll($page, $perPage, $query);
- }
-
- /**
- * Get all sensors, sorted by name
- * @param int $page The page number, 0 based
- * @param int $perPage The number of items per page
- * @param string $query The filter query
- * @return \Luticate\Utils\LuMultipleDbo
- */
- public function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
- {
- return SensorsBusiness::getAll($page, $perPage, $query);
- }
-
- /**
- * Get a sensor
- * @param $sensor_id int The sensor id
- * @return SensorsDbo
- */
- public function get($sensor_id)
- {
- return SensorsBusiness::getById($sensor_id);
- }
-
- /**
- * Add a new sensor
- * @param SensorsDbo $sensor The sensor
- * @return int
- */
- public function add(SensorsDbo $sensor)
- {
- return SensorsBusiness::add($sensor);
- }
-
- /**
- * Edit an existing sensor
- * @param SensorsDbo $sensor The sensor
- * @param $sensor_id int The sensor id
- * @return bool
- */
- public function edit(SensorsDbo $sensor, $sensor_id)
- {
- return SensorsBusiness::edit($sensor, $sensor_id);
- }
-
- /**
- * Delete an existing sensor
- * @param $sensor_id int The sensor id
- * @return bool
- */
- public function del($sensor_id)
- {
- return SensorsBusiness::deleteById($sensor_id);
- }
-
- /**
- * Get the sensor value
- * @param $sensor_id int The sensor id
- * @return float
- */
- public function getValue($sensor_id)
- {
- return SensorsBusiness::getValue($sensor_id);
- }
- }
|