Newer
Older
smart-home-server / server / SHServ / Routes / DevMode.php
<?php

namespace SHServ\Routes;

trait DevMode {
	protected function devmode_uri_routes() {
		$this -> router -> uri("/dev/test/device-scanner.html", "{$this -> cn}\\DevTestController@device_scanner");
		$this -> router -> uri("/dev/test/device-api-base/about.html", "{$this -> cn}\\DevTestController@device_api_base__about");
		$this -> router -> uri("/dev/test/device-api-base/set_token.html", "{$this -> cn}\\DevTestController@device_api_base__set_token");
		$this -> router -> uri("/dev/test/device-api-base/reboot.html", "{$this -> cn}\\DevTestController@device_api_base__reboot");
		$this -> router -> uri("/dev/test/device-api-base/action.html", "{$this -> cn}\\DevTestController@device_api_base__post_action");
		$this -> router -> uri("/dev/test/device-api-base/set_device_name.html", "{$this -> cn}\\DevTestController@device_api_base__set_device_name");
		$this -> router -> uri("/dev/test/device-api-base/reset.html", "{$this -> cn}\\DevTestController@device_api_base__reset");

		$this -> router -> uri("/dev/test/model/devices/connect_new_device.html", function($args){
			$devices_model = new \SHServ\Models\Devices();

			echo "<pre>";
			var_dump($devices_model -> connect_new_device("192.168.68.2", "test_back_street_light", "Test device. Back street light"));
		});

		$this -> router -> uri("/dev/test/model/devices/unregistered_devices.html", function($args){
			$devices_model = new \SHServ\Models\Devices();

			echo "<pre>";
			var_dump($devices_model -> get_unregistered_devices());
		});

		$this -> router -> uri("/dev/test/model/devices/remove_device.html", function($args){
			$devices_model = new \SHServ\Models\Devices();

			echo "<pre>";
			var_dump($devices_model -> remove_device(6));
		});
	}

	protected function devmode_get_routes() {
		
	}

	protected function devmode_post_routes() {

	}
}