public function open($device, $mode = "w+b")
    {
        if (false === file_exists($device)) {
            throw new DeviceNotFound();
        }

        $this->getConfigure()->configure($device);
        $this->fd = fopen($device, $mode);

        if (false !== $this->fd) {
            stream_set_blocking($this->fd, false);

            return true;
        }

        unset($this->fd);
        throw new DeviceNotAvailable($device);
    }
public function open($device, $mode = "w+b")
    {
        if (false === file_exists($device)) {
            throw new DeviceNotFound();
        }

        $this->getConfigure()->configure($device);
        $this->fd = fopen($device, $mode);

        if (false !== $this->fd) {
            stream_set_blocking($this->fd, false);

            return true;
        }

        unset($this->fd);
        throw new DeviceNotAvailable($device);
    }
public function open ( $ device , $ mode = "w+b" ) { if ( false === file_exists ( $ device ) ) { throw new DeviceNotFound ( ) ; } $ this -> getConfigure ( ) -> configure ( $ device ) ; $ this -> fd = fopen ( $ device , $ mode ) ; if ( false !== $ this -> fd ) { stream_set_blocking ( $ this -> fd , false ) ; return true ; } unset ( $ this -> fd ) ; throw new DeviceNotAvailable ( $ device ) ; }
Open serial connection

@param string $device path to device
@param string $mode fopen mode

@return bool

@throws DeviceNotAvailable|DeviceNotFound
Open serial connection