<?php
namespace App\Entity;
use App\Repository\DeviceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=DeviceRepository::class)
*/
class Device
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $idClient;
/**
* @ORM\Column(type="string", length=255)
*/
private $libelleClient;
/**
* @ORM\Column(type="string", length=255)
*/
private $numeroSerie;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $voltage;
/**
* @ORM\Column(type="date")
*/
private $dateActivation;
/**
* @ORM\Column(type="integer")
*/
private $isBonEtat = 1;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $pourcentageBatterie;
/**
* @ORM\ManyToOne(targetEntity=Modele::class, inversedBy="devices")
* @ORM\JoinColumn(nullable=false)
*/
private $modele;
/**
* @ORM\ManyToOne(targetEntity=Scenario::class, inversedBy="devices")
* @ORM\JoinColumn(nullable=false)
*/
private $scenario;
/**
* @ORM\Column(type="string", length=255)
* @Assert\Length(
* min = 16,
* max = 16,
* exactMessage = "Le code PAC doit être de {{ limit }} caractères")
*/
private $pac;
/**
* @ORM\OneToMany(targetEntity=DataUplinks::class, mappedBy="device")
*/
private $messagesUplinks;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $linkQuality;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateDerniereCommunication;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ville;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $libelle;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $delaiLimite;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $triggerAlert;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $devEUI;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $gatewayPath;
public function __construct()
{
$this->messagesUplinks = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLibelleClient(): ?string
{
return $this->libelleClient;
}
public function setLibelleClient(string $libelleClient): self
{
$this->libelleClient = $libelleClient;
return $this;
}
public function getNumeroSerie(): ?string
{
return $this->numeroSerie;
}
public function setNumeroSerie(string $numeroSerie): self
{
$this->numeroSerie = $numeroSerie;
return $this;
}
public function getVoltage(): ?float
{
return $this->voltage;
}
public function setVoltage(float $voltage): self
{
$this->voltage = $voltage;
return $this;
}
public function getDateActivation(): ?\DateTimeInterface
{
return $this->dateActivation;
}
public function setDateActivation(\DateTimeInterface $dateActivation): self
{
$this->dateActivation = $dateActivation;
return $this;
}
public function getIsBonEtat(): ?int
{
return $this->isBonEtat;
}
public function setIsBonEtat(int $isBonEtat): self
{
$this->isBonEtat = $isBonEtat;
return $this;
}
public function getPourcentageBatterie(): ?int
{
return $this->pourcentageBatterie;
}
public function setPourcentageBatterie(?int $pourcentageBatterie): self
{
$this->pourcentageBatterie = $pourcentageBatterie;
return $this;
}
public function getModele(): ?Modele
{
return $this->modele;
}
public function setModele(?Modele $modele): self
{
$this->modele = $modele;
return $this;
}
public function getScenario(): ?Scenario
{
return $this->scenario;
}
public function setScenario(?Scenario $scenario): self
{
$this->scenario = $scenario;
return $this;
}
public function getPac(): ?string
{
return $this->pac;
}
public function setPac(string $pac): self
{
$this->pac = $pac;
return $this;
}
/**
* @return Collection|DataUplinks[]
*/
public function getMessagesUplinks(): Collection
{
return $this->messagesUplinks;
}
public function addMessagesUplink(DataUplinks $messagesUplink): self
{
if (!$this->messagesUplinks->contains($messagesUplink)) {
$this->messagesUplinks[] = $messagesUplink;
$messagesUplink->setDevice($this);
}
return $this;
}
public function removeMessagesUplink(DataUplinks $messagesUplink): self
{
if ($this->messagesUplinks->contains($messagesUplink)) {
$this->messagesUplinks->removeElement($messagesUplink);
// set the owning side to null (unless already changed)
if ($messagesUplink->getDevice() === $this) {
$messagesUplink->setDevice(null);
}
}
return $this;
}
public function getLinkQuality(): ?string
{
return $this->linkQuality;
}
public function setLinkQuality(?string $linkQuality): self
{
$this->linkQuality = $linkQuality;
return $this;
}
public function getDateDerniereCommunication(): ?\DateTimeInterface
{
return $this->dateDerniereCommunication;
}
public function setDateDerniereCommunication(?\DateTimeInterface $dateDerniereCommunication): self
{
$this->dateDerniereCommunication = $dateDerniereCommunication;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(?string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
public function getDelaiLimite(): ?int
{
return $this->delaiLimite;
}
public function setDelaiLimite(?int $delaiLimite): self
{
$this->delaiLimite = $delaiLimite;
return $this;
}
public function getTriggerAlert(): ?bool
{
return $this->triggerAlert;
}
public function setTriggerAlert(?bool $triggerAlert): self
{
$this->triggerAlert = $triggerAlert;
return $this;
}
public function isTriggerAlert(): ?bool
{
return $this->triggerAlert;
}
public function getDevEUI(): ?string
{
return $this->devEUI;
}
public function setDevEUI(?string $devEUI): self
{
$this->devEUI = $devEUI;
return $this;
}
public function getIdClient(): ?string
{
return $this->idClient;
}
public function setIdClient(string $idClient): self
{
$this->idClient = $idClient;
return $this;
}
public function getGatewayPath(): ?string
{
return $this->gatewayPath;
}
public function setGatewayPath(?string $gatewayPath): self
{
$this->gatewayPath = $gatewayPath;
return $this;
}
}