/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM 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; only version 2 of the License.      
 * 
 * NMM 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 NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef NMM_IVISCACameraImpl_HPP
#define NMM_IVISCACameraImpl_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/NMMObject.hpp"
#include "IVISCACamera.hpp"


#include "visibility.hpp"

namespace NMM
{

  class DLLEXPORT IVISCACameraImpl  : public virtual NMM::NMMObject { 
  public:
    IVISCACameraImpl() { addInterface(new IVISCACamera(*this)); registerEvents(); };

    virtual ~IVISCACameraImpl() {};

  protected:
    /**
     * IF_Clear 
     * 
     * Clears the command buffers in the camera and 
     * cancels the command currently beeing executed.
     *
     * this function will be called automaticly by the init
     * function 
     *
     * input  : the number of the camera [1;7,8]
     *          camera_id 8 means broadcast, all 
     *          cameras will clear their command
     *          buffers
     * output : SUCCESS when success, else FAILURE
     */

    virtual Result IF_Clear(const nmm_uchar& value) = 0;
    /**
     * AddressSet
     *
     * Scan all cameras connected to the VISCA-bus 
     * and dispatch one VISCA-address for each camera found.
     *
     * This function will be called automaticly by the 
     * init function
     *
     * input  : none
     * output : SUCCESS when success, else FAILURE
     */

    virtual Result AddressSet() = 0;
    /**
     * getNumberOfCameras
     *
     * Returns the number of cameras connected to the VISCA-bus
     *
     * input  : none
     * output : number of cameras found
     */

    virtual Result getNumberOfCameras(nmm_uchar& value) = 0;
    /**
     * CommandCancel
     * 
     * Cancel the command currently executed by the camera
     * with the address <camera identificator> and the socket
     * number <socket id>.
     *
     * input  : camera identificator and socket id
     * output : SUCCESS, if the command is canceled
     *          FAILURE, if not
     */

    virtual Result CommandCancel(const nmm_uchar& value1, const nmm_uchar& value2) = 0;
    /**
     * Power functions
     *
     * The following functions controlls the powerstate 
     * of the cameras. Each camera can be controlled seperatly,
     * selectecd by the <camera id>. The AutoPowerOff-function sets 
     * the timer after the camera goes in standby-mode, when no 
     * VISCA-cammand arrived 
     *
     * input  : camera id
     * output : SUCCESS if success, else FAILURE
     */

    virtual Result PowerOn(const nmm_uchar& value) = 0;

    virtual Result PowerOff(const nmm_uchar& value) = 0;

    virtual Result AutoPowerOff(const nmm_uchar& value1, const nmm_int32& value2) = 0;
    /**
     * Zoom functions
     *
     * The following functions controls the zoom of the camera. 
     * All that functions expect the <camera_id> as parameter.
     * Some of them allow additional speed settings 
     *
     * - The Range for the Zoom:
     *   optical zoom : [    0;16384]
     *   digital zoom : [16384;28672]
     * - ZoomDZoom(On|Off) turn the DigitalZoom On or Off.
     */

    virtual Result ZoomStop(const nmm_uchar& value) = 0;

    virtual Result ZoomTeleStd(const nmm_uchar& value) = 0;

    virtual Result ZoomWideStd(const nmm_uchar& value) = 0;

    virtual Result ZoomTeleVar(const nmm_uchar& value1, const nmm_uchar& value2) = 0;

    virtual Result ZoomWideVar(const nmm_uchar& value1, const nmm_uchar& value2) = 0;

    virtual Result ZoomDirect(const nmm_uchar& value1, const nmm_int32& value2) = 0;

    virtual Result ZoomDigitalZoomOnOff(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /**
     * Focus functions
     * 
     * the Focus* functions are controling the settings of te
     * camera's focus. All functions expect the <camera_id> 
     * as first parameter, some an additional parameter
     */

    virtual Result FocusStop(const nmm_uchar& value) = 0;

    virtual Result FocusFarStd(const nmm_uchar& value) = 0;

    virtual Result FocusNearStd(const nmm_uchar& value) = 0;

    virtual Result FocusFarVar(const nmm_uchar& value1, const nmm_uchar& value2) = 0;

    virtual Result FocusNearVar(const nmm_uchar& value1, const nmm_uchar& value2) = 0;

    virtual Result FocusDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;

    virtual Result FocusAutoFocus(const nmm_uchar& value) = 0;

    virtual Result FocusManualFocus(const nmm_uchar& value) = 0;

    virtual Result FocusAutoManual(const nmm_uchar& value) = 0;

    virtual Result FocusOnePushTrigger(const nmm_uchar& value) = 0;

    virtual Result FocusInfinity(const nmm_uchar& value) = 0;

    virtual Result FocusAFSensHigh(const nmm_uchar& value) = 0;

    virtual Result FocusAFSensLow(const nmm_uchar& value) = 0;

    virtual Result FocusNearLimit(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * WhiteBalance
     */

    virtual Result WhiteBalance(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result WhiteBalanceAuto(const nmm_uchar& value) = 0;

    virtual Result WhiteBalanceIndoor(const nmm_uchar& value) = 0;

    virtual Result WhiteBalanceOutdoor(const nmm_uchar& value) = 0;

    virtual Result WhiteBalanceOnePush(const nmm_uchar& value) = 0;

    virtual Result WhiteBalanceAT(const nmm_uchar& value) = 0;

    virtual Result WhiteBalanceManual(const nmm_uchar& value) = 0;

    virtual Result WhiteBalanceOnePushTrigger(const nmm_uchar& value) = 0;
    /**
     * RGain
     */

    virtual Result RGainReset(const nmm_uchar& value) = 0;

    virtual Result RGainUp(const nmm_uchar& value) = 0;

    virtual Result RGainDown(const nmm_uchar& value) = 0;

    virtual Result RGainDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * BGain
     */

    virtual Result BGainReset(const nmm_uchar& value) = 0;

    virtual Result BGainUp(const nmm_uchar& value) = 0;

    virtual Result BGainDown(const nmm_uchar& value) = 0;

    virtual Result BGainDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * Automatic Exposure 
     */

    virtual Result AutomaticExposureFull(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureManual(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureShutterPriority(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureIrisPriority(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureGainPriority(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureBright(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureShutterAuto(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureIrisAuto(const nmm_uchar& value) = 0;

    virtual Result AutomaticExposureGainAuto(const nmm_uchar& value) = 0;
    /**
     * Slow Shutter
     */

    virtual Result SlowShutter(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /**
     * Shutter
     */

    virtual Result ShutterReset(const nmm_uchar& value) = 0;

    virtual Result ShutterUp(const nmm_uchar& value) = 0;

    virtual Result ShutterDown(const nmm_uchar& value) = 0;

    virtual Result ShutterDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * Iris
     */

    virtual Result IrisReset(const nmm_uchar& value) = 0;

    virtual Result IrisUp(const nmm_uchar& value) = 0;

    virtual Result IrisDown(const nmm_uchar& value) = 0;

    virtual Result IrisDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * Gain
     */

    virtual Result GainReset(const nmm_uchar& value) = 0;

    virtual Result GainUp(const nmm_uchar& value) = 0;

    virtual Result GainDown(const nmm_uchar& value) = 0;

    virtual Result GainDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * Bright
     */

    virtual Result BrightReset(const nmm_uchar& value) = 0;

    virtual Result BrightUp(const nmm_uchar& value) = 0;

    virtual Result BrightDown(const nmm_uchar& value) = 0;

    virtual Result BrightDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * Exposure Compensation
     */

    virtual Result ExposureCompensationOnOff(const nmm_uchar& value1, const nmm_bool& value2) = 0;

    virtual Result ExposureCompensationReset(const nmm_uchar& value) = 0;

    virtual Result ExposureCompensationUp(const nmm_uchar& value) = 0;

    virtual Result ExposureCompensationDown(const nmm_uchar& value) = 0;

    virtual Result ExposureCompensationDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /** 
     * BackLight
     */

    virtual Result BackLightOnOff(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /**
     * Aperture
     */

    virtual Result ApertureReset(const nmm_uchar& value) = 0;

    virtual Result ApertureUp(const nmm_uchar& value) = 0;

    virtual Result ApertureDown(const nmm_uchar& value) = 0;

    virtual Result ApertureDirect(const nmm_uchar& value1, const nmm_uint16& value2) = 0;
    /**
     * Wide Mode
     */

    virtual Result WideModeOff(const nmm_uchar& value) = 0;

    virtual Result WideModeCinema(const nmm_uchar& value) = 0;

    virtual Result WideMode16to9Full(const nmm_uchar& value) = 0;
    /**
     *  Mirror image on or off
     */

    virtual Result LR_Reverse(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /**
     *  Freeze image on or off
     */

    virtual Result Freeze(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /**
     * Picture Effects
     *
     * These functions allows to turn internal effects on or off. 
     * They expect as parameter the <camera_id>.
     */

    virtual Result PictureEffectOff(const nmm_uchar& value) = 0;

    virtual Result PictureEffectPastel(const nmm_uchar& value) = 0;

    virtual Result PictureEffectNegArt(const nmm_uchar& value) = 0;

    virtual Result PictureEffectSepia(const nmm_uchar& value) = 0;

    virtual Result PictureEffectBW(const nmm_uchar& value) = 0;

    virtual Result PictureEffectSolarize(const nmm_uchar& value) = 0;

    virtual Result PictureEffectMosaic(const nmm_uchar& value) = 0;

    virtual Result PictureEffectSlim(const nmm_uchar& value) = 0;

    virtual Result PictureEffectStretch(const nmm_uchar& value) = 0;
    /**
     * Digital Effects
     *
     * These functions allows to turn internal digital effects 
     * on or off. They expect as parameter the <camera_id>.
     *
     * Please don't call DigitalEffect( in nmm_uchar value1, in nmm_uchar ), its a parent
     * functions for all the other effect functions  
     */

    virtual Result DigitalEffectOff(const nmm_uchar& value) = 0;

    virtual Result DigitalEffectStill(const nmm_uchar& value) = 0;

    virtual Result DigitalEffectFlash(const nmm_uchar& value) = 0;

    virtual Result DigitalEffectLumi(const nmm_uchar& value) = 0;

    virtual Result DigitalEffectTrail(const nmm_uchar& value) = 0;

    virtual Result DigitalEffectLevel(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;
    /**
     * Memory (user defined presets)
     */

    virtual Result Memory(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result MemoryReset(const nmm_uchar& value1, const nmm_uchar& value2) = 0;

    virtual Result MemorySet(const nmm_uchar& value1, const nmm_uchar& value2) = 0;

    virtual Result MemoryRecall(const nmm_uchar& value1, const nmm_uchar& value2) = 0;
    /**
     * DataScreen (OSD)
     */

    virtual Result DataScreenOnOff(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /**
     * IR (remote controller)
     */

    virtual Result IRReceiveOnOff(const nmm_uchar& value1, const nmm_bool& value2) = 0;

    virtual Result IRReceiveReturn(const nmm_uchar& value1, const nmm_bool& value2) = 0;
    /** 
     * PanTiltDriveMotion
     *
     * input  : camera-identifier value1,
     *          motion x-direction, motion y-direction, 
     *          speed x-direction, speed y-direction
     * output : SUCCESS, if command send with success
     *          FAILURE, if an error occured
     * 
     * used for PanTiltDrive-motion functions
     */

    virtual Result PanTiltDriveMotion(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3, const nmm_uchar& value4, const nmm_uchar& value5) = 0;

    virtual Result PanTiltDriveUp(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveDown(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveLeft(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveRight(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveUpLeft(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveUpRight(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveDownLeft(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveDownRight(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;

    virtual Result PanTiltDriveStop(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_uchar& value3) = 0;
    /** 
     * PanTiltDrivePosition
     *
     * input  : camera-identifier,
     *          position-mode (relative or absolute)
     *          motion x-direction in coordinates
     *          morion y-direction in coordinates
     *          speed x-direction, speed y-direction
     * output : SUCCESS, if command send with success
     *          FAILURE, if an error occured
     * 
     * used for PanTiltDrive-position functions
     */

    virtual Result PanTiltDrivePosition(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_int32& value3, const nmm_int32& value4, const nmm_uchar& value5, const nmm_uchar& value6) = 0;

    virtual Result PanTiltDriveAbsolute(const nmm_uchar& value1, const nmm_int32& value2, const nmm_int32& value3, const nmm_uchar& value4, const nmm_uchar& value5) = 0;

    virtual Result PanTiltDriveRelative(const nmm_uchar& value1, const nmm_int32& value2, const nmm_int32& value3, const nmm_uchar& value4, const nmm_uchar& value5) = 0;

    virtual Result PanTiltDriveAbsoluteDeg(const nmm_uchar& value1, const nmm_int32& value2, const nmm_int32& value3, const nmm_uchar& value4, const nmm_uchar& value5) = 0;

    virtual Result PanTiltDriveRelativeDeg(const nmm_uchar& value1, const nmm_int32& value2, const nmm_int32& value3, const nmm_uchar& value4, const nmm_uchar& value5) = 0;

    virtual Result PanTiltDriveHome(const nmm_uchar& value) = 0;

    virtual Result PanTiltDriveReset(const nmm_uchar& value) = 0;

    virtual Result PanTiltLimitSet(const nmm_uchar& value1, const nmm_uchar& value2, const nmm_int32& value3, const nmm_int32& value4) = 0;

    virtual Result PanTiltLimitClear(const nmm_uchar& value1, const nmm_uchar& value2) = 0;
    /**
     * Inquiry Command List 
     */
    /**
     * PowerInq
     *
     * input : The camera ID
     * ouput : The status of the Camera
     *          true = On
     *          false =Off(Standby)
     */

    virtual Result PowerInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result AutoPowerOffInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result DZoomModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result ZoomPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result FocusModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result FocusPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result AFModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result FocusNearLimitInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result WhiteBalanceModeInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result RGainInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result BGainInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result AutoExposureModeInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result SlowShutterModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result ShutterPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result IrisPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result GainPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result BrightPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result ExposureCompensationModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result ExposureCompensationPosInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result BackLightModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result ApertureInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result WideModeInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result LR_ReverseModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result FreezeModeInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result PictureEffectModeInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result DigitalEffectModeInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result DigitalEffectLevelInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result MemoryInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result DatascreenInq(const nmm_uchar& value1, nmm_bool& value2) = 0;

    virtual Result PanTiltModeInq(const nmm_uchar& value1, nmm_uint16& value2) = 0;

    virtual Result PanTiltMaxSpeedInq(const nmm_uchar& value1, nmm_uchar& value2, nmm_uchar& value3) = 0;

    virtual Result PanTiltPosInq(const nmm_uchar& value1, nmm_int32& value2, nmm_int32& value3) = 0;

    virtual Result VideoSystemInq(const nmm_uchar& value1, nmm_uchar& value2) = 0;

    virtual Result DeviceTypeInq(const nmm_uchar& value1, nmm_uint16& value2, nmm_uint16& value3, nmm_uint16& value4, nmm_uchar& value5) = 0;
    /**
     * misc stuff
     */

    virtual void verbose(const string& value1, const string& value2) = 0;

    virtual nmm_bool islocked(const nmm_uchar& value) = 0;


  private:
    void registerEvents();
  };

}

#include "nmm/nmm_suffix.hpp"

#endif
