/**
  * Overload.
  * Reads data from gsm modem.
  *
  * @access protected
  *
  * @param array $output
  *
  * @return bool|void
  */
 protected function readCustomData(&$output)
 {
     parent::readCustomData($output);
     $this->_logger->log(__METHOD__);
     /**
      * AT+CMGL="REC UNREAD" - Read all unread messages
      * AT+CMGL="ALL" - Read ALL messages
      */
     if ($this->sendCommand('AT+CMGL="REC UNREAD"', $output, 2) === false) {
         $this->_logger->log(__METHOD__ . 'AT+CMGL="REC UNREAD"' . ' error');
         return false;
     }
     if (is_array($output)) {
         // TODO: uncomment and test method
         //$this->onReceiveMessagesEvent($output);
         foreach ($output as $response) {
             // Laos method
             if (preg_match("/^@(.*)/", $response)) {
                 $this->onReceiveMessageEvent($response, 0);
             }
             // Old method parse messages
             //if (preg_match_all("/^[\+](CMGL: )([\d]*),(\"ALL\"|\"REC READ\"|\"REC UNREAD\"|\"STO SENT\"|\"STO UNSENT\"),\"(.*?)\",(.*)/i", $response, $matches)) {
             //	$this->onReceiveMessageEvent($response, $matches[4][0]);
             //}
         }
     }
     // Delete all read messages
     $this->sendCommand('AT+CMGD=0,1');
     return true;
 }
 /**
  * Overload.
  * Reads data from data logger.
  * 
  * @access protected
  * @param array $output 
  */
 protected function readCustomData(&$output)
 {
     parent::readCustomData($output);
     $this->_logger->log(__METHOD__);
     // Waiting for messages
     while (true) {
         $response = $this->_serial->readString($this->_timeout);
         if ($response === false) {
             $this->_errors[] = 'Error during read message';
             return false;
         }
         if (!empty($response)) {
             $this->_logger->log(__METHOD__, array('response' => $response));
             $output = preg_split("/\r\n/", $response, -1, PREG_SPLIT_NO_EMPTY);
             foreach ($output as $message) {
                 $this->onReceiveMessageEvent($message, null);
             }
         }
     }
     $this->_errors[] = 'Timeout exceeded during waiting message';
     return false;
 }