1 #include <RtcpConfig.h> 2 3 namespace android 4 { 5 6 namespace telephony 7 { 8 9 namespace imsmedia 10 { 11 12 /** Native representation of android.telephony.imsmedia.RtcpConfig */ RtcpConfig()13RtcpConfig::RtcpConfig() : 14 canonicalName(""), 15 transmitPort(0), 16 intervalSec(0), 17 rtcpXrBlockTypes(0) 18 { 19 } 20 RtcpConfig(const RtcpConfig & config)21RtcpConfig::RtcpConfig(const RtcpConfig& config) 22 { 23 this->canonicalName = String8(config.canonicalName.c_str()); 24 this->transmitPort = config.transmitPort; 25 this->intervalSec = config.intervalSec; 26 this->rtcpXrBlockTypes = config.rtcpXrBlockTypes; 27 } 28 ~RtcpConfig()29RtcpConfig::~RtcpConfig() {} 30 operator =(const RtcpConfig & config)31RtcpConfig& RtcpConfig::operator=(const RtcpConfig& config) 32 { 33 if (this != &config) 34 { 35 this->canonicalName = String8(config.canonicalName.c_str()); 36 this->transmitPort = config.transmitPort; 37 this->intervalSec = config.intervalSec; 38 this->rtcpXrBlockTypes = config.rtcpXrBlockTypes; 39 } 40 return *this; 41 } 42 operator ==(const RtcpConfig & config) const43bool RtcpConfig::operator==(const RtcpConfig& config) const 44 { 45 return (this->canonicalName == config.canonicalName && 46 this->transmitPort == config.transmitPort && this->intervalSec == config.intervalSec && 47 this->rtcpXrBlockTypes == config.rtcpXrBlockTypes); 48 } 49 operator !=(const RtcpConfig & config) const50bool RtcpConfig::operator!=(const RtcpConfig& config) const 51 { 52 return (this->canonicalName != config.canonicalName || 53 this->transmitPort != config.transmitPort || this->intervalSec != config.intervalSec || 54 this->rtcpXrBlockTypes != config.rtcpXrBlockTypes); 55 } 56 writeToParcel(Parcel * out) const57status_t RtcpConfig::writeToParcel(Parcel* out) const 58 { 59 status_t err; 60 if (out == nullptr) 61 { 62 return BAD_VALUE; 63 } 64 65 String16 name(canonicalName); 66 err = out->writeString16(name); 67 if (err != NO_ERROR) 68 { 69 return err; 70 } 71 72 err = out->writeInt32(transmitPort); 73 if (err != NO_ERROR) 74 { 75 return err; 76 } 77 78 err = out->writeInt32(intervalSec); 79 if (err != NO_ERROR) 80 { 81 return err; 82 } 83 84 err = out->writeInt32(rtcpXrBlockTypes); 85 if (err != NO_ERROR) 86 { 87 return err; 88 } 89 90 return NO_ERROR; 91 } 92 readFromParcel(const Parcel * in)93status_t RtcpConfig::readFromParcel(const Parcel* in) 94 { 95 status_t err; 96 if (in == nullptr) 97 { 98 return BAD_VALUE; 99 } 100 101 String16 name; 102 err = in->readString16(&name); 103 if (err != NO_ERROR) 104 { 105 return err; 106 } 107 108 canonicalName = String8(name.c_str()); 109 110 err = in->readInt32(&transmitPort); 111 if (err != NO_ERROR) 112 { 113 return err; 114 } 115 116 err = in->readInt32(&intervalSec); 117 if (err != NO_ERROR) 118 { 119 return err; 120 } 121 122 err = in->readInt32(&rtcpXrBlockTypes); 123 if (err != NO_ERROR) 124 { 125 return err; 126 } 127 128 return NO_ERROR; 129 } 130 setCanonicalName(const String8 & name)131void RtcpConfig::setCanonicalName(const String8& name) 132 { 133 canonicalName = name; 134 } 135 getCanonicalName()136String8 RtcpConfig::getCanonicalName() 137 { 138 return canonicalName; 139 } 140 setTransmitPort(const int32_t port)141void RtcpConfig::setTransmitPort(const int32_t port) 142 { 143 transmitPort = port; 144 } 145 getTransmitPort()146int32_t RtcpConfig::getTransmitPort() 147 { 148 return transmitPort; 149 } 150 setIntervalSec(const int32_t interval)151void RtcpConfig::setIntervalSec(const int32_t interval) 152 { 153 intervalSec = interval; 154 } 155 getIntervalSec()156int32_t RtcpConfig::getIntervalSec() 157 { 158 return intervalSec; 159 } 160 setRtcpXrBlockTypes(const int32_t type)161void RtcpConfig::setRtcpXrBlockTypes(const int32_t type) 162 { 163 rtcpXrBlockTypes = type; 164 } 165 getRtcpXrBlockTypes()166int32_t RtcpConfig::getRtcpXrBlockTypes() 167 { 168 return rtcpXrBlockTypes; 169 } 170 setDefaultRtcpConfig()171void RtcpConfig::setDefaultRtcpConfig() 172 { 173 canonicalName = android::String8(""); 174 transmitPort = kTransmitPort; 175 intervalSec = kIntervalSec; 176 rtcpXrBlockTypes = kRtcpXrBlockTypes; 177 } 178 179 } // namespace imsmedia 180 181 } // namespace telephony 182 183 } // namespace android