DuoFernDevice/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, IM_CHANGESETTINGS);
        parent::ApplyChanges();
        if (IPS_GetKernelRunlevel() != KR_READY) {
            return;
        }
        $this->ConnectParent("{7AB07511-BABA-418B-81C5-88A7C709D318}");
        $duoFernCode = $this->ReadPropertyString("duoFernCode");
        $this->DeviceGroupBuffer = DuoFernDeviceType::getDeviceGroup($duoFernCode);
        if (!preg_match(DuoFernRegex::DUOFERN_REGEX_DUOFERN_CODE, $duoFernCode)) {
            $this->SetStatus(self::IS_INVALID_DUOFERN_CODE);
            $duoFernCode = "XXXXXX"; 
        } else if ($this->GetStatus() == self::IS_INVALID_DUOFERN_CODE) {
            $this->SetStatus(IS_ACTIVE);
        }
        $this->SetReceiveDataFilter("(.*" . $duoFernCode . ".*)");
    }
public function ApplyChanges ( ) { $ this -> RegisterMessage ( 0 , IPS_KERNELSTARTED ) ; $ this -> RegisterMessage ( $ this -> InstanceID , FM_CONNECT ) ; $ this -> RegisterMessage ( $ this -> InstanceID , IM_CHANGESETTINGS ) ; parent :: ApplyChanges ( ) ; if ( IPS_GetKernelRunlevel ( ) != KR_READY ) { return ; } $ this -> ConnectParent ( " {7AB07511-BABA-418B-81C5-88A7C709D318} " ) ; $ duoFernCode = $ this -> ReadPropertyString ( " duoFernCode " ) ; $ this -> DeviceGroupBuffer = DuoFernDeviceType :: getDeviceGroup ( $ duoFernCode ) ; if ( ! preg_match ( DuoFernRegex :: DUOFERN_REGEX_DUOFERN_CODE , $ duoFernCode ) ) { $ this -> SetStatus ( self :: IS_INVALID_DUOFERN_CODE ) ; $ duoFernCode = " XXXXXX " ; } else if ( $ this -> GetStatus ( ) == self :: IS_INVALID_DUOFERN_CODE ) { $ this -> SetStatus ( IS_ACTIVE ) ; } $ this -> SetReceiveDataFilter ( " (.* " . $ duoFernCode . " .*) " ) ; }
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 // require gateway as parent // property duoFernCode // set device group // set instance status // set invalid duoFernCode for receive data filter // set receive data filter