-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read port never get response on Windows #23
Comments
Did you find a solution for this ? |
@kamaroly They have comment on the code " // Windows port reading procedures still buggy" When I try to read I never get awnser. What I did instead using $content = fread($this->_dHandle,56); This is not the best solution, because if you have response bigger than 56 length you can't read, but it solve my problem. To test if my device is working and connect to com port I use PUTTY. |
I've done some testing under Windows and I can confidently say that using the built-in PHP file system functions such as: The proper way to communicate with the COM port on Windows is to use the Direct IO functions. This is an extension you need to install first, before you can use it. Unfortunately I couldn't find a serial php library that uses the Direct IO API. Instead I just used the API directly. For more info, see the discussion on StackOverflow. |
$serial->deviceSet("COM2"); $serial->confBaudRate(115200); $serial->deviceOpen(); $serial->sendMessage("AT+CMGF=1\n\r"); $serial->sendMessage("AT+cmgs=\"6299999999\"\n\r"); $serial->sendMessage("test \n\r"); $serial->sendMessage(chr(26)); sleep(7); var_dump($serial->readPort());
The text was updated successfully, but these errors were encountered: