\Iqrf\Repository\Entities\Metadata PowerSupply

PowerSupply metadata entity

Summary

Methods
Properties
Constants
__construct
fromApiResponseV0
fromApiResponseV1
jsonSerialize
mains
accumulator
battery
minVoltage
external
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Properties

$mains

$mains : bool

Type

bool

$accumulator

$accumulator : \Iqrf\Repository\Entities\Metadata\Accumulator

Type

Accumulator

$battery

$battery : \Iqrf\Repository\Entities\Metadata\Battery

Type

Battery

$minVoltage

$minVoltage : float

Type

float

$external

$external : ?\Iqrf\Repository\Entities\Metadata\External

Type

External|null

Methods

__construct()

__construct(bool  $mains, \Iqrf\Repository\Entities\Metadata\Accumulator  $accumulator, \Iqrf\Repository\Entities\Metadata\Battery  $battery, float  $minVoltage, \Iqrf\Repository\Entities\Metadata\External|null  $external = null) : mixed

Constructs PowerSupply metadata object.

Parameters

bool $mains

Power supplied by a main cable.

\Iqrf\Repository\Entities\Metadata\Accumulator $accumulator

Accumulator power supply spec.

\Iqrf\Repository\Entities\Metadata\Battery $battery

Battery power supply spec.

float $minVoltage

Minimum voltage (in V) required for operation.

\Iqrf\Repository\Entities\Metadata\External|null $external

External power properties.

Returns

mixed —

fromApiResponseV0()

fromApiResponseV0(array{mains: bool, accumulator: array{present: bool, type: string|null, lowLevel: float|null}, battery: array{present: bool, type: string|null, changeThreshold: float|null}, minVoltage: float}  $response) : \Iqrf\Repository\Entities\Metadata\PowerSupply

Parses the provided array into a PowerSupply object (Version 0).

Parameters

array{mains: bool, accumulator: array{present: bool, type: string|null, lowLevel: float|null}, battery: array{present: bool, type: string|null, changeThreshold: float|null}, minVoltage: float} $response

API response body

Throws

\InvalidArgumentException

Thrown if required properties are missing

Returns

\Iqrf\Repository\Entities\Metadata\PowerSupply —

The parsed PowerSupply object

fromApiResponseV1()

fromApiResponseV1(array{mains: bool, accumulator: array{present: bool, type: string|null, lowLevel: float|null}, battery: array{present: bool, type: string|null, changeThreshold: float|null}, minVoltage: float, external?: array{type?: string, nominalVoltage?: float, minVoltage?: float, maxVoltage?: float}}  $response) : \Iqrf\Repository\Entities\Metadata\PowerSupply

Parses the provided array into a PowerSupply object (Version 1).

Parameters

array{mains: bool, accumulator: array{present: bool, type: string|null, lowLevel: float|null}, battery: array{present: bool, type: string|null, changeThreshold: float|null}, minVoltage: float, external?: array{type?: string, nominalVoltage?: float, minVoltage?: float, maxVoltage?: float}} $response

API response body

Throws

\InvalidArgumentException

Thrown if required properties are missing

Returns

\Iqrf\Repository\Entities\Metadata\PowerSupply —

The parsed PowerSupply object

jsonSerialize()

jsonSerialize() : array{mains: bool, accumulator: array{present: bool, type: string|null, lowLevel: float|null}, battery: array{present: bool, type: string|null, changeThreshold: float|null}, minVoltage: float, external?: array{type?: string, nominalVoltage?: float, minVoltage?: float, maxVoltage?: float}}

Serializes PowerSupply entity into JSON

Returns

array{mains: bool, accumulator: array{present: bool, type: string|null, lowLevel: float|null}, battery: array{present: bool, type: string|null, changeThreshold: float|null}, minVoltage: float, external?: array{type?: string, nominalVoltage?: float, minVoltage?: float, maxVoltage?: float}} —

JSON-serialized PowerSupply entity