Tested on Gentoo Linux, Centos linux
I have gprs modem works via ftdi....
0. connects
$serial = new phpSerial;
$serial->deviceSet("ttyUSB0");
$serial->confBaudRate(115200);
$serial->deviceOpen();
$recieved_sms=pdu_read_recieved_sms();
$serial->deviceClose();
1. echo at+cmgl=4 > /dev/ttyUSB0 && cat /dev/ttyUSB0
if i reapeat this cmd, data loads full! this is fine
2. if i load data from php ver 5.5.10
function pdu_read_recieved_sms($waitForReply = 0.1){
global $serial; $read='';
$serial->sendMessage("AT+CMGL=4".PHP_EOL,$waitForReply);
// Wait and read from the port
//sleep(2);
$read .= $serial->readPort();
print $read;
if(!empty($read)){
preg_match_all("/07[A-Z0-9]*/i", $read,$matches);
if(is_array($matches) && sizeof($matches)>0){
return $matches[0];
}else{
return false;
}
}else{
return false;
}
}
3. if i read
$timeout=microtime(true)+10;
do{
$c=fread($this->_dHandle,128);
$content.=$c;
}while(microtime(true)<$timeout);
full data reads in 80 percents
may be script issue?
please help to fix this problem
Original issue reported on code.google.com by d.sh...@gmail.com on 26 Mar 2014 at 1:27
Original issue reported on code.google.com by
d.sh...@gmail.com
on 26 Mar 2014 at 1:27Attachments: