Skip to content

4.5 Encapsulating Interface again for protocol API

parallelbgls edited this page Jun 29, 2017 · 1 revision

If you want to encapsulate interface again, please using Utility.
The reason is simple: utility is programmed based on protocol, bute Machine has already encapsulate again that read and write datas only using bytes.

Have a look with the GetCoil method, you can write this method like:

public bool GetCoil(int address)
{
    var ans = _modbusUtility.GetDatas("0X " + address, 1);
    int pos = 0, subpos = address;
    return ValueHelper.GetInstance(Endian).GetBit(ans, ref pos, ref subpos) == 1;
}

Home

Clone this wiki locally