Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » Board

Public general use code classes and xml files that we've compiled and used over the years:

Huawei's Board support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.Web.Security;
   6:  using System.Text.RegularExpressions;
   7:   
   8:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Huawei's Board support class of Next Generation Network'a (NGN's) business model.
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2016-2018 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  18:      ///
  19:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  20:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  21:      ///
  22:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  23:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  24:      /// 
  25:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  26:      /// 
  27:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  28:      /// </remarks> 
  29:      public partial class Board
  30:      {
  31:          private static int sequentialEmsDevDevQueueOriginalCount;
  32:          private static Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard> sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>();
  33:   
  34:          ////////////////////////////////////////////////////////////////////////////
  35:   
  36:          /// <summary>
  37:          ///
  38:          /// </summary>
  39:          public class MduDevBoard
  40:          {
  41:              public string Type;
  42:              public string Version;
  43:              public int Fn;
  44:              public int Sn;
  45:              public Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentType EquipmentType;
  46:   
  47:              ////////////////////////////////////////////////////////////////////////////
  48:   
  49:              /// <summary>
  50:              ///
  51:              /// </summary>
  52:              public MduDevBoard(string type, string boardBver, int fn, int sn)
  53:              {
  54:                  string version;
  55:   
  56:                  version = ExtractBoardVersionFromBoardBver(boardBver);
  57:   
  58:                  this.Type = type;
  59:                  this.Version = version;
  60:                  this.Fn = fn;
  61:                  this.Sn = sn;
  62:                  this.EquipmentType = Ia.Ngn.Cl.Model.Business.Huawei.Ont.EquipmentTypeFromBoardPstnMainBoardVersionString(version);
  63:              }
  64:   
  65:              ////////////////////////////////////////////////////////////////////////////
  66:   
  67:              /// <summary>
  68:              ///
  69:              /// </summary>
  70:              private string ExtractBoardVersionFromBoardBver(string boardBver)
  71:              {
  72:                  string boardVersion;
  73:   
  74:                  if (boardBver.Contains("H838ASRB")) boardVersion = "H838ASRB";
  75:                  else if (boardBver.Contains("H838ASPB")) boardVersion = "H838ASPB";
  76:                  else boardVersion = string.Empty;
  77:   
  78:                  return boardVersion;
  79:              }
  80:   
  81:              ////////////////////////////////////////////////////////////////////////////
  82:          }
  83:   
  84:          /// <summary/>
  85:          public Board() { }
  86:   
  87:          ////////////////////////////////////////////////////////////////////////////
  88:   
  89:          /// <summary>
  90:          ///
  91:          /// </summary>
  92:          public static string BoardId(int devId, int fn, int sn)
  93:          {
  94:              /*
  95:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  96:               * FN    SN   PN   ONTID
  97:               * 
  98:               * Dev: did
  99:               * Board: FN SN
 100:               * Port: FN SN PN
 101:               * Ont: FN SN PN ONTID
 102:               * 
 103:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 104:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 105:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 106:               * /// ONTID INTEGER 0-255 NOTE If the UNI port is of 10G GPON, the value range is 0-255; if the UNI port is of 1G GPON, the value range is 0-127. Indicates the ONT ID. 
 107:               */
 108:   
 109:              string id;
 110:   
 111:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35)
 112:              {
 113:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0');
 114:              }
 115:              else
 116:              {
 117:                  throw new System.ArgumentOutOfRangeException("fn, sn", "fn or sn is out of range");
 118:              }
 119:   
 120:              return id;
 121:          }
 122:   
 123:          ////////////////////////////////////////////////////////////////////////////
 124:   
 125:          /// <summary>
 126:          ///
 127:          /// </summary>
 128:          public static Ia.Ngn.Cl.Model.Huawei.EmsBoard SequentialEmsBoardListItem(out int sequentialEmsBoardQueueCount, out string progressCounterString)
 129:          {
 130:              Ia.Ngn.Cl.Model.Huawei.EmsBoard item;
 131:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
 132:   
 133:              if (sequentialEmsBoardQueue.Count == 0)
 134:              {
 135:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Board.List();
 136:   
 137:                  sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>(list);
 138:   
 139:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsBoardQueue.Count;
 140:              }
 141:   
 142:              if (sequentialEmsBoardQueue.Count > 0) item = sequentialEmsBoardQueue.Dequeue();
 143:              else item = null;
 144:   
 145:              progressCounterString = "(" + sequentialEmsBoardQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
 146:   
 147:              sequentialEmsBoardQueueCount = sequentialEmsBoardQueue.Count;
 148:   
 149:              return item;
 150:          }
 151:   
 152:          ////////////////////////////////////////////////////////////////////////////
 153:          ////////////////////////////////////////////////////////////////////////////
 154:      }
 155:   
 156:      ////////////////////////////////////////////////////////////////////////////
 157:      ////////////////////////////////////////////////////////////////////////////
 158:  }