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

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;
   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 if (boardBver.Contains("H805GPFD")) boardVersion = "H805GPFD";
  77:                  else if (boardBver.Contains("H848ASNB")) boardVersion = "H848ASNB";
  78:                  else boardVersion = string.Empty;
  79:   
  80:                  return boardVersion;
  81:              }
  82:   
  83:              ////////////////////////////////////////////////////////////////////////////
  84:          }
  85:   
  86:          /// <summary/>
  87:          public Board() { }
  88:   
  89:          ////////////////////////////////////////////////////////////////////////////
  90:   
  91:          /// <summary>
  92:          ///
  93:          /// </summary>
  94:          public static string BoardId(int devId, int fn, int sn)
  95:          {
  96:              /*
  97:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  98:               * FN    SN   PN   ONTID
  99:               * 
 100:               * Dev: did
 101:               * Board: FN SN
 102:               * Port: FN SN PN
 103:               * Ont: FN SN PN ONTID
 104:               * 
 105:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
 106:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
 107:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
 108:               * /// 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. 
 109:               */
 110:   
 111:              string id;
 112:   
 113:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35)
 114:              {
 115:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0');
 116:              }
 117:              else
 118:              {
 119:                  throw new System.ArgumentOutOfRangeException("fn, sn", "fn or sn is out of range");
 120:              }
 121:   
 122:              return id;
 123:          }
 124:   
 125:          ////////////////////////////////////////////////////////////////////////////
 126:   
 127:          /// <summary>
 128:          ///
 129:          /// </summary>
 130:          public static Ia.Ngn.Cl.Model.Huawei.EmsBoard SequentialEmsBoardListItem(out int sequentialEmsBoardQueueCount, out string progressCounterString)
 131:          {
 132:              Ia.Ngn.Cl.Model.Huawei.EmsBoard item;
 133:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
 134:   
 135:              if (sequentialEmsBoardQueue.Count == 0)
 136:              {
 137:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Board.List();
 138:   
 139:                  sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>(list.Shuffle());
 140:   
 141:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsBoardQueue.Count;
 142:              }
 143:   
 144:              if (sequentialEmsBoardQueue.Count > 0) item = sequentialEmsBoardQueue.Dequeue();
 145:              else item = null;
 146:   
 147:              progressCounterString = "(" + sequentialEmsBoardQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
 148:   
 149:              sequentialEmsBoardQueueCount = sequentialEmsBoardQueue.Count;
 150:   
 151:              return item;
 152:          }
 153:   
 154:          ////////////////////////////////////////////////////////////////////////////
 155:          ////////////////////////////////////////////////////////////////////////////
 156:      }
 157:   
 158:      ////////////////////////////////////////////////////////////////////////////
 159:      ////////////////////////////////////////////////////////////////////////////
 160:  }