Beispiel #1
0
 /**
  * Returns the UID, the UID where the Bricklet is connected to, 
  * the position, the hardware and firmware version as well as the
  * device identifier.
  * 
  * The position can be 'a', 'b', 'c' or 'd'.
  * 
  * The device identifiers can be found :ref:`here <device_identifier>`.
  * 
  * .. versionadded:: 2.0.0~(Plugin)
  * 
  * 
  * @return array
  */
 public function getIdentity()
 {
     $result = array();
     $payload = '';
     $data = $this->sendRequest(self::FUNCTION_GET_IDENTITY, $payload);
     $payload = unpack('c8uid/c8connected_uid/c1position/C3hardware_version/C3firmware_version/v1device_identifier', $data);
     $result['uid'] = IPConnection::implodeUnpackedString($payload, 'uid', 8);
     $result['connected_uid'] = IPConnection::implodeUnpackedString($payload, 'connected_uid', 8);
     $result['position'] = chr($payload['position']);
     $result['hardware_version'] = IPConnection::collectUnpackedArray($payload, 'hardware_version', 3);
     $result['firmware_version'] = IPConnection::collectUnpackedArray($payload, 'firmware_version', 3);
     $result['device_identifier'] = $payload['device_identifier'];
     return $result;
 }
Beispiel #2
0
 public function getAuthenticationNonce()
 {
     $payload = '';
     $data = $this->sendRequest(self::FUNCTION_GET_AUTHENTICATION_NONCE, $payload);
     $payload = unpack('C4nonce', $data);
     return IPConnection::collectUnpackedArray($payload, 'nonce', 4);
 }