package jp.co.yaskawa.rtc.lumbarConnector;

import jp.co.yaskawa.rtc.armConnector.RTC.RETURN_ID;
import jp.co.yaskawa.rtc.lumbarConnector.RTC.TimedJointPos;
import jp.co.yaskawa.rtc.lumbarConnector.lumbarService.AlarmSeqHolder;
import jp.co.yaskawa.rtc.lumbarConnector.lumbarService.LumbarUnitPOA;
import jp.co.yaskawa.rtc.lumbarConnector.lumbarService.StatusHolder;
import jp.co.yaskawa.rtc.lumbarConnector.LumbarConnectorImpl;

// -*-Java-*-
/*!
 * @file  LumbarUnitSVC_impl.java
 * @brief Service implementation code of LumbarUnit.idl
 *
 */
/*!
 * @class LumbarUnitSVC_impl
 * Example class implementing IDL interface LumbarUnit
 */
public class LumbarUnitSVC_impl extends LumbarUnitPOA{
    
	LumbarConnectorImpl lcImpl_;
	
    public LumbarUnitSVC_impl(LumbarConnectorImpl l) {
    	lcImpl_ = l;
        // Please add extra constructor code here.
    }

    /*
     * Methods corresponding to IDL attributes and operations
     */
    public boolean move(double lowerAxis, double upperAxis, double velocity, double accel) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean move(double lowerAxis, double upperAxis, double velocity, double accel)>"
        return false;
    }

    public boolean moveUpperAxis(double position, double velocity, double accel) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean moveUpperAxis(double position, double velocity, double accel)>"
        return false;
    }

    public boolean moveLowerAxis(double position, double velocity, double accel) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean moveLowerAxis(double position, double velocity, double accel)>"
        return false;
    }

    public boolean getFeedback(org.omg.CORBA.DoubleHolder lowerAxis, org.omg.CORBA.DoubleHolder upperAxis) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean getFeedback(org.omg.CORBA.DoubleHolder lowerAxis, org.omg.CORBA.DoubleHolder upperAxis)>"
        return false;
    }

    public boolean getCommand(org.omg.CORBA.DoubleHolder lowerAxis, org.omg.CORBA.DoubleHolder upperAxis) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean getCommand(org.omg.CORBA.DoubleHolder lowerAxis, org.omg.CORBA.DoubleHolder upperAxis)>"
        return false;
    }

    public boolean getJointStatus(StatusHolder lowerJoint, StatusHolder upperJoint) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean getJointStatus(Status lowerJoint, Status upperJoint)>"
        return false;
    }

    public boolean tuOn() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean tuOn()>"
        return true;
    }

    public boolean tuOff() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean tuOff()>"
        return true;
    }

    public boolean moveCooperative(double position, double velocity, double accel) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean moveCooperative(double position, double velocity, double accel)>"
    	TimedJointPos jointpos = new TimedJointPos();
    	jointpos.pos = new double[3];
    	jointpos.pos[1] = position;
    	LumbarConnectorImpl.move(jointpos);
    	return true;
    }

    public boolean powerOn() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean powerOn()>"
        return true;
    }

    public boolean powerOff() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean powerOff()>"
        return true;
    }

    public boolean servoOn() {
    	int ret = 0;    	
    	ret = lcImpl_.servoOn();
    	
    	if (ret==0)
    		return true;
    	else
    		return false;
    }

    public boolean servoOff() {
    	int ret = 0;    	
    	ret = lcImpl_.servoOff();
    	
    	if (ret==0)
    		return true;
    	else
    		return false;
 
    }

    public boolean isPowerOn() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean isPowerOn()>"
        return false;
    }

    public boolean isServoOn() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean isServoOn()>"
        return false;
    }

    public boolean getState(org.omg.CORBA.IntHolder statusId, org.omg.CORBA.StringHolder message) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean getState(org.omg.CORBA.IntHolder statusId, org.omg.CORBA.StringHolder message)>"
        return false;
    }

    public boolean pause() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean pause()>"
        return true;
    }

    public boolean resume() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean resume()>"
        return true;
    }

    public boolean stop() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean stop()>"
        return true;
    }

    public boolean abort() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean abort()>"
        return true;
    }

    public boolean isMoving() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean isMoving()>"
        return false;
    }

    public boolean clearAlarms() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean clearAlarms()>"
        return true;
    }

    public boolean getActiveAlarm(int maximumNumber, org.omg.CORBA.IntHolder numberOfAlarm, AlarmSeqHolder alarmArray) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean getActiveAlarm(int maximumNumber, org.omg.CORBA.IntHolder numberOfAlarm, AlarmSeq alarmArray)>"
        return false;
    }

    public int getNumberOfAxes() {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <int getNumberOfAxes()>"
        return 0;
    }

    public boolean getVersion(org.omg.CORBA.StringHolder versionMessage) {
        // Please insert your code here and remove the following warning pragma
        // TODO "Code missing in function <boolean getVersion(org.omg.CORBA.StringHolder versionMessage)>"
        return false;
    }

//  End of example implementational code
}
