C# Class S7.Net.Conversion

ファイルを表示 Open project: killnine/s7netplus

Public Methods

Method Description
BinStringToByte ( this txt ) : byte?

Converts a binary string to a byte. Can return null.

BinStringToInt32 ( this txt ) : int

Converts a binary string to Int32 value

ConvertToDouble ( this input ) : double

Converts from DWord (DBD) to double

ConvertToInt ( this input ) : Int32

Converts from UInt32 value to Int32 value; it's used to retrieve negative values from DBDs

ConvertToShort ( this input ) : short

Converts from ushort value to short value; it's used to retrieve negative values from words

ConvertToUInt ( this input ) : UInt32

Converts from Int32 value to UInt32 value; it's used to pass negative values to DBDs

ConvertToUshort ( this input ) : ushort

Converts from short value to ushort value; it's used to pass negative values to DWs

SelectBit ( this data, int bitPosition ) : bool

Helper to get a bit value given a byte and the bit index. Example: DB1.DBX0.5 -> var bytes = ReadBytes(DB1.DBW0); bool bit = bytes[0].SelectBit(5);

ValToBinString ( this value ) : string

Converts the value to a binary string

Method Details

BinStringToByte() public static method

Converts a binary string to a byte. Can return null.
public static BinStringToByte ( this txt ) : byte?
txt this
return byte?

BinStringToInt32() public static method

Converts a binary string to Int32 value
public static BinStringToInt32 ( this txt ) : int
txt this
return int

ConvertToDouble() public static method

Converts from DWord (DBD) to double
public static ConvertToDouble ( this input ) : double
input this
return double

ConvertToInt() public static method

Converts from UInt32 value to Int32 value; it's used to retrieve negative values from DBDs
public static ConvertToInt ( this input ) : Int32
input this
return System.Int32

ConvertToShort() public static method

Converts from ushort value to short value; it's used to retrieve negative values from words
public static ConvertToShort ( this input ) : short
input this
return short

ConvertToUInt() public static method

Converts from Int32 value to UInt32 value; it's used to pass negative values to DBDs
public static ConvertToUInt ( this input ) : UInt32
input this
return System.UInt32

ConvertToUshort() public static method

Converts from short value to ushort value; it's used to pass negative values to DWs
public static ConvertToUshort ( this input ) : ushort
input this
return ushort

SelectBit() public static method

Helper to get a bit value given a byte and the bit index. Example: DB1.DBX0.5 -> var bytes = ReadBytes(DB1.DBW0); bool bit = bytes[0].SelectBit(5);
public static SelectBit ( this data, int bitPosition ) : bool
data this
bitPosition int
return bool

ValToBinString() public static method

Converts the value to a binary string
public static ValToBinString ( this value ) : string
value this
return string