I'm playing around with you're driver for a few day's now and i got strange responses from the plugs:
"ƒ""square""square""square""square"0013010C000D6F0000C3A6FC001E00F10000A9D800000000000A5B94
The "ƒ" character is messing the whole thing up....
After some debugging, i see the following happening:
received datafrom plug:
"square""square""square""square"0000010C00C11F89 ƒ"square""square""square""square"0013010C000D6F0000C3A6FC001E00F10000A9D800000000000A5B94 < (whiteout the ><)
Formdata translates it with:
$lines = explode("\r\n", $data);
_formdata isn't getting by
" $out['data'] = $this->getResponse()->readString($line);" (device->line312).
Result is that it not generates:
$out['ack']
$out['data']
$out['tmp']
I've tried to modify the $data by replace the ƒ with "" (see first line in function):
protected function _formatData($data) {
$data = str_replace("ƒ","",$data);
$lines = explode("\r\n", $data);
$out = array();
$counter = 0;
foreach($lines as $line) {
if (preg_match('/^00/', substr($line, 4, 4))) {
This isn't working and the ƒ is still showing up.
The following is working, but only for responsive functions (powerinfo, deviceinfo) and not for sending function (switchOn, SwitchOff, switch):
protected function _formatData($data) {
$lines = explode("\r\n", $data);
$out = array();
$counter = 0;
foreach($lines as $line) {
if (preg_match('/^00/', substr($line, 5, 4))) {
NOTE the 5 in the last line!
with this solution I skip the "ƒ" and its start on character 5 with reading the response string.
The only solution (for now) i can think off, is to make 2 _formdata functions:
_formDataSend
_formDataReceive
Each function can handle the send en receive string at its own way.
I'm playing around with you're driver for a few day's now and i got strange responses from the plugs: "ƒ""square""square""square""square"0013010C000D6F0000C3A6FC001E00F10000A9D800000000000A5B94
The "ƒ" character is messing the whole thing up....
After some debugging, i see the following happening: received datafrom plug:
Formdata translates it with: $lines = explode("\r\n", $data);
in: Array ( [0] => "square""square""square""square"0000010C00C11F89 [1] => ƒ"square""square""square""square"0013010C000D6F0000C3A6FC001E00F10000A9D800000000000A5B94 [2] => )
Because of the "ƒ"
_formdata isn't getting by " $out['data'] = $this->getResponse()->readString($line);" (device->line312).
Result is that it not generates: $out['ack'] $out['data'] $out['tmp']
I've tried to modify the $data by replace the ƒ with "" (see first line in function): protected function _formatData($data) { $data = str_replace("ƒ","",$data); $lines = explode("\r\n", $data); $out = array(); $counter = 0; foreach($lines as $line) {
if (preg_match('/^00/', substr($line, 4, 4))) {
This isn't working and the ƒ is still showing up.
The following is working, but only for responsive functions (powerinfo, deviceinfo) and not for sending function (switchOn, SwitchOff, switch): protected function _formatData($data) { $lines = explode("\r\n", $data); $out = array(); $counter = 0; foreach($lines as $line) {
if (preg_match('/^00/', substr($line, 5, 4))) {
NOTE the 5 in the last line! with this solution I skip the "ƒ" and its start on character 5 with reading the response string.
The only solution (for now) i can think off, is to make 2 _formdata functions: _formDataSend _formDataReceive
Each function can handle the send en receive string at its own way.
Do you have a solution?