\App\IqrfNetModule\ModelsDpaRawManager

Tool for sending and parsing JSON DPA Raw requests and responses

Summary

Methods
Properties
Constants
__construct()
send()
validatePacket()
updateNadr()
parseResponse()
getPacket()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$request
$wsClient
$parsers
N/A

Properties

$request

$request : \App\IqrfNetModule\Requests\DpaRequest

Type

normal — JSON DPA request

$wsClient

$wsClient : \App\IqrfNetModule\Models\WebSocketClient

Type

normal — WebSocket client

$parsers

$parsers : string[]

Type

normal — DPA parsers

Methods

__construct()

__construct(\App\IqrfNetModule\Requests\DpaRequest  $request, \App\IqrfNetModule\Models\WebSocketClient  $wsClient) : mixed

Constructor

Parameters

\App\IqrfNetModule\Requests\DpaRequest $request

JSON DPA request

\App\IqrfNetModule\Models\WebSocketClient $wsClient

WebSocket client

Returns

mixed

send()

send(string  $packet, int|null  $timeout = null) : array

Sends RAW IQRF packet

Parameters

string $packet

RAW IQRF packet

int|null $timeout

DPA timeout in milliseconds

Throws

\App\IqrfNetModule\Exceptions\DpaErrorException
\App\IqrfNetModule\Exceptions\EmptyResponseException
\Nette\Utils\JsonException
\App\IqrfNetModule\Exceptions\UserErrorException

Returns

array —

DPA request and response

validatePacket()

validatePacket(string  $packet) : bool

Validates DPA packet

Parameters

string $packet

DPA packet to validate

Returns

bool —

Status

updateNadr()

updateNadr(string  $packet, string  $nadr) : void

Updates NADR in DPA packet

Parameters

string $packet

DPA packet to modify

string $nadr

New NADR

parseResponse()

parseResponse(array  $json) : array|null

Parses DPA response

Parameters

array $json

JSON DPA response

Throws

\App\IqrfNetModule\Exceptions\EmptyResponseException
\Nette\Utils\JsonException

Returns

array|null —

Parsed response in array

getPacket()

getPacket(array  $json, string  $type) : string

Gets a DPA packet from JSON DPA request and response

Parameters

array $json

JSON DPA request and response

string $type

Data type (request|response)

Throws

\Nette\Utils\JsonException

Returns

string —

DPA packet