123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792 |
- <?php
- namespace StatsBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
- use Symfony\Component\Validator\Constraints as Assert;
- use JMS\Serializer\Annotation as JMS;
- use Base\AdminBundle\Traits\TenancyIdTrait;
- use Base\AdminBundle\Traits\TenancyIdTraitInterface;
- /**
- * @ORM\Table
- * @ORM\Entity(repositoryClass="StatsBundle\Repository\CablemodemRepository")
- * @UniqueEntity(fields={"deviceServer", "cmtsDeviceId", "mac"}, message="errors.duplicate_key")
- * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"device_server_id", "cmts_device_id", "mac"})})
- */
- class Cablemodem implements TenancyIdTraitInterface
- {
- use ExtraDataTrait;
- use TenancyIdTrait;
-
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer", nullable=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $cmtsDeviceId;
- /**
- * @ORM\ManyToOne(targetEntity="DeviceServer", inversedBy="devices", fetch="EXTRA_LAZY")
- *
- * @JMS\MaxDepth(1)
- */
- protected $deviceServer;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $deviceId;
-
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=255, nullable=true)
- *
- * @Assert\Ip
- */
- private $ip;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=12, nullable=true)
- */
- private $mac;
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- private $index;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- private $upIf;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- private $downIf;
- /**
- * @ORM\Column(name="status", type="boolean", nullable=true, columnDefinition="BOOLEAN DEFAULT FALSE")
- */
- public $status = false;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $txPower;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $rxPower;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $signal;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $microreflection;
-
- /**
- * @ORM\Column(type="integer", nullable=true, columnDefinition="integer unsigned")
- */
- public $correcteds;
-
- /**
- * @ORM\Column(type="integer", nullable=true, columnDefinition="integer unsigned")
- */
- public $unerroreds;
-
- /**
- * @ORM\Column(type="integer", nullable=true, columnDefinition="integer unsigned")
- */
- public $uncorrectables;
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- public $uptime;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $updated;
- /**
- * @ORM\Column(type="decimal", precision=10, scale=7, nullable=true)
- */
- public $lat;
-
- /**
- * @ORM\Column(type="decimal", precision=10, scale=7, nullable=true)
- */
- public $lng;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $rxPowerCmts;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $signalCmts;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $microreflectionCmts;
- /**
- * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true, options={"comment":"Bandwidth in b/s"})
- */
- public $inOctets;
-
- /**
- * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true, options={"comment":"Bandwidth in b/s"})
- */
- public $outOctets;
- /**
- * Get id
- *
- * @return integer
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Set cmtsDeviceId
- *
- * @param integer $cmtsDeviceId
- *
- * @return Cablemodem
- */
- public function setCmtsDeviceId($cmtsDeviceId)
- {
- $this->cmtsDeviceId = $cmtsDeviceId;
- return $this;
- }
- /**
- * Get cmtsDeviceId
- *
- * @return integer
- */
- public function getCmtsDeviceId()
- {
- return $this->cmtsDeviceId;
- }
- /**
- * Set deviceId
- *
- * @param integer $deviceId
- *
- * @return Cablemodem
- */
- public function setDeviceId($deviceId)
- {
- $this->deviceId = $deviceId;
- return $this;
- }
- /**
- * Get deviceId
- *
- * @return integer
- */
- public function getDeviceId()
- {
- return $this->deviceId;
- }
- /**
- * Set ip
- *
- * @param string $ip
- *
- * @return Cablemodem
- */
- public function setIp($ip)
- {
- $this->ip = $ip;
- return $this;
- }
- /**
- * Get ip
- *
- * @return string
- */
- public function getIp()
- {
- return $this->ip;
- }
- /**
- * Set mac
- *
- * @param string $mac
- *
- * @return Cablemodem
- */
- public function setMac($mac)
- {
- $this->mac = $mac;
- return $this;
- }
- /**
- * Get mac
- *
- * @return string
- */
- public function getMac()
- {
- return strtoupper($this->mac);
- }
- /**
- * Set index
- *
- * @param string $index
- *
- * @return Cablemodem
- */
- public function setIndex($index)
- {
- $this->index = $index;
- return $this;
- }
- /**
- * Get index
- *
- * @return string
- */
- public function getIndex()
- {
- return $this->index;
- }
- /**
- * Set upIf
- *
- * @param string $upIf
- *
- * @return Cablemodem
- */
- public function setUpIf($upIf)
- {
- $this->upIf = $upIf;
- return $this;
- }
- /**
- * Get upIf
- *
- * @return string
- */
- public function getUpIf()
- {
- return $this->upIf;
- }
- /**
- * Set downIf
- *
- * @param string $downIf
- *
- * @return Cablemodem
- */
- public function setDownIf($downIf)
- {
- $this->downIf = $downIf;
- return $this;
- }
- /**
- * Get downIf
- *
- * @return string
- */
- public function getDownIf()
- {
- return $this->downIf;
- }
- /**
- * Set status
- *
- * @param boolean $status
- *
- * @return Cablemodem
- */
- public function setStatus($status)
- {
- $this->status = $status;
- return $this;
- }
- /**
- * Get status
- *
- * @return boolean
- */
- public function getStatus()
- {
- return $this->status;
- }
- /**
- * Set txPower
- *
- * @param string $txPower
- *
- * @return Cablemodem
- */
- public function setTxPower($txPower)
- {
- $this->txPower = $txPower;
- return $this;
- }
- /**
- * Get txPower
- *
- */
- public function getTxPower()
- {
- return $this->txPower;
- }
- /**
- * Set rxPower
- *
- * @param string $rxPower
- *
- * @return Cablemodem
- */
- public function setRxPower($rxPower)
- {
- $this->rxPower = $rxPower;
- return $this;
- }
- /**
- * Get rxPower
- *
- * @return string
- */
- public function getRxPower()
- {
- return $this->rxPower;
- }
- /**
- * Set signal
- *
- * @param string $signal
- *
- * @return Cablemodem
- */
- public function setSignal($signal)
- {
- $this->signal = $signal;
- return $this;
- }
- /**
- * Get signal
- *
- */
- public function getSignal()
- {
- return $this->signal;
- }
- /**
- * Set microreflection
- *
- * @param string $microreflection
- *
- * @return Cablemodem
- */
- public function setMicroreflection($microreflection)
- {
- $this->microreflection = $microreflection;
- return $this;
- }
- /**
- * Get microreflection
- *
- */
- public function getMicroreflection()
- {
- return $this->microreflection;
- }
- /**
- * Set correcteds
- *
- * @param integer $correcteds
- *
- * @return Cablemodem
- */
- public function setCorrecteds($correcteds)
- {
- $this->correcteds = $correcteds;
- return $this;
- }
- /**
- * Get correcteds
- *
- * @return integer
- */
- public function getCorrecteds()
- {
- return $this->correcteds;
- }
- /**
- * Set unerroreds
- *
- * @param integer $unerroreds
- *
- * @return Cablemodem
- */
- public function setUnerroreds($unerroreds)
- {
- $this->unerroreds = $unerroreds;
- return $this;
- }
- /**
- * Get unerroreds
- *
- * @return integer
- */
- public function getUnerroreds()
- {
- return $this->unerroreds;
- }
- /**
- * Set uncorrectables
- *
- * @param integer $uncorrectables
- *
- * @return Cablemodem
- */
- public function setUncorrectables($uncorrectables)
- {
- $this->uncorrectables = $uncorrectables;
- return $this;
- }
- /**
- * Get uncorrectables
- *
- * @return integer
- */
- public function getUncorrectables()
- {
- return $this->uncorrectables;
- }
- /**
- * Set uptime
- *
- * @param string $uptime
- *
- * @return Cablemodem
- */
- public function setUptime($uptime)
- {
- $this->uptime = $uptime;
- return $this;
- }
- /**
- * Get uptime
- *
- * @return string
- */
- public function getUptime()
- {
- return $this->uptime;
- }
- /**
- * Set updated
- *
- * @param \DateTime $updated
- *
- * @return Cablemodem
- */
- public function setUpdated($updated)
- {
- $this->updated = $updated;
- return $this;
- }
- /**
- * Get updated
- *
- * @return \DateTime
- */
- public function getUpdated()
- {
- return $this->updated;
- }
- /**
- * Set lat
- *
- * @param string $lat
- *
- * @return Cablemodem
- */
- public function setLat($lat)
- {
- $this->lat = $lat;
- return $this;
- }
- /**
- * Get lat
- *
- * @return string
- */
- public function getLat()
- {
- return (double) $this->lat;
- }
- /**
- * Set lng
- *
- * @param string $lng
- *
- * @return Cablemodem
- */
- public function setLng($lng)
- {
- $this->lng = $lng;
- return $this;
- }
- /**
- * Get lng
- *
- * @return string
- */
- public function getLng()
- {
- return (double) $this->lng;
- }
- /**
- * Set deviceServer
- *
- * @param \StatsBundle\Entity\DeviceServer $deviceServer
- *
- * @return Cablemodem
- */
- public function setDeviceServer(\StatsBundle\Entity\DeviceServer $deviceServer = null)
- {
- $this->deviceServer = $deviceServer;
- return $this;
- }
- /**
- * Get deviceServer
- *
- * @return \StatsBundle\Entity\DeviceServer
- */
- public function getDeviceServer()
- {
- return $this->deviceServer;
- }
- /**
- * Set rxPowerCmts
- *
- * @param string $rxPowerCmts
- *
- * @return Cablemodem
- */
- public function setRxPowerCmts($rxPowerCmts)
- {
- $this->rxPowerCmts = $rxPowerCmts;
- return $this;
- }
- /**
- * Get rxPowerCmts
- *
- * @return string
- */
- public function getRxPowerCmts()
- {
- return $this->rxPowerCmts;
- }
- /**
- * Set signalCmts
- *
- * @param string $signalCmts
- *
- * @return Cablemodem
- */
- public function setSignalCmts($signalCmts)
- {
- $this->signalCmts = $signalCmts;
- return $this;
- }
- /**
- * Get signalCmts
- *
- */
- public function getSignalCmts()
- {
- return $this->signalCmts;
- }
- /**
- * Set microreflectionCmts
- *
- * @param string $microreflectionCmts
- *
- * @return Cablemodem
- */
- public function setMicroreflectionCmts($microreflectionCmts)
- {
- $this->microreflectionCmts = $microreflectionCmts;
- return $this;
- }
- /**
- * Get microreflectionCmts
- *
- */
- public function getMicroreflectionCmts()
- {
- return $this->microreflectionCmts;
- }
- /**
- * @return string
- */
- public function getCustomId()
- {
- return sprintf('%s~%s~%s', strtolower($this->mac), $this->cmtsDeviceId, $this->deviceServer->getId());
- }
- /**
- * @return string
- */
- public function __toString()
- {
- return sprintf('%s', strtoupper($this->mac));
- }
- /**
- * Set inOctets
- *
- * @param float $inOctets
- *
- * @return Cablemodem
- */
- public function setInOctets($inOctets)
- {
- $this->inOctets = $inOctets;
- return $this;
- }
- /**
- * Get inOctets
- *
- * @return float
- */
- public function getInOctets()
- {
- return (float) $this->inOctets;
- }
- /**
- * Set outOctets
- *
- * @param float $outOctets
- *
- * @return Cablemodem
- */
- public function setOutOctets($outOctets)
- {
- $this->outOctets = $outOctets;
- return $this;
- }
- /**
- * Get outOctets
- *
- * @return float
- */
- public function getOutOctets()
- {
- return (float) $this->outOctets;
- }
- }
|