Пример #1
0
 /**
  * Returns the debounce period as set by BrickletCurrent12::setDebouncePeriod().
  * 
  * 
  * @return int
  */
 public function getDebouncePeriod()
 {
     $payload = '';
     $data = $this->sendRequest(self::FUNCTION_GET_DEBOUNCE_PERIOD, $payload);
     $payload = unpack('V1debounce', $data);
     return IPConnection::fixUnpackedUInt32($payload['debounce']);
 }
Пример #2
0
 /**
  * Returns (for the given relay) the current state and the time as set by 
  * BrickletDualRelay::setMonoflop() as well as the remaining time until the state flips.
  * 
  * If the timer is not running currently, the remaining time will be returned
  * as 0.
  * 
  * .. versionadded:: 1.1.1~(Plugin)
  * 
  * @param int $relay
  * 
  * @return array
  */
 public function getMonoflop($relay)
 {
     $result = array();
     $payload = '';
     $payload .= pack('C', $relay);
     $data = $this->sendRequest(self::FUNCTION_GET_MONOFLOP, $payload);
     $payload = unpack('C1state/V1time/V1time_remaining', $data);
     $result['state'] = (bool) $payload['state'];
     $result['time'] = IPConnection::fixUnpackedUInt32($payload['time']);
     $result['time_remaining'] = IPConnection::fixUnpackedUInt32($payload['time_remaining']);
     return $result;
 }
Пример #3
0
 /**
  * Returns the status of the Ethernet Extension.
  * 
  * ``mac_address``, ``ip``, ``subnet_mask`` and ``gateway`` are given as an array.
  * The first element of the array is the least significant byte of the address.
  * 
  * ``rx_count`` and ``tx_count`` are the number of bytes that have been
  * received/send since last restart.
  * 
  * ``hostname`` is the currently used hostname.
  * 
  * .. versionadded:: 2.1.0~(Firmware)
  * 
  * 
  * @return array
  */
 public function getEthernetStatus()
 {
     $result = array();
     $payload = '';
     $data = $this->sendRequest(self::FUNCTION_GET_ETHERNET_STATUS, $payload);
     $payload = unpack('C6mac_address/C4ip/C4subnet_mask/C4gateway/V1rx_count/V1tx_count/c32hostname', $data);
     $result['mac_address'] = IPConnection::collectUnpackedArray($payload, 'mac_address', 6);
     $result['ip'] = IPConnection::collectUnpackedArray($payload, 'ip', 4);
     $result['subnet_mask'] = IPConnection::collectUnpackedArray($payload, 'subnet_mask', 4);
     $result['gateway'] = IPConnection::collectUnpackedArray($payload, 'gateway', 4);
     $result['rx_count'] = IPConnection::fixUnpackedUInt32($payload['rx_count']);
     $result['tx_count'] = IPConnection::fixUnpackedUInt32($payload['tx_count']);
     $result['hostname'] = IPConnection::implodeUnpackedString($payload, 'hostname', 32);
     return $result;
 }
Пример #4
0
 /**
  * Returns the current value of the edge counter for the selected pin on port A.
  * You can configure the edges that are counted with BrickletIO16::setEdgeCountConfig().
  * 
  * If you set the reset counter to *true*, the count is set back to 0
  * directly after it is read.
  * 
  * .. versionadded:: 2.0.3~(Plugin)
  * 
  * @param int $pin
  * @param bool $reset_counter
  * 
  * @return int
  */
 public function getEdgeCount($pin, $reset_counter)
 {
     $payload = '';
     $payload .= pack('C', $pin);
     $payload .= pack('C', intval((bool) $reset_counter));
     $data = $this->sendRequest(self::FUNCTION_GET_EDGE_COUNT, $payload);
     $payload = unpack('V1count', $data);
     return IPConnection::fixUnpackedUInt32($payload['count']);
 }
Пример #5
0
 /**
  * Returns the period as set by BrickStepper::setAllDataPeriod().
  * 
  * .. versionadded:: 1.1.6~(Firmware)
  * 
  * 
  * @return int
  */
 public function getAllDataPeriod()
 {
     $payload = '';
     $data = $this->sendRequest(self::FUNCTION_GET_ALL_DATA_PERIOD, $payload);
     $payload = unpack('V1period', $data);
     return IPConnection::fixUnpackedUInt32($payload['period']);
 }
Пример #6
0
 /**
  * @internal
  * @param string $data
  */
 public function callbackWrapperDateTime($data)
 {
     $result = array();
     $payload = unpack('V1date/V1time', $data);
     array_push($result, IPConnection::fixUnpackedUInt32($payload['date']));
     array_push($result, IPConnection::fixUnpackedUInt32($payload['time']));
     call_user_func_array($this->registeredCallbacks[self::CALLBACK_DATE_TIME], $result);
 }
Пример #7
0
 /**
  * Returns the period as set by BrickIMU::setQuaternionPeriod().
  * 
  * 
  * @return int
  */
 public function getQuaternionPeriod()
 {
     $payload = '';
     $data = $this->sendRequest(self::FUNCTION_GET_QUATERNION_PERIOD, $payload);
     $payload = unpack('V1period', $data);
     return IPConnection::fixUnpackedUInt32($payload['period']);
 }