شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

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