src/devices/uan/model/uan-phy-dual.cc
changeset 6715 ba60c821ad35
parent 6478 b401db8531f5
equal deleted inserted replaced
6714:5f772405b80c 6715:ba60c821ad35
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17  *
    17  *
    18  * Author: Leonard Tracy <lentracy@gmail.com>
    18  * Author: Leonard Tracy <lentracy@gmail.com>
       
    19  *         Andrea Sacco <andrea.sacco85@gmail.com>
    19  */
    20  */
    20 
    21 
    21 #include "uan-phy.h"
    22 #include "uan-phy.h"
    22 #include "uan-phy-dual.h"
    23 #include "uan-phy-dual.h"
    23 #include "uan-phy-gen.h"
    24 #include "uan-phy-gen.h"
   232 
   233 
   233   return tid;
   234   return tid;
   234 }
   235 }
   235 
   236 
   236 void
   237 void
       
   238 UanPhyDual::SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback callback)
       
   239 {
       
   240   NS_LOG_DEBUG ("Not Implemented");
       
   241 }
       
   242 
       
   243 void
       
   244 UanPhyDual::EnergyDepletionHandler ()
       
   245 {
       
   246   NS_LOG_DEBUG ("Not Implemented");
       
   247 }
       
   248 
       
   249 void
   237 UanPhyDual::SendPacket (Ptr<Packet> pkt, uint32_t modeNum)
   250 UanPhyDual::SendPacket (Ptr<Packet> pkt, uint32_t modeNum)
   238 {
   251 {
   239   if (modeNum <= m_phy1->GetNModes () - 1)
   252   if (modeNum <= m_phy1->GetNModes () - 1)
   240     {
   253     {
   241       NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Sending packet on Phy1 with mode number " << modeNum);
   254       NS_LOG_DEBUG (Simulator::Now ().GetSeconds () << " Sending packet on Phy1 with mode number " << modeNum);
   441 bool
   454 bool
   442 UanPhyDual::IsPhy2Tx (void)
   455 UanPhyDual::IsPhy2Tx (void)
   443 {
   456 {
   444   return m_phy2->IsStateTx ();
   457   return m_phy2->IsStateTx ();
   445 }
   458 }
   446 
   459 bool
       
   460 UanPhyDual::IsStateSleep (void)
       
   461 {
       
   462   return m_phy1->IsStateSleep () && m_phy2->IsStateSleep ();
       
   463 }
   447 bool
   464 bool
   448 UanPhyDual::IsStateIdle (void)
   465 UanPhyDual::IsStateIdle (void)
   449 {
   466 {
   450   return m_phy1->IsStateIdle () && m_phy2->IsStateIdle ();
   467   return m_phy1->IsStateIdle () && m_phy2->IsStateIdle ();
   451 }
   468 }
   452 bool
   469 bool
   453 UanPhyDual::IsStateBusy (void)
   470 UanPhyDual::IsStateBusy (void)
   454 {
   471 {
   455   return !IsStateIdle ();
   472   return !IsStateIdle () || !IsStateSleep ();
   456 }
   473 }
   457 bool
   474 bool
   458 UanPhyDual::IsStateRx (void)
   475 UanPhyDual::IsStateRx (void)
   459 {
   476 {
   460   return m_phy1->IsStateRx () || m_phy2->IsStateRx ();
   477   return m_phy1->IsStateRx () || m_phy2->IsStateRx ();