0.6 release
This commit is contained in:
@@ -34,7 +34,7 @@ class IecType {
|
||||
* @return value IEC BYTE data type
|
||||
*
|
||||
*/
|
||||
function iecBYTE($value) {
|
||||
public static function iecBYTE($value) {
|
||||
return chr($value & 0xFF);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class IecType {
|
||||
* @return value IEC-1131 INT data type
|
||||
*
|
||||
*/
|
||||
function iecINT($value) {
|
||||
public static function iecINT($value) {
|
||||
return self::iecBYTE(($value >> 8) & 0x00FF) .
|
||||
self::iecBYTE(($value & 0x00FF));
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class IecType {
|
||||
* @return value IEC-1131 INT data type
|
||||
*
|
||||
*/
|
||||
function iecDINT($value, $endianness = 0) {
|
||||
public static function iecDINT($value, $endianness = 0) {
|
||||
// result with right endianness
|
||||
return self::endianness($value, $endianness);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class IecType {
|
||||
* @param value endianness defines endian codding (little endian == 0, big endian == 1)
|
||||
* @return value IEC-1131 REAL data type
|
||||
*/
|
||||
function iecREAL($value, $endianness = 0) {
|
||||
public static function iecREAL($value, $endianness = 0) {
|
||||
// iecREAL representation
|
||||
$real = self::float2iecReal($value);
|
||||
// result with right endianness
|
||||
@@ -95,7 +95,7 @@ class IecType {
|
||||
* @param float value to be converted
|
||||
* @return value IEC REAL data type
|
||||
*/
|
||||
private function float2iecReal($value) {
|
||||
private static function float2iecReal($value) {
|
||||
// get float binary string
|
||||
$float = pack("f", $value);
|
||||
// set 32-bit unsigned integer of the float
|
||||
@@ -113,7 +113,7 @@ class IecType {
|
||||
* @param bool $endianness
|
||||
* @return int
|
||||
*/
|
||||
private function endianness($value, $endianness = 0) {
|
||||
private static function endianness($value, $endianness = 0) {
|
||||
if ($endianness == 0)
|
||||
return
|
||||
self::iecBYTE(($value >> 8) & 0x000000FF) .
|
||||
|
||||
Reference in New Issue
Block a user