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:          /// <summary/>
  35:          public Board() { }
  36:   
  37:          ////////////////////////////////////////////////////////////////////////////
  38:   
  39:          /// <summary>
  40:          ///
  41:          /// </summary>
  42:          public static string BoardId(int devId, int fn, int sn)
  43:          {
  44:              /*
  45:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  46:               * FN    SN   PN   ONTID
  47:               * 
  48:               * Dev: did
  49:               * Board: FN SN
  50:               * Port: FN SN PN
  51:               * Ont: FN SN PN ONTID
  52:               * 
  53:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
  54:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
  55:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
  56:               * /// 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. 
  57:               */
  58:   
  59:              string id;
  60:   
  61:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35)
  62:              {
  63:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0');
  64:              }
  65:              else
  66:              {
  67:                  throw new System.ArgumentOutOfRangeException("fn, sn", "fn or sn is out of range");
  68:              }
  69:   
  70:              return id;
  71:          }
  72:   
  73:          ////////////////////////////////////////////////////////////////////////////
  74:   
  75:          /// <summary>
  76:          ///
  77:          /// </summary>
  78:          public static Ia.Ngn.Cl.Model.Huawei.EmsBoard SequentialEmsBoardListItem(out int sequentialEmsBoardQueueCount, out string progressCounterString)
  79:          {
  80:              Ia.Ngn.Cl.Model.Huawei.EmsBoard item;
  81:              List<Ia.Ngn.Cl.Model.Huawei.EmsBoard> list;
  82:   
  83:              if (sequentialEmsBoardQueue.Count == 0)
  84:              {
  85:                  list = Ia.Ngn.Cl.Model.Data.Huawei.Board.List();
  86:   
  87:                  sequentialEmsBoardQueue = new Queue<Ia.Ngn.Cl.Model.Huawei.EmsBoard>(list);
  88:   
  89:                  sequentialEmsDevDevQueueOriginalCount = sequentialEmsBoardQueue.Count;
  90:              }
  91:   
  92:              if (sequentialEmsBoardQueue.Count > 0) item = sequentialEmsBoardQueue.Dequeue();
  93:              else item = null;
  94:   
  95:              progressCounterString = "(" + sequentialEmsBoardQueue.Count + "/" + sequentialEmsDevDevQueueOriginalCount + ")";
  96:   
  97:              sequentialEmsBoardQueueCount = sequentialEmsBoardQueue.Count;
  98:   
  99:              return item;
 100:          }
 101:   
 102:          ////////////////////////////////////////////////////////////////////////////
 103:          ////////////////////////////////////////////////////////////////////////////
 104:      }
 105:   
 106:      ////////////////////////////////////////////////////////////////////////////
 107:      ////////////////////////////////////////////////////////////////////////////
 108:  }