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

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