00001 00002 #include "wireless_comm_signal.hpp" 00003 #include "sim_time.hpp" 00004 00005 WirelessCommSignal::WirelessCommSignal(const Location& location, 00006 double dbStrength, double wavelength, 00007 double transmitterGain, PacketPtr packet) 00008 : Signal(location, dbStrength), m_packetPtr(packet), 00009 m_wavelength(wavelength), m_transmitterGain(transmitterGain), 00010 m_channelId(m_DEFAULT_CHANNEL_ID) 00011 { 00012 assert(m_wavelength > 0.0); 00013 assert(m_transmitterGain > 0.0); 00014 assert(m_packetPtr.get() != 0); 00015 } 00016 00017 WirelessCommSignal::WirelessCommSignal(const WirelessCommSignal& rhs) 00018 : Signal(rhs), m_wavelength(rhs.m_wavelength), 00019 m_transmitterGain(rhs.m_transmitterGain), 00020 m_channelId(rhs.m_channelId) 00021 { 00022 m_packetPtr = Packet::create(*rhs.m_packetPtr); 00023 } 00024 00025 SignalPtr WirelessCommSignal::clone() const 00026 { 00027 SignalPtr p(new WirelessCommSignal(*this)); 00028 return p; 00029 } 00030 00031 SimTime WirelessCommSignal::getDuration() const 00032 { 00033 ConstPacketPtr packet = getPacketPtr(); 00034 assert(packet.get() != 0); 00035 return packet->getDuration(); 00036 } 00037 00038