• 快速入门
  • HTTP文档
  • .NET开发指南
  • DEMO下载
  • 调用HTTP常见问题
    Show / Hide Table of Contents
    • 快速开始
      • 引入依赖包
      • 初始化
      • 开启FBox所有监控点
      • 盒子状态变更推送
      • 实时数据变更推送
      • 获取盒子信息与盒子分组
      • 获取监控点分组与监控点
      • 写值
    • 驱动操作
      • 获取盒子PLC
      • 下载盒子plc
    • 监控点操作
      • 新增监控点条目
      • 更新及删除监控点
    • 报警操作
      • 获取盒子下所有报警条目
      • 获取报警历史记录数据
      • 新增报警条目
      • 更新及删除报警条目
    • 历史操作
      • 获取历史记录数据
      • 获取历史记录条目
      • 新增历史记录条目
      • 更新及删除历史记录条目

    获取盒子监控点分组和监控点条目

    /// <summary>
    /// 获取盒子监控点分组和监控点条目
    /// </summary>
    /// <returns></returns>
    public IList<DmonItemDtoV2> GetDmonGroups()
    {
        var dmonGrps = _fbox.GetDmonGroupDmonsV2(new BoxArgs(boxNo)).Result;
        foreach (var grp in dmonGrps)
        {
            Console.WriteLine(grp.Id);          // 监控点分组的Id
            Console.WriteLine(grp.Name);        // 监控点分组的名称
            foreach (var item in grp.Items)     // 遍历当前分组grp下所有的监控点条目
            {
                Console.WriteLine(item.Id);     //监控点Id
                Console.WriteLine(item.Name);   //监控点名称
                Console.WriteLine(item.DevAlias); //PLC别名
                Console.WriteLine(item.StationNo); //站号
                Console.WriteLine(item.IsDeviceChanged);//设备是否被移除(只有在移除时出现该参数,为true)FBox的连接设备変更后会出现该参数
                Console.WriteLine(item.TaskState);  //条目状态
                Console.WriteLine(item.DeadValue);  //死值区
                Console.WriteLine(item.BitIndex);   //按位索引号
                Console.WriteLine(item.BitIndexEnabled);//是否启用按位索引号
                Console.WriteLine(item.BitStateLabel);//位类型数据标签
                Console.WriteLine(item.CharCount);  //字符个数
                Console.WriteLine(item.DataType);   //数据类型
                Console.WriteLine(item.Encoding);   //编码方式
                Console.WriteLine(item.FractionalDigits);//小数位
                Console.WriteLine(item.GroupId);    //监控点分组
                Console.WriteLine(item.GroupName);  //监控点名称
                Console.WriteLine(item.IntegralDigits);//整数位(目前无作用)
                Console.WriteLine(item.IoWidth);    //寄存器位宽
                Console.WriteLine(item.MainAddress);//主地址
                Console.WriteLine(item.Memo);       //备注
                Console.WriteLine(item.Privilege);  //读写模式
                Console.WriteLine(item.RegId);      //寄存器Id
                Console.WriteLine(item.RegName);    //寄存器名称
                Console.WriteLine(item.StringByteOrder);//字节序
                Console.WriteLine(item.SubAddress); //子地址
                Console.WriteLine(item.SubIndex);   //DB块地址
                Console.WriteLine(item.TrafficSaving);//是否开启省流量模式
                Console.WriteLine(item.Unit);       //单位
                Console.WriteLine(item.ValueTransform);//数据运算
            }
        }
        return dmonGrps.SelectMany(x => x.Items).ToArray();//监控点条目集合
    }
    //在Program,Main函数中调用
    class Program
        {
            static void Main(string[] args)
            {
                using (var fbox = new FBoxDemo())
                {
                    fbox.Start();  //启动
                    fbox.StartAllDMonData();//开启FBox所有监控点
                    fbox.GetDmonGroups();//调用此方法
                }
            }
        }
    
    Back to top Generated by DocFX