IPSLibrary icon indicating copy to clipboard operation
IPSLibrary copied to clipboard

IPSComponent - Added IPSComponentCam_XeomaVideoSurveillanceSoftware

Open cerberusde opened this issue 8 years ago • 0 comments

`<? /* * This file is part of the IPSLibrary. * * The IPSLibrary is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The IPSLibrary is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the IPSLibrary. If not, see http://www.gnu.org/licenses/gpl.txt. */

 /**@addtogroup ipscomponent
 * @{   
 *
 * @file          IPSComponentCam_XeomaVideoSurveillanceSoftware.class.php
 * @author        cerberus
 * @comment       Diese Class funktioniert bei der Xeoma Video Surveillance Software mit konfiguriertem Web-Server Modul
 *
 */

 /**
 * @class IPSComponentCam_XeomaVideoSurveillanceSoftware
 *
 * Definiert ein IPSComponentCam Object, das die Funktionen einer Cam Componente für eine
 * Kamera aus der Xeoma Video Surveillance Software implementiert
 *
 * @author cerberus
 * @version
 * Version 1.00, 15.12.2017<br/>
 */

IPSUtils_Include ('IPSComponentCam.class.php', 'IPSLibrary::app::core::IPSComponent::IPSComponentCam');

class IPSComponentCam_XeomaVideoSurveillanceSoftware extends IPSComponentCam {

    private $ipAddress;
    private $port;
    private $username;
    private $password;
    private $imagename;
    private $videoname;

     /**
     * @public
     *
     * Initialisierung eines IPSComponentCam_XeomaVideoSurveillanceSoftware Objektes
     *
     * @param string $ipAddress IP Adresse des Xeoma Video Surveillance Server
     * @param string $Port des Xeoma Video Surveillance Server
     * @param string $username Username für Kamera Zugriff
     * @param string $password Passwort für Kamera Zugriff
     * @param string $imagename spezifischer Dateiname des Images im Xeoma Video Surveillance Web-Server Moduls der Surveillance Station für das entsprechende Kamera Image
	 * @param string $videoname spezifischer Dateiname des Live Streams im Xeoma Video Surveillance Web-Server Moduls der Surveillance Station für das entsprechende Kamera Videos
     */
    public function __construct($ipAddress, $port, $username, $password, $imagename, $videoname) {
        $this->ipAddress  = $ipAddress;
        $this->port       = $port;
        $this->username   = $username;
        $this->password   = $password;
        $this->imagename  = $imagename;
        $this->videoname  = $videoname;
    }

		/**
	 * @public
	 *
	 * Funktion liefert String IPSComponent Constructor String.
	 * String kann dazu benützt werden, das Object mit der IPSComponent::CreateObjectByParams
	 * wieder neu zu erzeugen.
	 *
	 * @return string Parameter String des IPSComponent Object
	 */
	public function GetComponentParams() {
		return get_class($this).','.$this->instanceId;
	}
	
	/**
	 * @public
	 *
	 * Function um Events zu behandeln, diese Funktion wird vom IPSMessageHandler aufgerufen, um ein aufgetretenes Event 
	 * an das entsprechende Module zu leiten.
	 *
	 * @param integer $variable ID der auslösenden Variable
	 * @param string $value Wert der Variable
	 * @param IPSModuleCam $module Module Object an das das aufgetretene Event weitergeleitet werden soll
	 */
	public function HandleEvent($variable, $value, IPSModuleCam $module) {
		$name = IPS_GetName($variable);
		throw new IPSComponentException('Event Handling NOT supported for Variable '.$variable.'('.$name.')');
	}

	/**
	 * @public
	 *
	 * Liefert URL des Kamera Live Streams 
	 *
	 * @param integer $size Größe des Streams, mögliche Werte:
	 *                      IPSCOMPONENTCAM_SIZE_SMALL, IPSCOMPONENTCAM_SIZE_MIDDLE oder IPSCOMPONENTCAM_SIZE_LARGE
	 * @return string URL des Streams
	 */
	public function Get_URLLiveStream($size=IPSCOMPONENTCAM_SIZE_MIDDLE) {
		$url = 'http://'.$this->ipAddress.':'.$this->port.'/'.$this->videoname.'?resolution=&fps=&login='.$this->username.'&password='.$this->password;
		switch ($size) {
			case  IPSCOMPONENTCAM_SIZE_SMALL:
				$url .= '';
				break;
			case  IPSCOMPONENTCAM_SIZE_MIDDLE:
				$url .= '';
				break;
			case  IPSCOMPONENTCAM_SIZE_LARGE:
				$url .= '';
				break;
			default:
				trigger_error('Unknown Size '.$size);
		}
		return $url;
	}

	/**
	 * @public
	 *
	 * Liefert URL des Kamera Bildes 
	 *
	 * @param integer $size Größe des Bildes, mögliche Werte:
	 *                      IPSCOMPONENTCAM_SIZE_SMALL, IPSCOMPONENTCAM_SIZE_MIDDLE oder IPSCOMPONENTCAM_SIZE_LARGE 
	 * @return string URL des Bildes
	 */
	public function Get_URLPicture($size=IPSCOMPONENTCAM_SIZE_MIDDLE) {
		$url = 'http://'.$this->ipAddress.':'.$this->port.'/'.$this->imagename.'?resolution=&login='.$this->username.'&password='.$this->password;
		switch ($size) {
			case  IPSCOMPONENTCAM_SIZE_SMALL:
				$url .= '';
				break;
			case  IPSCOMPONENTCAM_SIZE_MIDDLE:
				$url .= '';
				break;
			case  IPSCOMPONENTCAM_SIZE_LARGE:
				$url .= '';
				break;
			default:
				trigger_error('Unknown Size '.$size);
		}
		return $url;
	}

	/**
	 * @public
	 *
	 * Bewegen der Kamera
	 *
	 * @param integer $urlType Type der URL die geliefert werden soll.
	 *                         mögliche Werte: IPSCOMPONENTCAM_URL_MOVEHOME
	                                           IPSCOMPONENTCAM_URL_MOVELEFT
	                                           IPSCOMPONENTCAM_URL_MOVERIGHT
	                                           IPSCOMPONENTCAM_URL_MOVEUP
	                                           IPSCOMPONENTCAM_URL_MOVEDOWN
	                                           IPSCOMPONENTCAM_URL_PREDEFPOS1
	                                           IPSCOMPONENTCAM_URL_PREDEFPOS2
	                                           IPSCOMPONENTCAM_URL_PREDEFPOS3
	                                           IPSCOMPONENTCAM_URL_PREDEFPOS4
	                                           IPSCOMPONENTCAM_URL_PREDEFPOS5
	 */
	public function Get_URL($urlType) {
		trigger_error('Diese Funktion ist für Xeoma Video Surveillance Software noch NICHT implementiert !!!');
	}

	/**
	 * @public
	 *
	 * Liefert Breite des Kamera Bildes 
	 *
	 * @param integer $size Größe des Bildes, mögliche Werte:
	 *                      IPSCOMPONENTCAM_SIZE_SMALL, IPSCOMPONENTCAM_SIZE_MIDDLE oder IPSCOMPONENTCAM_SIZE_LARGE 
	 * @return integer Breite des Bildes in Pixel
	 */
	public function Get_Width($size=IPSCOMPONENTCAM_SIZE_MIDDLE) {
		switch ($size) {
			case  IPSCOMPONENTCAM_SIZE_SMALL:
				$return = 320;
				break;
			case  IPSCOMPONENTCAM_SIZE_MIDDLE:
				$return = 640;
				break;
			case  IPSCOMPONENTCAM_SIZE_LARGE:
				$return = 1024;
				break;
			default:
				trigger_error('Unknown Size '.$size);
		}
		return $return;
	}

	/**
	 * @public
	 *
	 * Liefert Höhe des Kamera Bildes 
	 *
	 * @param integer $size Größe des Bildes, mögliche Werte:
	 *                      IPSCOMPONENTCAM_SIZE_SMALL, IPSCOMPONENTCAM_SIZE_MIDDLE oder IPSCOMPONENTCAM_SIZE_LARGE 
	 * @return integer Höhe des Bildes in Pixel
	 */
	public function Get_Height($size=IPSCOMPONENTCAM_SIZE_MIDDLE) {
		switch ($size) {
			case  IPSCOMPONENTCAM_SIZE_SMALL:
				$return = 240;
				break;
			case  IPSCOMPONENTCAM_SIZE_MIDDLE:
				$return = 480;
				break;
			case  IPSCOMPONENTCAM_SIZE_LARGE:
				$return = 768;
				break;
			default:
				trigger_error('Unknown Size '.$size);
		}
		return $return;
	}
}

/** @}*/

?>`

cerberusde avatar Dec 16 '17 14:12 cerberusde