Exemple #1
0
        public override TXRESULT TryTx(Spectrum spectrum)
        {
            TXRESULT txResult;

            if (this.Access == -1)
            {
                txResult = TXRESULT.NOTX;
            }
            else
            {
                bool txCheckingResult = spectrum.CheckAndSetOccupancy(this.Access);
                if (txCheckingResult)
                {
                    spectrum.SetMessage(this.generateMessage(), this.Access);
                    txResult = TXRESULT.TXOK;
                    if (this.Access == this.lastAcess)
                    {
                        this.applyBonusAndPenalties(BonusAndPenalties.RHO);
                    }
                    else
                    {
                        this.applyBonusAndPenalties(BonusAndPenalties.SIGMA);
                    }
                }
                else
                {
                    spectrum.SetCollision(this.Access);
                    txResult = TXRESULT.COLLISION;
                    if (this.Access == this.lastAcess)
                    {
                        this.applyBonusAndPenalties(BonusAndPenalties.ALFA);
                    }
                    else
                    {
                        this.applyBonusAndPenalties(BonusAndPenalties.BETA);
                    }
                }
            }
            this.lastAcess = Access;
            return(txResult);
        }
Exemple #2
0
        public virtual TXRESULT TryTx(Spectrum spectrum)
        {
            TXRESULT txResult;

            if (this.Access <= 0)
            {
                txResult = TXRESULT.NOTX;
            }
            else
            {
                if (spectrum.CheckAndSetOccupancy(this.Access))
                {
                    spectrum.SetMessage(this.generateMessage(), this.Access);
                    txResult = TXRESULT.TXOK;
                }
                else
                {
                    spectrum.SetCollision(this.Access);
                    txResult = TXRESULT.COLLISION;
                }
            }

            return(txResult);
        }
Exemple #3
0
 public virtual TXRESULT TryTx(Spectrum spectrum)
 {
     TXRESULT txResult;
     if (this.Access <= 0)
     {
         txResult = TXRESULT.NOTX;
     }
     else
     {
         if (spectrum.CheckAndSetOccupancy(this.Access))
         {
             spectrum.SetMessage(this.generateMessage(), this.Access);
             txResult = TXRESULT.TXOK;
         }
         else
         {
             spectrum.SetCollision(this.Access);
             txResult = TXRESULT.COLLISION;
         }
     }
     
     return txResult;
 }
Exemple #4
0
 public override TXRESULT TryTx(Spectrum spectrum)
 {
     TXRESULT txResult;
     if (this.Access == -1)
     {
         txResult = TXRESULT.NOTX;
     }
     else
     {
         bool txCheckingResult = spectrum.CheckAndSetOccupancy(this.Access);
         if (txCheckingResult)
         {
             spectrum.SetMessage(this.generateMessage(), this.Access);
             txResult = TXRESULT.TXOK;
             if (this.Access == this.lastAcess)
             {
                 this.applyBonusAndPenalties(BonusAndPenalties.RHO);
             }
             else
             {
                 this.applyBonusAndPenalties(BonusAndPenalties.SIGMA);
             }
         }
         else
         {
             spectrum.SetCollision(this.Access);
             txResult = TXRESULT.COLLISION;
             if (this.Access == this.lastAcess)
             {
                 this.applyBonusAndPenalties(BonusAndPenalties.ALFA);
             }
             else
             {
                 this.applyBonusAndPenalties(BonusAndPenalties.BETA);
             }
         }
     }
     this.lastAcess = Access;
     return txResult;
 }