using FLY.Thick.Base.Common;
using FObjBase;
using FObjBase.Reflect;
using Misc;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FLY.Thick.FilmCasting.IService
{
    public interface IBoltMapFilmCastingService: INotifyPropertyChanged
    {
        #region 设定
        /// <summary>
        /// 螺丝宽度 mm, 是double, 那就可以设置英寸
        /// </summary>
        double BoltWidth { get; set; }

        /// <summary>
        /// 总螺丝数 
        /// </summary>
        int BoltCnt { get; set; }

        /// <summary>
        /// 与机架方向相反
        /// </summary>
        bool IsReversed { get; set; }

        /// <summary>
        /// 平滑，以前后分区平均滤波 ，=0，只有自己，1，左右各一个
        /// </summary>
        int Smooth { get; set; }

        #endregion



        #region 状态

        /// <summary>
        /// 左单边不工作螺丝位
        /// </summary>
        int LeftEmptyBolts { get; }

        /// <summary>
        /// 右单边不工作螺丝位
        /// </summary>
        int RightEmptyBolts { get; }

        /// <summary>
        /// 收缩率  Uniform(均匀区)Shrink(收缩)Percent(比例)
        /// </summary>
        double UniformShrinkPercent { get; }

        /// <summary>
        /// 膜中心位置偏移 mm
        /// </summary>
        int MidOffset { get; }

        /// <summary>
        /// 总分区数
        /// </summary>
        int NBolts { get; }

        /// <summary>
        /// 第1个分区号
        /// </summary>
        int FirstBoltNo { get; }

        #endregion

        /// <summary>
        /// 调试数据更新时间
        /// </summary>
        DateTime DebugUpdate { get; }

        /// <summary>
        /// 获取调试数据
        /// </summary>
        /// <param name="asyncDelegate"></param>
        /// <param name="asyncContext"></param>
        [Call(typeof(BoltMapFilmCastingDebugData))]
        void GetDebugData(AsyncCBHandler asyncDelegate, object asyncContext);

        /// <summary>
        /// 应用
        /// </summary>
        void Apply();
    }

    /// <summary>
    /// 
    /// </summary>
    public class BoltMapFilmCastingDebugData
    {
        /// <summary>
        /// 1个grid多少个脉冲
        /// </summary>
        public int posOfGrid { get; set; }
        /// <summary>
        /// 开始脉冲
        /// </summary>
        public int posBegin { get; set; }
        /// <summary>
        /// 数据
        /// </summary>
        public double[] buf { get; set; }
        /// <summary>
        /// 边界
        /// </summary>
        public RangeStruct border { get; set; }
    }
}
