Php Serial Class

DeviceSet( 'COM1 '); // We can change the baud rate, parity, length, stop bits, flow control $serial -confBaudRate( 2400); $serial -confParity( 'none '); $serial -confCharacterLength( 8); $serial -confStopBits( 1); $serial -confFlowControl( 'none '); // Then we need to open it $serial -deviceOpen; // To write into $serial -sendMessage( 'Hello! '); State of the projectInterestingly enough, this piece of code that is widely untested has created alot if interest ever since it was created, and especially nowadays witheverybody toying around with Arduinos and Raspberry Pis. I receive about 1 emailevery month asking for help with the code or sending patches/suggestions.I think that it is time for me to remove the dust off this project and to giveit a full visibility on modern tools, aka GitHub.

Php Serial Classifieds

ClassPhp

BugsThere is lots of bugs. I know there is. I just don't know which are they.

Platform support. Linux: the initially supported platform, the one I used. Probably the lessbuggy one. MacOS: although I never tried it on MacOS, it is similar to Linux and somepatches were submitted to me, so I guess it is OK. Windows: it seems to be working for some people, not working for someothers. Theoretically there should be a way to get it done.ConcernsI have a few concerns regarding the behaviour of this code. Inter-platform consistency.

Php Serial Class

I seriously doubt that all operations go the sameway across all platforms. Read operations. Reading was never needed in my project, so all the tests Idid on that matter were theoretic. I was also quite naive, so the API isprobably not optimal. What we need is to re-think reading from scratch. Configuration done by calling functions. This is so Java.

It would be muchbetter to be able to pass a configuration array once and for all. Furthermore,I suspect that the order of call matters, which is bad. Auto-closing the device.

There is an auto-close function that is registeredat PHP shutdown. This sounds quite ridiculous, something has to be done aboutthat. Use exceptions. Currently there is an heavy use of the errors system to reporterrors (2007 baby), but this is seriously lame. They have to be replaced byactual exceptions.Call for contributionI have about 0 time to code or test this project.

Posted :