// Motor_8164.h: interface for the CMotor_8164 class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MOTOR_8164_H__0A0D12D6_1862_4068_B8B4_EE93055E9BFA__INCLUDED_)
#define AFX_MOTOR_8164_H__0A0D12D6_1862_4068_B8B4_EE93055E9BFA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MotorAdlinkBase.h"

class CMotor_8164 : public CMotorAdlinkBase
{
public:
    CMotor_8164(CMtrProfile mtrProfile, double *dpPos, CMotionControllerBase *pBaseController);
    virtual ~CMotor_8164();

// **************************************************************
// Methods declaration
// **************************************************************

// method to close the axis
    void CloseAxis() override;

// method to initialize and configure the axis
    void ConstructMotor() override;

//  method to On/Off motor
    bool OnMotor() override;
    bool OffMotor() override;

//  method to stop motor with decceleration
    bool DecelStop() override;

//  method to trigger Emergency stop the motor  int EStop();
    bool EmergStop() override;

// method to get commanded position
    bool GetMotorCommandedPosition(int iMtrNo, double *pRaw) override;

// method to get the motor axis IO status
    int GetMotionIOStatus(const CMtrProfile &mtrProfile) override;

// method to get Other axis motor ready status
    BOOL IsMotorReady(const CMtrProfile &mtrProfile) override;

// method to get Other axis home sensor status
    bool IsMtrOn(const CMtrProfile &mtrProfile) override;

// method to get other motor axis current position
    bool GetMotorPosition(const CMtrProfile &mtrProfile, double *pRawPosition) override;

// method to get motor axis current position error
    bool GetMotorPositionError(double *pRawPositionError) override;

// method to process interrupt to decode what happen to the motor
    void ProcessInt(int nIntCode = 0) override;

// method to reset single trigger
    int ResetSingleTrigger() override;

// method to set the commanded position register
    bool SetMotorCommandedPosition(double dPosition) override;

// method to set the mechanical coversion factor
    bool RefreshMotorConversionFactor() override;

// method to set homing modes
    bool SetMotorHomeMode(int iHomeMode) override;

// method to set multiple trigger
    bool SetMotorMultipleTrigger(const multiple_trigger &trigger) override;

// method to force set the current position
    bool SetMotorPosition(double dPosition) override;

// method to arm controller axis for single trigger
    int SetSingleTrigger(double dPosition,  int nCmpSource = 1, int nPulseStretch = STRETCH_NON) override;

// method to arm multiaxis for simultaneous motion
    bool SetupAbsoluteSimultaneousMove(int nNoOfAxis, short *sAxis, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, double *dDec) override;
    bool SetupRelativeSimultaneousMove(int nNoOfAxis, short *sAxis, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, double *dDec) override;
    bool StartSimultaneousMove(int nFirstAxisNo) override;

// Method to force a compare output pulse
// Gary 2Jul12, V1.29.07
    int TriggerCompareOutput() override;

// method to set the motor type and encoder input type
    bool SetMotorType(int iMtrType) override;

// method to set the motor alarm signal logic
    bool SetMotorAlarmLogic(int iALM) override;

// method to set the home sensor signal logic
    bool SetMotorHomeSensorLogic(int iORGI) override;

// method to set the encoder Index signal logic
    bool SetMotorIndexLogic(int iIndexLogic) override;

// method to set the in position signal logic
    bool SetMotorINPLogic(int iINP) override;

// method to set clk type, out/dir or cw/ccw
    bool SetMotorClk(int iClk) override;

    bool SetHomingResetPosition(bool bEnable) override;

    bool StartHomeMove(double dStartSpeed, double dMaxSpeed, double dAcc) override;

    bool StartContinuousMove(double dStartSpeed, double dMaxSpeed, double dAcc) override;

    bool StartSContinuousMove(double dStartSpeed, double dMaxSpeed, double dAcc, double dSAcc) override;

    bool StartAbsoluteMove(double dPosition, double dStartSpeed, double dMaxSpeed, double dAcc, double dDec) override;

    bool StartSAbsoluteMove(double dPosition, double dStartSpeed, double dMaxSpeed, double dAcc, double dDec, double dSAcc, double dSDec) override;

    bool StartRelativeMove(double dPosition, double dStartSpeed, double dMaxSpeed, double dAcc, double dDec) override;

    bool StartSRelativeMove(double dPosition, double dStartSpeed, double dMaxSpeed, double dAcc, double dDec, double dSAcc, double dSDec) override;

private:
    short m_sMtrNo;
};

#endif // !defined(AFX_MOTOR_8164_H__0A0D12D6_1862_4068_B8B4_EE93055E9BFA__INCLUDED_)
