DuoFernDevice/module.php
/**
     * Receive data from parent
     * Will be called when receiving data from parent
     *
     * @param string $JSONString
     *            data json encoded
     */
Receive data from parent
Will be called when receiving data from parent

@param string $JSONString
data json encoded
Receive data from parent Will be called when receiving data from parent @param string $JSONString data json encoded
public function ReceiveData($JSONString)
    {
        $data = json_decode($JSONString);
        if (isset ($data->PairTableNumber)) {
            $this->PairTableNumberBuffer = utf8_decode($data->PairTableNumber);
            return;
        }
        $msg = utf8_decode($data->Buffer);
        $this->SendDebug("RECEIVED", $msg, 1);
        $displayMsg = $this->ConvertMsgToDisplay($msg);
        $waitForMsgBuffer = $this->WaitForMsgBuffer;
        $waitForMsgBuffer->Received($displayMsg);
        $this->WaitForMsgBuffer = $waitForMsgBuffer;
        if (preg_match('/^' . substr(DuoFernMessage::DUOFERN_MSG_STATUS, 0, 6) . '.{38}$/', $displayMsg)) {
            $this->VersionBuffer = (string)substr($displayMsg, 24, 1) . "." . (string)substr($displayMsg, 25, 1);
        }
        $this->SetStatus(IS_ACTIVE);
    }
public function ReceiveData ( $ JSONString ) { $ data = json_decode ( $ JSONString ) ; if ( isset ( $ data -> PairTableNumber ) ) { $ this -> PairTableNumberBuffer = utf8_decode ( $ data -> PairTableNumber ) ; return ; } $ msg = utf8_decode ( $ data -> Buffer ) ; $ this -> SendDebug ( " RECEIVED " , $ msg , 1 ) ; $ displayMsg = $ this -> ConvertMsgToDisplay ( $ msg ) ; $ waitForMsgBuffer = $ this -> WaitForMsgBuffer ; $ waitForMsgBuffer -> Received ( $ displayMsg ) ; $ this -> WaitForMsgBuffer = $ waitForMsgBuffer ; if ( preg_match ( '/^' . substr ( DuoFernMessage :: DUOFERN_MSG_STATUS , 0 , 6 ) . '.{38}$/' , $ displayMsg ) ) { $ this -> VersionBuffer = ( string ) substr ( $ displayMsg , 24 , 1 ) . " . " . ( string ) substr ( $ displayMsg , 25 , 1 ) ; } $ this -> SetStatus ( IS_ACTIVE ) ; }
Receive data from parent
 Will be called when receiving data from parent
Receive data from parent Will be called when receiving data from parent
// decode data // catch pair table number request from gateway // get msg // send msg as debug msg // wait for msg buffer // handle status msg // set status to active