/******************************************************************************************
** Interface generated from reading basda file: 'SharknirDrotServiceWorker.basda'
**
** Created
**      by: basda2xx.py
**
** WARNING! All changes made in this file will be lost when recompiling basda file!
******************************************************************************************/

#include <Basda/Python/SmartPointerWrapper.hh>
#include <Basda/Python/AllowThreadLock.h>
#include <Nice/Python/ExceptionTranslator.hh>
#include <boost/python.hpp>
#include <SharknirDrotServiceWorkerSkeleton.h>
#include <SharknirDrotServiceWorkerInterface.h>
#include <SharknirDrotServiceWorkerInternalData.h>
#include <Nice/Time/Date.h>

namespace sharknir
{
  class drotServiceWorkerInterfacePy;
  typedef IceUtil::Handle<drotServiceWorkerInterfacePy> drotServiceWorkerInterfacePyPtr;

  class drotServiceWorkerInterfacePy : public drotServiceWorkerInterface
  {
  public:
    drotServiceWorkerInterfacePy(const Nice::JointPtr & _config) : drotServiceWorkerInterface(_config){}
    static drotServiceWorkerInterfacePyPtr create(const std::string & _absnodename)
    {
      if (! Nice::Application::config()->exist(_absnodename))
      {
        E_THROW(Nice::Exception, "Node is missing: " << _absnodename);
      }
      return Basda::getServiceWorkerInterfaceInstance<drotServiceWorkerInterfacePy>(Nice::Application::config(_absnodename), "drotServiceWorker");
    }

    /** @note overridden */
    virtual bool changeState( Basda::ServiceState _state, const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return Basda::ServiceWorkerInterface::changeState(_state, _wait);
    }
    /** @note overridden */
    virtual bool waitForState( Basda::ServiceState _state, const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return Basda::ServiceWorkerInterface::waitForState(_state, _wait);
    }

    /** @note overridden */
    bool isReachable()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::isReachable();
    }

    /** @note overridden */
    double getPosition(std::string _unit = "STEPS")
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getPosition(_unit);
    }

    /** @note overridden */
    void setPosition(double _position, std::string _unit = "STEPS")
    {
      Basda::Python::AllowThreadLock lock;
      sharknir::drotServiceWorkerInterface::setPosition(_position, _unit);
    }

    /** @note overridden */
    double getDeviceEncoderPosition(std::string _unit = "STEPS")
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getDeviceEncoderPosition(_unit);
    }

    /** @note overridden */
    double getAbsoluteEncoderPosition()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getAbsoluteEncoderPosition();
    }

    /** @note overridden */
    double getIncrementalEncoderPosition()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getIncrementalEncoderPosition();
    }

    /** @note overridden */
    double convertPosition(double _position, bool _absolute, std::string _unit_from, std::string _unit_to)
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::convertPosition(_position, _absolute, _unit_from, _unit_to);
    }

    /** @note overridden */
    double getVelocity()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getVelocity();
    }

    /** @note overridden */
    bool isAtHome()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::isAtHome();
    }

    /** @note overridden */
    bool isAtLimit()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::isAtLimit();
    }

    /** @note overridden */
    bool isMoving()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::isMoving();
    }

    /** @note overridden */
    double getNamedPosition(int _named_position)
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getNamedPosition(_named_position);
    }

    /** @note overridden */
    std::string getRA()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::getRA();
    }

    /** @note overridden */
    void changeDerotationWithAbsoluteOffset(const Nice::Date & _start_date, double _position, std::string _unit = "DEGREE")
    {
      Basda::Python::AllowThreadLock lock;
      sharknir::drotServiceWorkerInterface::changeDerotationWithAbsoluteOffset(_start_date, _position, _unit);
    }

    /** @note overridden */
    void changeDerotationWithRelativeOffset(const Nice::Date & _start_date, double _position, std::string _unit = "DEGREE")
    {
      Basda::Python::AllowThreadLock lock;
      sharknir::drotServiceWorkerInterface::changeDerotationWithRelativeOffset(_start_date, _position, _unit);
    }

    /** @note overridden */
    virtual Nice::Completion moveRelativeStart(double _position, std::string _unit= "DEGREE")
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveRelativeStart( _position,  _unit);
    }

    /** @note overridden */
    virtual bool moveRelativeWait(const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveRelativeWait(_wait);
    }

    /** @note overridden */
    virtual Nice::Completion moveAbsoluteStart(double _position, std::string _unit= "DEGREE")
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveAbsoluteStart( _position,  _unit);
    }

    /** @note overridden */
    virtual bool moveAbsoluteWait(const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveAbsoluteWait(_wait);
    }

    /** @note overridden */
    virtual Nice::Completion moveToHomeStart()
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveToHomeStart();
    }

    /** @note overridden */
    virtual bool moveToHomeWait(const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveToHomeWait(_wait);
    }

    /** @note overridden */
    virtual Nice::Completion moveToLimitStart(double _limit)
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveToLimitStart( _limit);
    }

    /** @note overridden */
    virtual bool moveToLimitWait(const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveToLimitWait(_wait);
    }

    /** @note overridden */
    virtual Nice::Completion moveToNamedPositionStart(int _named_position)
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveToNamedPositionStart( _named_position);
    }

    /** @note overridden */
    virtual bool moveToNamedPositionWait(const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::moveToNamedPositionWait(_wait);
    }

    /** @note overridden */
    virtual Nice::Completion startDerotationStart(const Nice::Date & _start_date, double _position, std::string _unit= "DEGREE" )
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::startDerotationStart( _start_date,  _position,  _unit);
    }

    /** @note overridden */
    virtual bool startDerotationWait(const Nice::Time & _wait = Nice::Time())
    {
      Basda::Python::AllowThreadLock lock;
      return sharknir::drotServiceWorkerInterface::startDerotationWait(_wait);
    }

  };

  namespace Python
  {

     template <> PyObject * Nice::Python::ExceptionTypeObj<sharknir::ServiceException>::s_ptr = 0;

     typedef  sharknir::drotServiceWorkerInterfacePyPtr ( * CreateType )( const std::string & );

     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(BasdaServiceWorkerInterfacecPyChangeStateInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::changeState, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(BasdaServiceWorkerInterfacecPyWaitForStateInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::waitForState, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetPangStrtAngInterfaceOverloads, sharknir::drotServiceWorkerInterface::setPangStrtAng, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetPangStrtAngSkeletonOverloads, sharknir::drotServiceWorkerSkeleton::setPangStrtAng, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetMotStrtAngInterfaceOverloads, sharknir::drotServiceWorkerInterface::setMotStrtAng, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetMotStrtAngSkeletonOverloads, sharknir::drotServiceWorkerSkeleton::setMotStrtAng, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetMotStrtPosInterfaceOverloads, sharknir::drotServiceWorkerInterface::setMotStrtPos, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetMotStrtPosSkeletonOverloads, sharknir::drotServiceWorkerSkeleton::setMotStrtPos, 1, 2)
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(GetPositionInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::getPosition, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(SetPositionInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::setPosition, 1, 2);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(GetDeviceEncoderPositionInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::getDeviceEncoderPosition, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(ChangeDerotationWithAbsoluteOffsetInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::changeDerotationWithAbsoluteOffset, 2, 3);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(ChangeDerotationWithRelativeOffsetInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::changeDerotationWithRelativeOffset, 2, 3);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveRelativeInterfaceOverloads, sharknir::drotServiceWorkerInterface::moveRelative, 1, 2);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveRelativeStartInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveRelativeStart, 1, 2);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveRelativeWaitInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveRelativeWait, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveAbsoluteInterfaceOverloads, sharknir::drotServiceWorkerInterface::moveAbsolute, 1, 2);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveAbsoluteStartInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveAbsoluteStart, 1, 2);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveAbsoluteWaitInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveAbsoluteWait, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveToHomeWaitInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveToHomeWait, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveToLimitWaitInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveToLimitWait, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(MoveToNamedPositionWaitInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::moveToNamedPositionWait, 0, 1);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(StartDerotationInterfaceOverloads, sharknir::drotServiceWorkerInterface::startDerotation, 2, 3);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(StartDerotationStartInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::startDerotationStart, 2, 3);
     BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(StartDerotationWaitInterfaceOverloads, sharknir::drotServiceWorkerInterfacePy::startDerotationWait, 0, 1);

     void export_sharknirdrot()
     {
       Nice::Python::addExceptionType<sharknir::ServiceException> ( "ServiceException" );

       class_<sharknir::drotServiceWorkerInterface, bases<Basda::ServiceWorkerInterface>, sharknir::drotServiceWorkerInterfacePtr, boost::noncopyable>("drotBase", no_init)
         ;

       class_<sharknir::drotServiceWorkerInterfacePy, bases<sharknir::drotServiceWorkerInterface>, sharknir::drotServiceWorkerInterfacePyPtr, boost::noncopyable>("drot", no_init)
         .def("create", (CreateType) &sharknir::drotServiceWorkerInterfacePy::create)
         .staticmethod("create")
         .def("abort", & Basda::ServiceWorkerInterface::abort)
         .def("stop", & Basda::ServiceWorkerInterface::stop)
         .def("changeState", & sharknir::drotServiceWorkerInterfacePy::changeState, BasdaServiceWorkerInterfacecPyChangeStateInterfaceOverloads())
         .def("waitForState", & sharknir::drotServiceWorkerInterfacePy::waitForState, BasdaServiceWorkerInterfacecPyWaitForStateInterfaceOverloads())
         .def("setPangStrtAng", &sharknir::drotServiceWorkerInterface::setPangStrtAng, SetPangStrtAngInterfaceOverloads())
         .def("getPangStrtAng", &sharknir::drotServiceWorkerInterface::getPangStrtAng)
         .def("setMotStrtAng", &sharknir::drotServiceWorkerInterface::setMotStrtAng, SetMotStrtAngInterfaceOverloads())
         .def("getMotStrtAng", &sharknir::drotServiceWorkerInterface::getMotStrtAng)
         .def("setMotStrtPos", &sharknir::drotServiceWorkerInterface::setMotStrtPos, SetMotStrtPosInterfaceOverloads())
         .def("getMotStrtPos", &sharknir::drotServiceWorkerInterface::getMotStrtPos)
         .def("readServiceName", &sharknir::drotServiceWorkerInterface::readServiceName)
         .def("readPosition", &sharknir::drotServiceWorkerInterface::readPosition)
         .def("readDeviceEncoderPosition", &sharknir::drotServiceWorkerInterface::readDeviceEncoderPosition)
         .def("readAbsoluteEncoderPosition", &sharknir::drotServiceWorkerInterface::readAbsoluteEncoderPosition)
         .def("readIncrementalEncoderPosition", &sharknir::drotServiceWorkerInterface::readIncrementalEncoderPosition)
         .def("isReachable", &sharknir::drotServiceWorkerInterfacePy::isReachable)
         .def("getPosition", &sharknir::drotServiceWorkerInterfacePy::getPosition,GetPositionInterfaceOverloads())
         .def("setPosition", &sharknir::drotServiceWorkerInterfacePy::setPosition,SetPositionInterfaceOverloads())
         .def("getDeviceEncoderPosition", &sharknir::drotServiceWorkerInterfacePy::getDeviceEncoderPosition,GetDeviceEncoderPositionInterfaceOverloads())
         .def("getAbsoluteEncoderPosition", &sharknir::drotServiceWorkerInterfacePy::getAbsoluteEncoderPosition)
         .def("getIncrementalEncoderPosition", &sharknir::drotServiceWorkerInterfacePy::getIncrementalEncoderPosition)
         .def("convertPosition", &sharknir::drotServiceWorkerInterfacePy::convertPosition)
         .def("getVelocity", &sharknir::drotServiceWorkerInterfacePy::getVelocity)
         .def("isAtHome", &sharknir::drotServiceWorkerInterfacePy::isAtHome)
         .def("isAtLimit", &sharknir::drotServiceWorkerInterfacePy::isAtLimit)
         .def("isMoving", &sharknir::drotServiceWorkerInterfacePy::isMoving)
         .def("getNamedPosition", &sharknir::drotServiceWorkerInterfacePy::getNamedPosition)
         .def("getRA", &sharknir::drotServiceWorkerInterfacePy::getRA)
         .def("changeDerotationWithAbsoluteOffset", &sharknir::drotServiceWorkerInterfacePy::changeDerotationWithAbsoluteOffset,ChangeDerotationWithAbsoluteOffsetInterfaceOverloads())
         .def("changeDerotationWithRelativeOffset", &sharknir::drotServiceWorkerInterfacePy::changeDerotationWithRelativeOffset,ChangeDerotationWithRelativeOffsetInterfaceOverloads())
         .def("moveRelative", &sharknir::drotServiceWorkerInterface::moveRelative,MoveRelativeInterfaceOverloads())
         .def("moveRelativeStart", &sharknir::drotServiceWorkerInterfacePy::moveRelativeStart,MoveRelativeStartInterfaceOverloads())
         .def("moveRelativeWait", &sharknir::drotServiceWorkerInterfacePy::moveRelativeWait,MoveRelativeWaitInterfaceOverloads())
         .def("moveRelativeCompletion", &sharknir::drotServiceWorkerInterfacePy::moveRelativeCompletion)
         .def("moveAbsolute", &sharknir::drotServiceWorkerInterface::moveAbsolute,MoveAbsoluteInterfaceOverloads())
         .def("moveAbsoluteStart", &sharknir::drotServiceWorkerInterfacePy::moveAbsoluteStart,MoveAbsoluteStartInterfaceOverloads())
         .def("moveAbsoluteWait", &sharknir::drotServiceWorkerInterfacePy::moveAbsoluteWait,MoveAbsoluteWaitInterfaceOverloads())
         .def("moveAbsoluteCompletion", &sharknir::drotServiceWorkerInterfacePy::moveAbsoluteCompletion)
         .def("moveToHome", &sharknir::drotServiceWorkerInterface::moveToHome)
         .def("moveToHomeStart", &sharknir::drotServiceWorkerInterfacePy::moveToHomeStart)
         .def("moveToHomeWait", &sharknir::drotServiceWorkerInterfacePy::moveToHomeWait,MoveToHomeWaitInterfaceOverloads())
         .def("moveToHomeCompletion", &sharknir::drotServiceWorkerInterfacePy::moveToHomeCompletion)
         .def("moveToLimit", &sharknir::drotServiceWorkerInterface::moveToLimit)
         .def("moveToLimitStart", &sharknir::drotServiceWorkerInterfacePy::moveToLimitStart)
         .def("moveToLimitWait", &sharknir::drotServiceWorkerInterfacePy::moveToLimitWait,MoveToLimitWaitInterfaceOverloads())
         .def("moveToLimitCompletion", &sharknir::drotServiceWorkerInterfacePy::moveToLimitCompletion)
         .def("moveToNamedPosition", &sharknir::drotServiceWorkerInterface::moveToNamedPosition)
         .def("moveToNamedPositionStart", &sharknir::drotServiceWorkerInterfacePy::moveToNamedPositionStart)
         .def("moveToNamedPositionWait", &sharknir::drotServiceWorkerInterfacePy::moveToNamedPositionWait,MoveToNamedPositionWaitInterfaceOverloads())
         .def("moveToNamedPositionCompletion", &sharknir::drotServiceWorkerInterfacePy::moveToNamedPositionCompletion)
         .def("startDerotation", &sharknir::drotServiceWorkerInterface::startDerotation,StartDerotationInterfaceOverloads())
         .def("startDerotationStart", &sharknir::drotServiceWorkerInterfacePy::startDerotationStart,StartDerotationStartInterfaceOverloads())
         .def("startDerotationWait", &sharknir::drotServiceWorkerInterfacePy::startDerotationWait,StartDerotationWaitInterfaceOverloads())
         .def("startDerotationCompletion", &sharknir::drotServiceWorkerInterfacePy::startDerotationCompletion)
         ;

       enum_<sharknir::drotServiceWorkerInterface::CMDS> ("drotServiceWorkerCmds")
         .value ("MOVERELATIVE", sharknir::drotServiceWorkerInterface::MOVERELATIVE)
         .value ("MOVEABSOLUTE", sharknir::drotServiceWorkerInterface::MOVEABSOLUTE)
         .value ("MOVETOHOME", sharknir::drotServiceWorkerInterface::MOVETOHOME)
         .value ("MOVETOLIMIT", sharknir::drotServiceWorkerInterface::MOVETOLIMIT)
         .value ("MOVETONAMEDPOSITION", sharknir::drotServiceWorkerInterface::MOVETONAMEDPOSITION)
         .value ("STARTDEROTATION", sharknir::drotServiceWorkerInterface::STARTDEROTATION)
         ;
     };
  };
}
