DuoFernGateway/module.php
/**
     * Applies the changes
     * Will be called when click on "Apply" at the configuration form or after creating the instance
     */
Applies the changes
Will be called when click on "Apply" at the configuration form or after creating the instance
Applies the changes Will be called when click on " Apply " at the configuration form or after creating the instance
public function ApplyChanges()
    {
        $this->RegisterMessage(0, IPS_KERNELSTARTED);
        $this->RegisterMessage($this->InstanceID, FM_CONNECT);
        $this->RegisterMessage($this->InstanceID, FM_DISCONNECT);
        parent::ApplyChanges();
        if (IPS_GetKernelRunlevel() != KR_READY) {
            return;
        }
        switch ($this->ReadPropertyInteger("modus")) {
            case 0 : 
                $this->ForceParent("{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}");
                break;
            case 1 : 
                $this->ForceParent("{3CFF0FD9-E306-41DB-9B5A-9D06D38576C3}");
                break;
        }
        $duoFernCode = $this->ReadPropertyString("duoFernCode");
        if (!preg_match(DuoFernRegex::DUOFERN_REGEX_GATEWAY_DUOFERN_CODE, $duoFernCode)) {
            $this->SetStatus(self::IS_INVALID_DUOFERN_CODE);
        } else if ($this->GetStatus() == self::IS_INVALID_DUOFERN_CODE) {
            $this->SetStatus(IS_ACTIVE);
        }
        $this->UpdateValueByIdent("DuoFernCode", $duoFernCode);
        $this->ForceRefresh();
    }
public function ApplyChanges ( ) { $ this -> RegisterMessage ( 0 , IPS_KERNELSTARTED ) ; $ this -> RegisterMessage ( $ this -> InstanceID , FM_CONNECT ) ; $ this -> RegisterMessage ( $ this -> InstanceID , FM_DISCONNECT ) ; parent :: ApplyChanges ( ) ; if ( IPS_GetKernelRunlevel ( ) != KR_READY ) { return ; } switch ( $ this -> ReadPropertyInteger ( " modus " ) ) { case 0 : $ this -> ForceParent ( " {6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1} " ) ; break ; case 1 : $ this -> ForceParent ( " {3CFF0FD9-E306-41DB-9B5A-9D06D38576C3} " ) ; break ; } $ duoFernCode = $ this -> ReadPropertyString ( " duoFernCode " ) ; if ( ! preg_match ( DuoFernRegex :: DUOFERN_REGEX_GATEWAY_DUOFERN_CODE , $ duoFernCode ) ) { $ this -> SetStatus ( self :: IS_INVALID_DUOFERN_CODE ) ; } else if ( $ this -> GetStatus ( ) == self :: IS_INVALID_DUOFERN_CODE ) { $ this -> SetStatus ( IS_ACTIVE ) ; } $ this -> UpdateValueByIdent ( " DuoFernCode " , $ duoFernCode ) ; $ this -> ForceRefresh ( ) ; }
Applies the changes
 Will be called when click on "Apply" at the configuration form or after creating the instance
Applies the changes Will be called when click on " Apply " at the configuration form or after creating the instance
// register messages // call parent // return when kernel is not ready // property modus // force serial port as parent // force client socket as parent // property duoFernCode // set duo fern code status variable // force refresh