using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FObjBase;

namespace FLY.Simulation.Flyad7.OBJProxy
{

    class FLYADC:FObj
    {
        FLYAD7 Data;
        public FLYADC(int objsys_idx, FLYAD7 data):base(objsys_idx)
        {
            ID = FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.ID;
            Data = data;
        }
        public override void GetValue(IFConn from, uint srcid, ushort memid, out byte[] infodata)
        {
            infodata = null;
            switch (memid) 
            {
                case FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.GET_POS1AD1:
                    {
                        FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.Pack_GetPos1AD1 pack = new FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.Pack_GetPos1AD1();
                        pack.ad = Data.AD;
                        pack.pos = Data.Position;
                        pack.speed = Data.Speed;
                        infodata = pack.ToBytes();
                    }break;
                case FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.GET_POS2:
                    {
                        FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.Pack_GetPos2 pack = new FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.Pack_GetPos2();
                        pack.pos2 = 0;
                        pack.speed2 = 0;
                        infodata = pack.ToBytes();
                    }break;
                case FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.GET_AD2:
                    {
                        FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.Pack_GetAD2 pack = new FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.Pack_GetAD2();
                        pack.AD = 0;
                        infodata = pack.ToBytes();
                    }break;
            }
        }
        public override void CallFunction(IFConn from, uint srcid, uint magic, ushort funcid, byte[] infodata)
        {
            switch (funcid) 
            {
                case FLYAD7_OBJ_INTERFACE.FLYADC_OBJ_INTERFACE.CALL_RESETPOS:
                    Data.PositionOrg = 0;
                    break;
            }
        }
    }
}
