diff --git a/LICENSE b/LICENSE index fafe0eb..9ffe6a8 100644 --- a/LICENSE +++ b/LICENSE @@ -14,6 +14,8 @@ Further improvements - John S. Long and other contributors Cleanup and namespaces - Ondřej Hruška, 2016 https://github.com/MightyPork/phpmodbus + + https://git.ondrovo.com/packages/php-modbus +---------------------------------------------------------+ diff --git a/README.md b/README.md index f478cd8..55749eb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Implementation of the basic functionality of the Modbus TCP and UDP based protocol using PHP. -**NOTE: This is a fork to fix & update the library code (and code alone). Notably, the tests are probably all broken.** +**NOTE: This is a fork to fix & update the library code.** > **What's new** > @@ -31,8 +31,8 @@ Implementation of the basic functionality of the Modbus TCP and UDP based protoc ## Example ```php -use PHPModbus/ModbusMaster; -use PHPModbus/PhpType; +use MightyPork\PHPModbus\ModbusMaster; +use MightyPork\PHPModbus\PhpType; // Modbus master UDP $modbus = new ModbusMaster("192.168.1.1", "UDP"); @@ -41,7 +41,7 @@ try { $recData = $modbus->readMultipleRegisters(0, 12288, 5); } catch (Exception $e) { // Print error information if any - echo $modbus; + echo $modbus . "\n"; echo $e; exit; } @@ -51,12 +51,12 @@ echo PhpType::bytes2string($recData); Use the `setTimeout($seconds)` and `setSocketTimeout($read_timeout_sec, $write_timeout_sec)` methods to adjust wait times. -Most of the code is (to some extent) commented and documented with PhpDoc. You should get useful tooltips in your IDE. +Most of the code is (to some extent) commented and documented with PhpDoc. ## GoogleCode legacy docs & downloads -This project was originally hosted on (now defunct) Google Code. It's still archived here: +This project was originally hosted on Google Code. It is still archived here: * [GoogleCode Archived Repo](http://code.google.com/p/phpmodbus) diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index f3e0c3b..0000000 --- a/examples/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Those examples have not been updated to use namespaces. - -They may not work. Just for reference. diff --git a/examples/example_750841_Mmemory.php b/examples/example_750841_Mmemory.php deleted file mode 100644 index 452b801..0000000 --- a/examples/example_750841_Mmemory.php +++ /dev/null @@ -1,65 +0,0 @@ -readMultipleRegisters($moduleId, $reference, $quantity); -} catch (Exception $e) { - echo $modbus; - echo $e; - exit; -} - -?> - - - - - WAGO 750-841 M-memory dump - - -

Dump of M-memory from WAGO 750-84x series coupler.

- - -

M-memory dump

- - - - - - - - - - - - - - -
Modbus addressMWxvalue
MW
- -

Modbus class status

- -
- - - diff --git a/examples/example_datatype.php b/examples/example_datatype.php deleted file mode 100644 index 86fa4dc..0000000 --- a/examples/example_datatype.php +++ /dev/null @@ -1,60 +0,0 @@ -readMultipleRegisters(0, 12288, 10); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Received data -echo "

Received Data

\n"; -print_r($recData); - -// Conversion -echo "

32 bits types

\n"; -// Chunk the data array to set of 4 bytes -$values = array_chunk($recData, 4); - -// Get float from REAL interpretation -echo "

REAL to Float

\n"; -foreach ($values as $bytes) - echo PhpType::bytes2float($bytes) . "
"; - -// Get integer from DINT interpretation -echo "

DINT to integer

\n"; -foreach ($values as $bytes) - echo PhpType::bytes2signedInt($bytes) . "
"; - -// Get integer of float from DINT interpretation -echo "

DWORD to integer (or float)

\n"; -foreach ($values as $bytes) - echo PhpType::bytes2unsignedInt($bytes) . "
"; - -echo "

16 bit types

\n"; -// Chunk the data array to set of 4 bytes -$values = array_chunk($recData, 2); - -// Get signed integer from INT interpretation -echo "

INT to integer

\n"; -foreach ($values as $bytes) - echo PhpType::bytes2signedInt($bytes) . "
"; - -// Get unsigned integer from WORD interpretation -echo "

WORD to integer

\n"; -foreach ($values as $bytes) - echo PhpType::bytes2unsignedInt($bytes) . "
"; - -// Get string from STRING interpretation -echo "

STRING to string

\n"; -echo PhpType::bytes2string($recData) . "
"; diff --git a/examples/example_fc1.php b/examples/example_fc1.php deleted file mode 100644 index d6c7497..0000000 --- a/examples/example_fc1.php +++ /dev/null @@ -1,24 +0,0 @@ -readCoils(0, 12288, 12); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo "
Status:
" . $modbus; - -// Print read data -echo "
Data:
"; -var_dump($recData); -echo "
"; diff --git a/examples/example_fc15.php b/examples/example_fc15.php deleted file mode 100644 index 23de38b..0000000 --- a/examples/example_fc15.php +++ /dev/null @@ -1,27 +0,0 @@ -writeMultipleCoils(0, 12288, $data); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo $modbus; diff --git a/examples/example_fc16.php b/examples/example_fc16.php deleted file mode 100644 index 1bff6f2..0000000 --- a/examples/example_fc16.php +++ /dev/null @@ -1,25 +0,0 @@ -writeMultipleRegister(0, 12288, $data, $dataTypes); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo $modbus; - -?> diff --git a/examples/example_fc2.php b/examples/example_fc2.php deleted file mode 100644 index 1563938..0000000 --- a/examples/example_fc2.php +++ /dev/null @@ -1,25 +0,0 @@ -readInputDiscretes(0, 0, 2); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo "
Status:
" . $modbus; - -// Print read data -echo "
Data:
"; -var_dump($recData); -echo "
"; diff --git a/examples/example_fc22.php b/examples/example_fc22.php deleted file mode 100644 index 34ccd2e..0000000 --- a/examples/example_fc22.php +++ /dev/null @@ -1,25 +0,0 @@ -maskWriteRegister(0, 12288, $andMask, $orMask); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo $modbus; diff --git a/examples/example_fc23.php b/examples/example_fc23.php deleted file mode 100644 index 0fa0ebe..0000000 --- a/examples/example_fc23.php +++ /dev/null @@ -1,28 +0,0 @@ -readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo "
Status:
" . $modbus; - -// Print read data -echo "
Data:
"; -print_r($recData); -echo "
"; diff --git a/examples/example_fc3.php b/examples/example_fc3.php deleted file mode 100644 index 859e1c0..0000000 --- a/examples/example_fc3.php +++ /dev/null @@ -1,24 +0,0 @@ -readMultipleRegisters(0, 12288, 6); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo "
Status:
" . $modbus; - -// Print read data -echo "
Data:
"; -print_r($recData); -echo "
"; diff --git a/examples/example_fc4.php b/examples/example_fc4.php deleted file mode 100644 index 94478c6..0000000 --- a/examples/example_fc4.php +++ /dev/null @@ -1,18 +0,0 @@ -readMultipleInputRegisters(0, 0, 2); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -var_dump($recData); diff --git a/examples/example_fc5.php b/examples/example_fc5.php deleted file mode 100644 index 7f47680..0000000 --- a/examples/example_fc5.php +++ /dev/null @@ -1,23 +0,0 @@ -writeSingleCoil(0, 12288, $data_true); - $modbus->writeSingleCoil(0, 12289, $data_false); - $modbus->writeSingleCoil(0, 12290, $data_true); - $modbus->writeSingleCoil(0, 12291, $data_false); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} diff --git a/examples/example_fc6.php b/examples/example_fc6.php deleted file mode 100644 index 1d7c733..0000000 --- a/examples/example_fc6.php +++ /dev/null @@ -1,22 +0,0 @@ -writeSingleRegister(0, 12288, $data); -} catch (Exception $e) { - // Print error information if any - echo $modbus; - echo $e; - exit; -} - -// Print status information -echo $modbus; diff --git a/tests/Codesys/TEST.EXP b/tests/Codesys/TEST.EXP deleted file mode 100644 index 3e6f226..0000000 --- a/tests/Codesys/TEST.EXP +++ /dev/null @@ -1,256 +0,0 @@ - - -(* @NESTEDCOMMENTS := 'Yes' *) -(* @PATH := '' *) -(* @OBJECTFLAGS := '0, 8' *) -(* @SYMFILEFLAGS := '2048' *) -PROGRAM PLC_PRG -VAR - (* BOOL, COIL *) - COIL1 AT %MX0.0 : BOOL := 0; - COIL2 AT %MX0.1 : BOOL := 0; - COIL3 AT %MX0.2 : BOOL := 0; - COIL4 AT %MX0.3 : BOOL := 0; - COIL5 AT %MX0.4 : BOOL := 0; - COIL6 AT %MX0.5 : BOOL := 0; - COIL7 AT %MX0.6 : BOOL := 0; - COIL8 AT %MX0.7 : BOOL := 0; - - (* BYTE *) - BYTE1 AT %MB0 : BYTE := 0; - BYTE2 AT %MB1 : BYTE := 0; - BYTE3 AT %MB2 : BYTE := 0; - BYTE4 AT %MB3 : BYTE := 0; - BYTE5 AT %MB4 : BYTE := 0; - - (* INT *) - INT1 AT %MW0 : INT := 0; - INT2 AT %MW1 : INT := 0; - INT3 AT %MW2 : INT := 0; - INT4 AT %MW3 : INT := 0; - INT5 AT %MW4 : INT := 0; - - (* WORD *) - WORD1 AT %MW0 : WORD := 0; - WORD2 AT %MW1 : WORD := 0; - WORD3 AT %MW2 : WORD := 0; - WORD4 AT %MW3 : WORD := 0; - WORD5 AT %MW4 : WORD := 0; - - (* DINT *) - DINT1 AT %MD0 : DINT := 0; - DINT2 AT %MD1 : DINT := 0; - DINT3 AT %MD2 : DINT := 0; - DINT4 AT %MD3 : DINT := 0; - DINT5 AT %MD4 : DINT := 0; - - (* DWORD *) - DWORD1 AT %MD0 : DWORD := 0; - DWORD2 AT %MD1 : DWORD := 0; - DWORD3 AT %MD2 : DWORD := 0; - DWORD4 AT %MD3 : DWORD := 0; - DWORD5 AT %MD4 : DWORD := 0; - - (* REAL *) - REAL1 AT %MD0 : REAL := 0; - REAL2 AT %MD1 : REAL := 0; - REAL3 AT %MD2 : REAL := 0; - REAL4 AT %MD3 : REAL := 0; - REAL5 AT %MD4 : REAL := 0; - - (* String *) - STRING1 AT %MW0 : STRING := 'Hello word!!!'; -END_VAR - -(* @END_DECLARATION := '0' *) -(* Something to do *) -; -END_PROGRAM - -(* @NESTEDCOMMENTS := 'Yes' *) -(* @GLOBAL_VARIABLE_LIST := 'Global_Variables' *) -(* @PATH := '' *) -(* @OBJECTFLAGS := '0, 8' *) -(* @SYMFILEFLAGS := '2048' *) -VAR_GLOBAL -END_VAR - -(* @OBJECT_END := 'Global_Variables' *) -(* @CONNECTIONS := Global_Variables -FILENAME : '' -FILETIME : 0 -EXPORT : 0 -NUMOFCONNECTIONS : 0 -*) - -(* @NESTEDCOMMENTS := 'Yes' *) -(* @GLOBAL_VARIABLE_LIST := 'Variable_Configuration' *) -(* @PATH := '' *) -(* @OBJECTFLAGS := '0, 8' *) -(* @SYMFILEFLAGS := '2048' *) -VAR_CONFIG -END_VAR - -(* @OBJECT_END := 'Variable_Configuration' *) -(* @CONNECTIONS := Variable_Configuration -FILENAME : '' -FILETIME : 0 -EXPORT : 0 -NUMOFCONNECTIONS : 0 -*) - - -_ALARMCONFIG -_ALARMCONFIGNEXTTEXTID : 10002 -_ALARMCONFIGFORMATS : 'HH$':$'mm$':$'ss','dd$'-$'MM$'-$'yyyy' -_ALARMCLASSLIST : 1 -_ALARMCLASSID : 0 -_ALARMCLASSACKTYPE : 0 -_ALARMCLASSNAME : 'DEFAULT' -_ALARMCLASSDESCRIPTION : '' -_ALARMCLASSBGCOLORS : 16777215,16777215,16777215 -_ALARMCLASSTEXTCOLORS : 3394560,255,16711680 -_ALARMCLASSBITMAPS : '','','' -_ALARMACTIONLIST : 0 -(* @ALARMCLASSRESETCOLORS := '_ALARMCLASSRESETCOLORS: 33023,16777215' *) -(* @ALARMCLASSRESETBITMAP := '_ALARMCLASSRESETBITMAP: $'$'' *) -_ALARMGROUPLISTNAME : 'System' -_ALARMGROUPPATH : 'System' -_ALARMGROUPLIST : 0 -_VISUALSETTINGSFLAGS : 0,0,0,0 -_VISUALSETTINGSFLAGS : '','','' -_VISUALSETTINGSDYNTEXTFILECOUNT : 0 - -(* @ALARMCONFIGFLAGS := '_ALARMCONFIGFLAGS: 0' *) -(* @ALARMCONFIGGLOBALDB_STR := '_ALARMCONFIGGLOBALDB_STRINGS: $'$',$'$',$'$',$'$'' *) -(* @ALARMCONFIGGLOBALDB_NUM := '_ALARMCONFIGGLOBALDB_NUMBERS: 0,0' *) -_END_ALARMCONFIG - - -LIBRARY -Standard.lib 2.12.10 14:48:34 -(* @LIBRARYSYMFILEINFO := '0' *) -NumOfPOUs: 26 -ASCIIBYTE_TO_STRING: 2048 -CONCAT: 0 -CTD: 0 -CTU: 0 -CTUD: 0 -DELETE: 0 -F_TRIG: 0 -FIND: 0 -INSERT: 0 -LEFT: 0 -LEN: 0 -MID: 0 -R_TRIG: 0 -REAL_STATE: 2048 -REPLACE: 0 -RIGHT: 0 -RS: 0 -RTC: 0 -SEMA: 0 -SR: 0 -STANDARD_VERSION: 2048 -STRING_COMPARE: 2048 -STRING_TO_ASCIIBYTE: 2048 -TOF: 0 -TON: 0 -TP: 0 -NumOfGVLs: 1 -'Global Variables 0': 0 -END_LIBRARY - -LIBRARY -SYSLIBCALLBACK.LIB 2.12.10 14:48:32 -(* @LIBRARYSYMFILEINFO := '0' *) -NumOfPOUs: 2 -SysCallbackRegister: 0 -SysCallbackUnregister: 0 -NumOfGVLs: 2 -Globale_Variablen: 0 -Version: 0 -END_LIBRARY - -PLC_CONFIGURATION -_GLOBAL -_VERSION: 3 -_AUTOADR: 0 -_CHECKADR: 0 -_SAVECONFIGFILESINPROJECT: 0 -_END_GLOBAL - -_MODULE: '3S' -_SECTION_NAME: 'Root' -_INDEX_IN_PARENT: '-1' -_MODULE_NAME: 'Hardware configuration' -_NODE_ID: -1 -_IECIN: %IB0 -_IECOUT: %QB0 -_IECDIAG: %MB0 -_DOWNLOAD: 1 -_EXCLUDEFROMAUTOADR: 0 -_COMMENT: '' - -_MODULE: '3S' -_SECTION_NAME: 'K_Bus' -_INDEX_IN_PARENT: '1' -_MODULE_NAME: 'K-Bus' -_NODE_ID: 0 -_IECIN: %IB0 -_IECOUT: %QB0 -_IECDIAG: %MB0 -_DOWNLOAD: 1 -_EXCLUDEFROMAUTOADR: 0 -_COMMENT: '' -_END_MODULE - -_MODULE: '3S' -_SECTION_NAME: 'FB_VARS' -_INDEX_IN_PARENT: '2' -_MODULE_NAME: 'Fieldbus variables' -_NODE_ID: 1 -_IECIN: %IB0 -_IECOUT: %QB0 -_IECDIAG: %MB0 -_DOWNLOAD: 1 -_EXCLUDEFROMAUTOADR: 0 -_COMMENT: '' -_END_MODULE -_END_MODULE -PLC_END - - -RESOURCE -{event_task : 'start','Called when program starts','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,1,11986} -{event_task : 'stop','Called when program stops','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,2,11986} -{event_task : 'before_reset','Called before reset takes place','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,3,11986} -{event_task : 'after_reset','Called after reset took place','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,4,11986} -{event_task : 'shutdown','Called before shutdown is performed (Firmware update over ethernet)','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,5,11986} -{event_task : 'excpt_watchdog','Software watchdog of IEC-task expired','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,7,11986} -{event_task : 'excpt_fieldbus','Fieldbus error','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,9,11986} -{event_task : 'excpt_ioupdate','KBus error','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,10,11986} -{event_task : 'excpt_dividebyzero','Division by zero. Only integer operations!','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,18,11986} -{event_task : 'excpt_noncontinuable','Exception handler','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,20,11986} -{event_task : 'after_reading_inputs','Called after reading of inputs','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,28,11986} -{event_task : 'before_writing_outputs','Called before writing of outputs','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,29,11986} -{event_task : 'debug_loop','Debug loop at breakpoint','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,31,11986} -{event_task : 'online_change','Is called after CodeInit() at Online-Change','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,33,11986} -{event_task : 'before_download','Is called before the Download starts','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,34,11986} -{event_task : 'event_login','Is called before the login service is performed','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,501,11986} -{event_task : 'eth_overload','Ethernet Overload','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,750,11986} -{event_task : 'eth_network_ready','Is called directly after the Network and the PLC are initialised','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,751,11986} -{event_task : 'blink_code','New blink code / Blink code cleared ( Call STATUS_GET_LAST_ERROR for details )','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,752,11986} -{event_task : 'interrupt_0','Interrupt Real Time Clock (every second)','','FUNCTION systemevent: DWORD VAR_INPUT dwEvent: DWORD; dwFilter: DWORD; dwOwner: DWORD; END_VAR '}{event_task_info : 0,1000,11986} - -END_RESOURCE - - -_WORKSPACE -_GLOBALVISUALSETTINGS -_VISUALSETTINGSFLAGS : 0,0,0,0 -_VISUALSETTINGSFLAGS : '','','' -_VISUALSETTINGSDYNTEXTFILECOUNT : 0 -_VISUALBITMAPLISTCOUNT : 0 -_END_GLOBALVISUALSETTINGS -_END_WORKSPACE diff --git a/tests/Codesys/_make_exp.cmd b/tests/Codesys/_make_exp.cmd deleted file mode 100644 index 415af58..0000000 --- a/tests/Codesys/_make_exp.cmd +++ /dev/null @@ -1,15 +0,0 @@ -rem Create Codesys EXP file - -rem Build cmd file -set CODESYS="c:\Program Files (x86)\WAGO Software\CoDeSys V2.3\codesys.exe" -set PROJECT=test -del %PROJECT%.EXP -echo file open %PROJECT%.pro >> codesys_cmd_file.cmd -echo project export %PROJECT%.EXP >> codesys_cmd_file.cmd -rem echo file saveas %PROJECT%.lib internallib >> codesys_cmd_file.cmd -echo file close >> codesys_cmd_file.cmd -echo file quit >> codesys_cmd_file.cmd -%CODESYS% /noinfo /cmd codesys_cmd_file.cmd - -rem Clean all when finished -del codesys_cmd_file.cmd \ No newline at end of file diff --git a/tests/Codesys/test.pro b/tests/Codesys/test.pro deleted file mode 100644 index 6904c0c..0000000 Binary files a/tests/Codesys/test.pro and /dev/null differ diff --git a/tests/IecType/_test.bat b/tests/IecType/_test.bat deleted file mode 100644 index 8122004..0000000 --- a/tests/IecType/_test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -call ../config.bat - -for %%f in (test.*.php) do %php% -q "%%f" > "output/%%f.html" - -cd output -for %%f in (*.html) do %diff% "%%f" ../ref/"%%f" -cd .. -pause - -@echo on \ No newline at end of file diff --git a/tests/IecType/ref/test.iecByte.php.html b/tests/IecType/ref/test.iecByte.php.html deleted file mode 100644 index dc6e8a7..0000000 --- a/tests/IecType/ref/test.iecByte.php.html +++ /dev/null @@ -1 +0,0 @@ -125
98
0
0
0
0
0
0
0
0
0
0
255
255
255
255
158
88
97
168
\ No newline at end of file diff --git a/tests/IecType/ref/test.iecDInt.php.html b/tests/IecType/ref/test.iecDInt.php.html deleted file mode 100644 index 1abf31b..0000000 --- a/tests/IecType/ref/test.iecDInt.php.html +++ /dev/null @@ -1 +0,0 @@ -Endianing off
0 --> Packet: 0000_0000_
1 --> Packet: 0001_0000_
-1 --> Packet: ffff_ffff_
2147483647 --> Packet: ffff_7fff_
-2147483648 --> Packet: 0000_8000_
Endianing on
0 --> Packet: 0000_0000_
1 --> Packet: 0000_0001_
-1 --> Packet: ffff_ffff_
2147483647 --> Packet: 7fff_ffff_
-2147483648 --> Packet: 8000_0000_
\ No newline at end of file diff --git a/tests/IecType/ref/test.iecInt.php.html b/tests/IecType/ref/test.iecInt.php.html deleted file mode 100644 index 583ad9b..0000000 --- a/tests/IecType/ref/test.iecInt.php.html +++ /dev/null @@ -1 +0,0 @@ -Endianing off
0 --> Packet: 0000_
1 --> Packet: 0001_
-1 --> Packet: ffff_
32767 --> Packet: 7fff_
-32768 --> Packet: 8000_
Endianing on
0 --> Packet: 0000_
1 --> Packet: 0001_
-1 --> Packet: ffff_
32767 --> Packet: 7fff_
-32768 --> Packet: 8000_
\ No newline at end of file diff --git a/tests/IecType/ref/test.iecReal.php.html b/tests/IecType/ref/test.iecReal.php.html deleted file mode 100644 index a195b00..0000000 --- a/tests/IecType/ref/test.iecReal.php.html +++ /dev/null @@ -1,12 +0,0 @@ -Endianing off
-0 --> Packet: 0000_0000_
-1 --> Packet: 0000_3f80_
--2 --> Packet: 0000_c000_
-0.333333333333 --> Packet: aaab_3eaa_
-25 --> Packet: 0000_41c8_
-Endianing on
-0 --> Packet: 0000_0000_
-1 --> Packet: 3f80_0000_
--2 --> Packet: c000_0000_
-0.333333333333 --> Packet: 3eaa_aaab_
-25 --> Packet: 41c8_0000_
diff --git a/tests/IecType/test.iecByte.php b/tests/IecType/test.iecByte.php deleted file mode 100644 index 8af17c8..0000000 --- a/tests/IecType/test.iecByte.php +++ /dev/null @@ -1,33 +0,0 @@ - 125, // 32098 (DINT) - "1" => 98, - "2" => 0, - "3" => 0, - "4" => 0, // 0 (DINT) - "5" => 0, - "6" => 0, - "7" => 0, - "8" => 0, // 0 (DINT) - "9" => 0, - "10" => 0, - "11" => 0, - "12" => 255, // -1 (DINT) - "13" => 255, - "14" => 255, - "15" => 255, - "16" => 158, // -25000 (INT) - "17" => 88, - "18" => 97, // 25000 (INT) - "19" => 168 -); - -// Print mixed values -foreach($data as $d) - echo ord(IecType::iecBYTE($d)) . "
"; - -?> \ No newline at end of file diff --git a/tests/IecType/test.iecDInt.php b/tests/IecType/test.iecDInt.php deleted file mode 100644 index 24a4820..0000000 --- a/tests/IecType/test.iecDInt.php +++ /dev/null @@ -1,50 +0,0 @@ - 0, - "1" => 1, - "2" => -1, - "3" => pow(2,31)-1, - "4" => -pow(2,31) -); - -function byte2hex($value){ - $h = dechex(($value >> 4) & 0x0F); - $l = dechex($value & 0x0F); - return "$h$l"; -} - -function printPacket($packet){ - $str = ""; - $str .= "Packet: "; - for($i=0;$i"; -// Print mixed values -for($i=0;$i "; - $v = IecType::iecDINT($data[$i], 0); - echo printPacket($v); - "
"; -} - -echo "Endianing on
"; -// Print mixed values -for($i=0;$i "; - $v = IecType::iecDINT($data[$i], 1); - echo printPacket($v); - "
"; -} - -?> \ No newline at end of file diff --git a/tests/IecType/test.iecInt.php b/tests/IecType/test.iecInt.php deleted file mode 100644 index dec812e..0000000 --- a/tests/IecType/test.iecInt.php +++ /dev/null @@ -1,50 +0,0 @@ - 0, - "1" => 1, - "2" => -1, - "3" => pow(2,15)-1, - "4" => -pow(2,15) -); - -function byte2hex($value){ - $h = dechex(($value >> 4) & 0x0F); - $l = dechex($value & 0x0F); - return "$h$l"; -} - -function printPacket($packet){ - $str = ""; - $str .= "Packet: "; - for($i=0;$i"; -// Print mixed values -for($i=0;$i "; - $v = IecType::iecINT($data[$i], 0); - echo printPacket($v); - "
"; -} - -echo "Endianing on
"; -// Print mixed values -for($i=0;$i "; - $v = IecType::iecINT($data[$i], 1); - echo printPacket($v); - "
"; -} - -?> \ No newline at end of file diff --git a/tests/IecType/test.iecReal.php b/tests/IecType/test.iecReal.php deleted file mode 100644 index 30495fd..0000000 --- a/tests/IecType/test.iecReal.php +++ /dev/null @@ -1,50 +0,0 @@ - 0, // -> 0000 0000 - "1" => 1, // -> 3f80 0000 - "2" => -2, // -> c000 0000 - "3" => 0.333333333333, //1/3 -> 3eaa aaab - "4" => 25 // -> 41c8 0000 -); - -function byte2hex($value){ - $h = dechex(($value >> 4) & 0x0F); - $l = dechex($value & 0x0F); - return "$h$l"; -} - -function printPacket($packet){ - $str = ""; - $str .= "Packet: "; - for($i=0;$i\n"; -// Print mixed values -for($i=0;$i "; - $v = IecType::iecREAL($data[$i], 0); - echo printPacket($v); - "
\n"; -} - -echo "Endianing on
\n"; -// Print mixed values -for($i=0;$i "; - $v = IecType::iecREAL($data[$i], 1); - echo printPacket($v); - "
\n"; -} - -?> \ No newline at end of file diff --git a/tests/ModbusMaster/_test.bat b/tests/ModbusMaster/_test.bat deleted file mode 100644 index 8122004..0000000 --- a/tests/ModbusMaster/_test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -call ../config.bat - -for %%f in (test.*.php) do %php% -q "%%f" > "output/%%f.html" - -cd output -for %%f in (*.html) do %diff% "%%f" ../ref/"%%f" -cd .. -pause - -@echo on \ No newline at end of file diff --git a/tests/ModbusMaster/ref/test.tcp.fc16fc3.php.html b/tests/ModbusMaster/ref/test.tcp.fc16fc3.php.html deleted file mode 100644 index 00dd046..0000000 --- a/tests/ModbusMaster/ref/test.tcp.fc16fc3.php.html +++ /dev/null @@ -1,72 +0,0 @@ -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 255 - [8] => 0 - [9] => 255 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 255 - [5] => 255 - [6] => 127 - [7] => 255 - [8] => 128 - [9] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 0 - [8] => 255 - [9] => 255 - [10] => 255 - [11] => 255 - [12] => 255 - [13] => 255 - [14] => 127 - [15] => 255 - [16] => 0 - [17] => 0 - [18] => 128 - [19] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 0 - [6] => 63 - [7] => 128 - [8] => 0 - [9] => 0 - [10] => 192 - [11] => 0 - [12] => 170 - [13] => 171 - [14] => 62 - [15] => 170 - [16] => 0 - [17] => 0 - [18] => 65 - [19] => 200 -) diff --git a/tests/ModbusMaster/ref/test.tcp.fc26.php.html b/tests/ModbusMaster/ref/test.tcp.fc26.php.html deleted file mode 100644 index 7991aa8..0000000 --- a/tests/ModbusMaster/ref/test.tcp.fc26.php.html +++ /dev/null @@ -1 +0,0 @@ -writeMultipleRegister (FC26): DONE \ No newline at end of file diff --git a/tests/ModbusMaster/ref/test.tcp.socket_protocol_mismatch.php.html b/tests/ModbusMaster/ref/test.tcp.socket_protocol_mismatch.php.html deleted file mode 100644 index b25cfe4..0000000 --- a/tests/ModbusMaster/ref/test.tcp.socket_protocol_mismatch.php.html +++ /dev/null @@ -1 +0,0 @@ -Caught exception: Unknown socket protocol, should be 'TCP' or 'UDP' diff --git a/tests/ModbusMaster/ref/test.udp.fc16fc3.php.html b/tests/ModbusMaster/ref/test.udp.fc16fc3.php.html deleted file mode 100644 index 00dd046..0000000 --- a/tests/ModbusMaster/ref/test.udp.fc16fc3.php.html +++ /dev/null @@ -1,72 +0,0 @@ -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 255 - [8] => 0 - [9] => 255 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 255 - [5] => 255 - [6] => 127 - [7] => 255 - [8] => 128 - [9] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 0 - [8] => 255 - [9] => 255 - [10] => 255 - [11] => 255 - [12] => 255 - [13] => 255 - [14] => 127 - [15] => 255 - [16] => 0 - [17] => 0 - [18] => 128 - [19] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 0 - [6] => 63 - [7] => 128 - [8] => 0 - [9] => 0 - [10] => 192 - [11] => 0 - [12] => 170 - [13] => 171 - [14] => 62 - [15] => 170 - [16] => 0 - [17] => 0 - [18] => 65 - [19] => 200 -) diff --git a/tests/ModbusMaster/ref/test.udp.fc26.php.html b/tests/ModbusMaster/ref/test.udp.fc26.php.html deleted file mode 100644 index 7991aa8..0000000 --- a/tests/ModbusMaster/ref/test.udp.fc26.php.html +++ /dev/null @@ -1 +0,0 @@ -writeMultipleRegister (FC26): DONE \ No newline at end of file diff --git a/tests/ModbusMaster/test.tcp.fc16fc3.php b/tests/ModbusMaster/test.tcp.fc16fc3.php deleted file mode 100644 index bd0b765..0000000 --- a/tests/ModbusMaster/test.tcp.fc16fc3.php +++ /dev/null @@ -1,44 +0,0 @@ -writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - INT -$data = array(0, 1, -1, pow(2,15)-1, -pow(2,15)); -$dataTypes = array("INT", "INT", "INT", "INT", "INT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - DINT -$data = array(0, 1, -1, pow(2,31)-1, -pow(2,31)); -$dataTypes = array("DINT", "DINT", "DINT", "DINT", "DINT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -// Data to be writen - REAL -$data = array(0, 1, -2, 1/3, 25); -$dataTypes = array("REAL", "REAL", "REAL", "REAL", "REAL"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -?> \ No newline at end of file diff --git a/tests/ModbusMaster/test.tcp.fc26.php b/tests/ModbusMaster/test.tcp.fc26.php deleted file mode 100644 index 2c76b7f..0000000 --- a/tests/ModbusMaster/test.tcp.fc26.php +++ /dev/null @@ -1,24 +0,0 @@ -readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); - -if(!$recData) { - // Print error information if any - echo "
Error:
" . $modbus->errstr . "
"; - // - exit(); -} - -// Print status information -echo "writeMultipleRegister (FC26): DONE"; -?> \ No newline at end of file diff --git a/tests/ModbusMaster/test.tcp.socket_protocol_mismatch.php b/tests/ModbusMaster/test.tcp.socket_protocol_mismatch.php deleted file mode 100644 index aa5f691..0000000 --- a/tests/ModbusMaster/test.tcp.socket_protocol_mismatch.php +++ /dev/null @@ -1,22 +0,0 @@ -readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); -} catch (Exception $e) { - echo 'Caught exception: ', $e->getMessage(), "\n"; - exit(); -} -// Should through an Exception - -// Print status information -echo "Should never reach this line!"; \ No newline at end of file diff --git a/tests/ModbusMaster/test.udp.fc16fc3.php b/tests/ModbusMaster/test.udp.fc16fc3.php deleted file mode 100644 index 20dee62..0000000 --- a/tests/ModbusMaster/test.udp.fc16fc3.php +++ /dev/null @@ -1,44 +0,0 @@ -writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - INT -$data = array(0, 1, -1, pow(2,15)-1, -pow(2,15)); -$dataTypes = array("INT", "INT", "INT", "INT", "INT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - DINT -$data = array(0, 1, -1, pow(2,31)-1, -pow(2,31)); -$dataTypes = array("DINT", "DINT", "DINT", "DINT", "DINT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -// Data to be writen - REAL -$data = array(0, 1, -2, 1/3, 25); -$dataTypes = array("REAL", "REAL", "REAL", "REAL", "REAL"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -?> \ No newline at end of file diff --git a/tests/ModbusMaster/test.udp.fc26.php b/tests/ModbusMaster/test.udp.fc26.php deleted file mode 100644 index 02352ac..0000000 --- a/tests/ModbusMaster/test.udp.fc26.php +++ /dev/null @@ -1,24 +0,0 @@ -readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); - -if(!$recData) { - // Print error information if any - echo "
Error:
" . $modbus->errstr . "
"; - // - exit(); -} - -// Print status information -echo "writeMultipleRegister (FC26): DONE"; -?> \ No newline at end of file diff --git a/tests/ModbusMasterTcp/_test.bat b/tests/ModbusMasterTcp/_test.bat deleted file mode 100644 index 8122004..0000000 --- a/tests/ModbusMasterTcp/_test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -call ../config.bat - -for %%f in (test.*.php) do %php% -q "%%f" > "output/%%f.html" - -cd output -for %%f in (*.html) do %diff% "%%f" ../ref/"%%f" -cd .. -pause - -@echo on \ No newline at end of file diff --git a/tests/ModbusMasterTcp/ref/test.fc16fc3.php.html b/tests/ModbusMasterTcp/ref/test.fc16fc3.php.html deleted file mode 100644 index 00dd046..0000000 --- a/tests/ModbusMasterTcp/ref/test.fc16fc3.php.html +++ /dev/null @@ -1,72 +0,0 @@ -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 255 - [8] => 0 - [9] => 255 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 255 - [5] => 255 - [6] => 127 - [7] => 255 - [8] => 128 - [9] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 0 - [8] => 255 - [9] => 255 - [10] => 255 - [11] => 255 - [12] => 255 - [13] => 255 - [14] => 127 - [15] => 255 - [16] => 0 - [17] => 0 - [18] => 128 - [19] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 0 - [6] => 63 - [7] => 128 - [8] => 0 - [9] => 0 - [10] => 192 - [11] => 0 - [12] => 170 - [13] => 171 - [14] => 62 - [15] => 170 - [16] => 0 - [17] => 0 - [18] => 65 - [19] => 200 -) diff --git a/tests/ModbusMasterTcp/ref/test.fc26.php.html b/tests/ModbusMasterTcp/ref/test.fc26.php.html deleted file mode 100644 index 7991aa8..0000000 --- a/tests/ModbusMasterTcp/ref/test.fc26.php.html +++ /dev/null @@ -1 +0,0 @@ -writeMultipleRegister (FC26): DONE \ No newline at end of file diff --git a/tests/ModbusMasterTcp/test.fc16fc3.php b/tests/ModbusMasterTcp/test.fc16fc3.php deleted file mode 100644 index 2fc3ee2..0000000 --- a/tests/ModbusMasterTcp/test.fc16fc3.php +++ /dev/null @@ -1,44 +0,0 @@ -writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - INT -$data = array(0, 1, -1, pow(2,15)-1, -pow(2,15)); -$dataTypes = array("INT", "INT", "INT", "INT", "INT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - DINT -$data = array(0, 1, -1, pow(2,31)-1, -pow(2,31)); -$dataTypes = array("DINT", "DINT", "DINT", "DINT", "DINT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -// Data to be writen - REAL -$data = array(0, 1, -2, 1/3, 25); -$dataTypes = array("REAL", "REAL", "REAL", "REAL", "REAL"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -?> \ No newline at end of file diff --git a/tests/ModbusMasterTcp/test.fc26.php b/tests/ModbusMasterTcp/test.fc26.php deleted file mode 100644 index 076ab22..0000000 --- a/tests/ModbusMasterTcp/test.fc26.php +++ /dev/null @@ -1,24 +0,0 @@ -readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); - -if(!$recData) { - // Print error information if any - echo "
Error:
" . $modbus->errstr . "
"; - // - exit(); -} - -// Print status information -echo "writeMultipleRegister (FC26): DONE"; -?> \ No newline at end of file diff --git a/tests/ModbusMasterUdp/_test.bat b/tests/ModbusMasterUdp/_test.bat deleted file mode 100644 index 8122004..0000000 --- a/tests/ModbusMasterUdp/_test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -call ../config.bat - -for %%f in (test.*.php) do %php% -q "%%f" > "output/%%f.html" - -cd output -for %%f in (*.html) do %diff% "%%f" ../ref/"%%f" -cd .. -pause - -@echo on \ No newline at end of file diff --git a/tests/ModbusMasterUdp/ref/test.fc15fc1.php.html b/tests/ModbusMasterUdp/ref/test.fc15fc1.php.html deleted file mode 100644 index 55a3de0..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc15fc1.php.html +++ /dev/null @@ -1,66 +0,0 @@ -array(32) { - [0]=> - bool(true) - [1]=> - bool(false) - [2]=> - bool(true) - [3]=> - bool(true) - [4]=> - bool(false) - [5]=> - bool(true) - [6]=> - bool(true) - [7]=> - bool(true) - [8]=> - bool(true) - [9]=> - bool(true) - [10]=> - bool(true) - [11]=> - bool(true) - [12]=> - bool(false) - [13]=> - bool(false) - [14]=> - bool(false) - [15]=> - bool(false) - [16]=> - bool(false) - [17]=> - bool(false) - [18]=> - bool(false) - [19]=> - bool(false) - [20]=> - bool(true) - [21]=> - bool(true) - [22]=> - bool(true) - [23]=> - bool(true) - [24]=> - bool(true) - [25]=> - bool(true) - [26]=> - bool(true) - [27]=> - bool(true) - [28]=> - bool(true) - [29]=> - bool(true) - [30]=> - bool(true) - [31]=> - bool(true) -} diff --git a/tests/ModbusMasterUdp/ref/test.fc16fc3.php.html b/tests/ModbusMasterUdp/ref/test.fc16fc3.php.html deleted file mode 100644 index 00dd046..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc16fc3.php.html +++ /dev/null @@ -1,72 +0,0 @@ -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 255 - [8] => 0 - [9] => 255 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 255 - [5] => 255 - [6] => 127 - [7] => 255 - [8] => 128 - [9] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 0 - [8] => 255 - [9] => 255 - [10] => 255 - [11] => 255 - [12] => 255 - [13] => 255 - [14] => 127 - [15] => 255 - [16] => 0 - [17] => 0 - [18] => 128 - [19] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 0 - [6] => 63 - [7] => 128 - [8] => 0 - [9] => 0 - [10] => 192 - [11] => 0 - [12] => 170 - [13] => 171 - [14] => 62 - [15] => 170 - [16] => 0 - [17] => 0 - [18] => 65 - [19] => 200 -) diff --git a/tests/ModbusMasterUdp/ref/test.fc16fc3bind.php.html b/tests/ModbusMasterUdp/ref/test.fc16fc3bind.php.html deleted file mode 100644 index 00dd046..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc16fc3bind.php.html +++ /dev/null @@ -1,72 +0,0 @@ -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 255 - [8] => 0 - [9] => 255 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 1 - [4] => 255 - [5] => 255 - [6] => 127 - [7] => 255 - [8] => 128 - [9] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 1 - [6] => 0 - [7] => 0 - [8] => 255 - [9] => 255 - [10] => 255 - [11] => 255 - [12] => 255 - [13] => 255 - [14] => 127 - [15] => 255 - [16] => 0 - [17] => 0 - [18] => 128 - [19] => 0 -) -Array -( - [0] => 0 - [1] => 0 - [2] => 0 - [3] => 0 - [4] => 0 - [5] => 0 - [6] => 63 - [7] => 128 - [8] => 0 - [9] => 0 - [10] => 192 - [11] => 0 - [12] => 170 - [13] => 171 - [14] => 62 - [15] => 170 - [16] => 0 - [17] => 0 - [18] => 65 - [19] => 200 -) diff --git a/tests/ModbusMasterUdp/ref/test.fc2.php.html b/tests/ModbusMasterUdp/ref/test.fc2.php.html deleted file mode 100644 index 5baae72..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc2.php.html +++ /dev/null @@ -1,7 +0,0 @@ -Test should pass when %IX0.0==FALSE and %IX0.1==TRUE -array(2) { - [0]=> - bool(false) - [1]=> - bool(true) -} diff --git a/tests/ModbusMasterUdp/ref/test.fc26.php.html b/tests/ModbusMasterUdp/ref/test.fc26.php.html deleted file mode 100644 index 7991aa8..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc26.php.html +++ /dev/null @@ -1 +0,0 @@ -writeMultipleRegister (FC26): DONE \ No newline at end of file diff --git a/tests/ModbusMasterUdp/ref/test.fc26bind.php.html b/tests/ModbusMasterUdp/ref/test.fc26bind.php.html deleted file mode 100644 index 7991aa8..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc26bind.php.html +++ /dev/null @@ -1 +0,0 @@ -writeMultipleRegister (FC26): DONE \ No newline at end of file diff --git a/tests/ModbusMasterUdp/ref/test.fc4.php.html b/tests/ModbusMasterUdp/ref/test.fc4.php.html deleted file mode 100644 index 4cbe5ae..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc4.php.html +++ /dev/null @@ -1,11 +0,0 @@ -Test should pass when %IX0.0==FALSE and %IX0.1==TRUE -array(4) { - [0]=> - int(0) - [1]=> - int(2) - [2]=> - int(0) - [3]=> - int(0) -} diff --git a/tests/ModbusMasterUdp/ref/test.fc5.php.html b/tests/ModbusMasterUdp/ref/test.fc5.php.html deleted file mode 100644 index a6a24be..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc5.php.html +++ /dev/null @@ -1,5 +0,0 @@ -Array -( - [0] => 0 - [1] => 5 -) diff --git a/tests/ModbusMasterUdp/ref/test.fc6fc3.php.html b/tests/ModbusMasterUdp/ref/test.fc6fc3.php.html deleted file mode 100644 index 6102dcd..0000000 --- a/tests/ModbusMasterUdp/ref/test.fc6fc3.php.html +++ /dev/null @@ -1,5 +0,0 @@ -Array -( - [0] => 207 - [1] => 199 -) diff --git a/tests/ModbusMasterUdp/test.fc15fc1.php b/tests/ModbusMasterUdp/test.fc15fc1.php deleted file mode 100644 index 5a7d8c4..0000000 --- a/tests/ModbusMasterUdp/test.fc15fc1.php +++ /dev/null @@ -1,22 +0,0 @@ -writeMultipleCoils(0, 12288, $data); -//echo $modbus->status; -//$modbus->status = ""; -//echo "\n\n"; -// Read data - FC 1 -$recData = $modbus->readCoils(0, 12288, 32); -//echo $modbus->status; -//echo "\n\n"; -var_dump($recData); \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc16fc3.php b/tests/ModbusMasterUdp/test.fc16fc3.php deleted file mode 100644 index dff33c7..0000000 --- a/tests/ModbusMasterUdp/test.fc16fc3.php +++ /dev/null @@ -1,44 +0,0 @@ -writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - INT -$data = array(0, 1, -1, pow(2,15)-1, -pow(2,15)); -$dataTypes = array("INT", "INT", "INT", "INT", "INT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - DINT -$data = array(0, 1, -1, pow(2,31)-1, -pow(2,31)); -$dataTypes = array("DINT", "DINT", "DINT", "DINT", "DINT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -// Data to be writen - REAL -$data = array(0, 1, -2, 1/3, 25); -$dataTypes = array("REAL", "REAL", "REAL", "REAL", "REAL"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -?> \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc16fc3bind.php b/tests/ModbusMasterUdp/test.fc16fc3bind.php deleted file mode 100644 index 5d3bed9..0000000 --- a/tests/ModbusMasterUdp/test.fc16fc3bind.php +++ /dev/null @@ -1,45 +0,0 @@ -client = $test_bind_client_ip; - -// Data to be writen - BYTE -$data = array(0, 1, 1, pow(2,8)-1, pow(2,8)-1); -$dataTypes = array("BYTE", "BYTE", "BYTE", "BYTE", "BYTE"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - INT -$data = array(0, 1, -1, pow(2,15)-1, -pow(2,15)); -$dataTypes = array("INT", "INT", "INT", "INT", "INT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 5); -print_r($recData); - -// Data to be writen - DINT -$data = array(0, 1, -1, pow(2,31)-1, -pow(2,31)); -$dataTypes = array("DINT", "DINT", "DINT", "DINT", "DINT"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -// Data to be writen - REAL -$data = array(0, 1, -2, 1/3, 25); -$dataTypes = array("REAL", "REAL", "REAL", "REAL", "REAL"); -// Write data - FC 16 -$modbus->writeMultipleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 10); -print_r($recData); - -?> \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc2.php b/tests/ModbusMasterUdp/test.fc2.php deleted file mode 100644 index 3c73077..0000000 --- a/tests/ModbusMasterUdp/test.fc2.php +++ /dev/null @@ -1,14 +0,0 @@ -readInputDiscretes(0, 0, 2); - -var_dump($recData); \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc26.php b/tests/ModbusMasterUdp/test.fc26.php deleted file mode 100644 index 1a889de..0000000 --- a/tests/ModbusMasterUdp/test.fc26.php +++ /dev/null @@ -1,24 +0,0 @@ -readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); - -if(!$recData) { - // Print error information if any - echo "
Error:
" . $modbus->errstr . "
"; - // - exit(); -} - -// Print status information -echo "writeMultipleRegister (FC26): DONE"; -?> \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc26bind.php b/tests/ModbusMasterUdp/test.fc26bind.php deleted file mode 100644 index bf24f9e..0000000 --- a/tests/ModbusMasterUdp/test.fc26bind.php +++ /dev/null @@ -1,25 +0,0 @@ -client = $test_bind_client_ip; - -// Data to be writen -$data = array(1000, 2000, 1.250, 1.250); -$dataTypes = array("REAL", "REAL", "REAL", "REAL"); - -// FC23 -$recData = $modbus->readWriteRegisters(0, 12288, 6, 12288, $data, $dataTypes); - -if(!$recData) { - // Print error information if any - echo "
Error:
" . $modbus->errstr . "
"; - // - exit(); -} - -// Print status information -echo "writeMultipleRegister (FC26): DONE"; -?> \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc4.php b/tests/ModbusMasterUdp/test.fc4.php deleted file mode 100644 index dee4929..0000000 --- a/tests/ModbusMasterUdp/test.fc4.php +++ /dev/null @@ -1,14 +0,0 @@ -readMultipleInputRegisters(0, 0, 2); - -var_dump($recData); \ No newline at end of file diff --git a/tests/ModbusMasterUdp/test.fc5.php b/tests/ModbusMasterUdp/test.fc5.php deleted file mode 100644 index 95e6f92..0000000 --- a/tests/ModbusMasterUdp/test.fc5.php +++ /dev/null @@ -1,23 +0,0 @@ -writeSingleRegister(0, 12288, array(0), array('WORD')); - -// Write single coil - FC5 -$modbus->writeSingleCoil(0, 12288, $data_true); -$modbus->writeSingleCoil(0, 12289, $data_false); -$modbus->writeSingleCoil(0, 12290, $data_true); -$modbus->writeSingleCoil(0, 12291, $data_false); - -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 1); -print_r($recData); diff --git a/tests/ModbusMasterUdp/test.fc6fc3.php b/tests/ModbusMasterUdp/test.fc6fc3.php deleted file mode 100644 index 03c39f5..0000000 --- a/tests/ModbusMasterUdp/test.fc6fc3.php +++ /dev/null @@ -1,15 +0,0 @@ -writeSingleRegister(0, 12288, $data, $dataTypes); -// Read data - FC3 -$recData = $modbus->readMultipleRegisters(0, 12288, 1); -print_r($recData); diff --git a/tests/PhpType/_test.bat b/tests/PhpType/_test.bat deleted file mode 100644 index 8122004..0000000 --- a/tests/PhpType/_test.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -call ../config.bat - -for %%f in (test.*.php) do %php% -q "%%f" > "output/%%f.html" - -cd output -for %%f in (*.html) do %diff% "%%f" ../ref/"%%f" -cd .. -pause - -@echo on \ No newline at end of file diff --git a/tests/PhpType/ref/test.bytes2mixed.php.html b/tests/PhpType/ref/test.bytes2mixed.php.html deleted file mode 100644 index 952bc9d..0000000 --- a/tests/PhpType/ref/test.bytes2mixed.php.html +++ /dev/null @@ -1 +0,0 @@ -32098
0
0
-1
-25000
25000
\ No newline at end of file diff --git a/tests/PhpType/ref/test.bytes2real.php.html b/tests/PhpType/ref/test.bytes2real.php.html deleted file mode 100644 index 7d44edb..0000000 --- a/tests/PhpType/ref/test.bytes2real.php.html +++ /dev/null @@ -1 +0,0 @@ -1000
2000
1.25
\ No newline at end of file diff --git a/tests/PhpType/ref/test.bytes2signedint.php.html b/tests/PhpType/ref/test.bytes2signedint.php.html deleted file mode 100644 index a2b10ea..0000000 --- a/tests/PhpType/ref/test.bytes2signedint.php.html +++ /dev/null @@ -1 +0,0 @@ --1
0
1
-2147483648
2147483647
diff --git a/tests/PhpType/ref/test.bytes2string.php.html b/tests/PhpType/ref/test.bytes2string.php.html deleted file mode 100644 index 31bbf09..0000000 --- a/tests/PhpType/ref/test.bytes2string.php.html +++ /dev/null @@ -1 +0,0 @@ -eHll oowlr!da
Hello world!
\ No newline at end of file diff --git a/tests/PhpType/ref/test.bytes2unsignedint.php.html b/tests/PhpType/ref/test.bytes2unsignedint.php.html deleted file mode 100644 index 29be8ee..0000000 --- a/tests/PhpType/ref/test.bytes2unsignedint.php.html +++ /dev/null @@ -1,6 +0,0 @@ -float(4294967295) -
int(0) -
int(1) -
float(2147483648) -
int(2147483647) -
diff --git a/tests/PhpType/ref/test.strangearray.size.php.html b/tests/PhpType/ref/test.strangearray.size.php.html deleted file mode 100644 index d0e619d..0000000 --- a/tests/PhpType/ref/test.strangearray.size.php.html +++ /dev/null @@ -1 +0,0 @@ -Exception 'Data are not in array 2 or 4 bytes'
25602
Exception 'Data are not in array 2 or 4 bytes'
25602
Exception 'Data are not in array 2 or 4 bytes'
\ No newline at end of file diff --git a/tests/PhpType/ref/test.strangearray.textarray.php.html b/tests/PhpType/ref/test.strangearray.textarray.php.html deleted file mode 100644 index 734d099..0000000 --- a/tests/PhpType/ref/test.strangearray.textarray.php.html +++ /dev/null @@ -1 +0,0 @@ -Exception 'Data are not numeric' \ No newline at end of file diff --git a/tests/PhpType/test.bytes2mixed.php b/tests/PhpType/test.bytes2mixed.php deleted file mode 100644 index 6b1b391..0000000 --- a/tests/PhpType/test.bytes2mixed.php +++ /dev/null @@ -1,37 +0,0 @@ - 125, // 32098 (DINT) - "1" => 98, - "2" => 0, - "3" => 0, - "4" => 0, // 0 (DINT) - "5" => 0, - "6" => 0, - "7" => 0, - "8" => 0, // 0 (DINT) - "9" => 0, - "10" => 0, - "11" => 0, - "12" => 255, // -1 (DINT) - "13" => 255, - "14" => 255, - "15" => 255, - "16" => 158, // -25000 (INT) - "17" => 88, - "18" => 97, // 25000 (INT) - "19" => 168 -); - -// Print mixed values -echo PhpType::bytes2unsignedInt(array_slice($data, 0, 4)) . "
"; -echo PhpType::bytes2signedInt(array_slice($data, 4, 4)) . "
"; -echo PhpType::bytes2signedInt(array_slice($data, 8, 4)) . "
"; -echo PhpType::bytes2signedInt(array_slice($data, 12, 4)) . "
"; -echo PhpType::bytes2signedInt(array_slice($data, 16, 2)) . "
"; -echo PhpType::bytes2signedInt(array_slice($data, 18, 2)) . "
"; - -?> \ No newline at end of file diff --git a/tests/PhpType/test.bytes2real.php b/tests/PhpType/test.bytes2real.php deleted file mode 100644 index b6acd56..0000000 --- a/tests/PhpType/test.bytes2real.php +++ /dev/null @@ -1,27 +0,0 @@ - 0, - 1 => 0, - 2 => 68, - 3 => 122, - 4 => 0, - 5 => 0, - 6 => 68, - 7 => 250, - 8 => 0, - 9 => 0, - 10 => 63, - 11 => 160, -); - -$dword = array_chunk($data, 4); - -// Print float interpretation of the real value -echo PhpType::bytes2float($dword[0]) . "
"; -echo PhpType::bytes2float($dword[1]) . "
"; -echo PhpType::bytes2float($dword[2]) . "
"; -?> \ No newline at end of file diff --git a/tests/PhpType/test.bytes2signedint.php b/tests/PhpType/test.bytes2signedint.php deleted file mode 100644 index 567299c..0000000 --- a/tests/PhpType/test.bytes2signedint.php +++ /dev/null @@ -1,35 +0,0 @@ -"; -} -?> diff --git a/tests/PhpType/test.bytes2string.php b/tests/PhpType/test.bytes2string.php deleted file mode 100644 index 547502b..0000000 --- a/tests/PhpType/test.bytes2string.php +++ /dev/null @@ -1,28 +0,0 @@ -"; -echo PhpType::bytes2string($data, true) . "
"; - -?> diff --git a/tests/PhpType/test.bytes2unsignedint.php b/tests/PhpType/test.bytes2unsignedint.php deleted file mode 100644 index 9aa6f37..0000000 --- a/tests/PhpType/test.bytes2unsignedint.php +++ /dev/null @@ -1,36 +0,0 @@ -"; -} -?> diff --git a/tests/PhpType/test.strangearray.size.php b/tests/PhpType/test.strangearray.size.php deleted file mode 100644 index ba817e2..0000000 --- a/tests/PhpType/test.strangearray.size.php +++ /dev/null @@ -1,44 +0,0 @@ - 100, // 32098 (DINT) - "1" => 2, - "2" => 0, - "3" => 0, - "4" => 100, // 32098 (DINT) - "5" => 2 -); - -// Print mixed values -try { - echo PhpType::bytes2unsignedInt(array_slice($data, 0, 1)) . "
"; -} catch(Exception $e) { - echo "Exception 'Data are not in array 2 or 4 bytes'". "
"; -} -try { - echo PhpType::bytes2unsignedInt(array_slice($data, 0, 2)). "
"; -} catch(Exception $e) { - echo "Exception 'Data are not in array 2 or 4 bytes'". "
"; -} -try { - echo PhpType::bytes2unsignedInt(array_slice($data, 0, 3)). "
"; -} catch(Exception $e) { - echo "Exception 'Data are not in array 2 or 4 bytes'". "
"; -} -try { - echo PhpType::bytes2unsignedInt(array_slice($data, 0, 4)). "
"; -} catch(Exception $e) { - echo "Exception 'Data are not in array 2 or 4 bytes'". "
"; -} -try { - echo PhpType::bytes2unsignedInt(array_slice($data, 0, 5)). "
"; -} catch(Exception $e) { - echo "Exception 'Data are not in array 2 or 4 bytes'". "
"; -} -?> \ No newline at end of file diff --git a/tests/PhpType/test.strangearray.textarray.php b/tests/PhpType/test.strangearray.textarray.php deleted file mode 100644 index 10306a0..0000000 --- a/tests/PhpType/test.strangearray.textarray.php +++ /dev/null @@ -1,22 +0,0 @@ - 100, // 32098 (DINT) - "1" => "e", - "2" => 0, - "3" => 0 -); - -// Print mixed values -try { - echo PhpType::bytes2unsignedInt(array_slice($data, 0, 4)); -} catch(Exception $e) { - echo "Exception 'Data are not numeric'"; -} -?> diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 1dbebf5..0000000 --- a/tests/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Probably broken and dubious. - -Left from the original repo. diff --git a/tests/config.bat b/tests/config.bat deleted file mode 100644 index ef49dfc..0000000 --- a/tests/config.bat +++ /dev/null @@ -1,5 +0,0 @@ -set php=c:\Program_Files\xampp\php\php.exe -rem set php=C:\PHP\versions\php-5.2.6-Win32\php.exe -d auto_prepend_file=C:\PHP\locale.php -set diff="diff.exe" -rem set testUri=http://localHost/nette/_trunk/tests -rem set wget=wget.exe diff --git a/tests/config.php b/tests/config.php deleted file mode 100644 index 9c71b4a..0000000 --- a/tests/config.php +++ /dev/null @@ -1,3 +0,0 @@ -