コード例 #1
0
        public byte[] write(S7Client aClient)
        {
            mNeedWrite      = false;
            byte[] lBuffer  = getValueForPLC();

            int lResult = aClient.WriteArea((int)mMemoryType, mDB, mStart, mLength, (int)mDataType, lBuffer);
            if (lResult != 0)
            {
                mConnection.reportError(Description + " " + aClient.ErrorText(lResult));
                return null;
            }
            else
            {
                return lBuffer;
            }
        }
コード例 #2
0
 public void read(S7Client aClient)
 {
     if (mNeedWrite != true)
     {
         byte[] lBuff = new byte[mBufferLength];
         int lResult = aClient.ReadArea((int)mMemoryType, mDB, mStart, mLength, (int)mDataType, lBuff);
         if (lResult == 0)
         {
             setValueFromPLC(lBuff);
         }
         else
         {
             mConnection.reportError(Description + " " + aClient.ErrorText(lResult));
         }
     }
 }