示例#1
0
        /// <summary>
        /// Gets the command node text.
        /// </summary>
        private string GetCmdNodeText(CmdConfig cmd)
        {
            string cmdName   = string.IsNullOrEmpty(cmd.Name) ? ModbusDriverPhrases.UnnamedCommand : cmd.Name;
            string blockName = ModbusUtils.GetDataBlockName(cmd.DataBlock);

            if (cmd.DataBlock == DataBlock.Custom)
            {
                return(string.Format("{0} ({1})", cmdName, blockName));
            }
            else
            {
                string addrRange = ModbusUtils.GetAddressRange(cmd.Address,
                                                               cmd.ElemCnt * ModbusUtils.GetQuantity(cmd.ElemType),
                                                               template.Options.ZeroAddr, template.Options.DecAddr);
                return(string.Format("{0} ({1}, {2})", cmdName, blockName, addrRange));
            }
        }
示例#2
0
 /// <summary>
 /// Gets the command node text.
 /// </summary>
 private static string GetElemGroupNodeText(ElemGroupConfig elemGroup)
 {
     return(string.Format("{0} ({1})",
                          string.IsNullOrEmpty(elemGroup.Name) ? ModbusDriverPhrases.UnnamedElemGroup : elemGroup.Name,
                          ModbusUtils.GetDataBlockName(elemGroup.DataBlock)));
 }