/// <summary>
 /// Send values to the data provider
 /// </summary>
 /// <param name="data">
 /// Data to be send. Always null after return. Data buffer must be returned to the pool.
 /// </param>
 /// <param name="retries">Number of retries to wrtie data.</param>
 /// <returns>Result of the operation.</returns>
 AL_ReadData_Result IApplicationLayerMaster.WriteData(ref IWriteValue data, byte retries)
 {
     lock (this)
     {
         InterFrameStopwatch.Reset();
         InterFrameStopwatch.Start();
         m_wPackNum++;
         myStatistic.IncStTxFrameCounter();
         if ((m_errorfrequency > 0) && (m_rPackNum % (100 / (ulong)m_errorfrequency)) == 0)
         {
             data.ReturnEmptyEnvelope();
             data = null;
             myStatistic.IncStRxFragmentedCounter();
             myStatistic.TxDataBlock(false);
             return(AL_ReadData_Result.ALRes_DatTransferErrr);
         }
         ((Message)data).WriteToDB();
         data.ReturnEmptyEnvelope();
         data = null;
         myStatistic.IncStTxFrameCounter();
         myStatistic.IncStRxFrameCounter();
         myStatistic.TxDataBlock(true);
         myStatistic.TimeMaxResponseDelayAdd(InterFrameStopwatch.ElapsedMilliseconds);
         return(AL_ReadData_Result.ALRes_Success);
     }
 }
Exemple #2
0
 /// <summary>
 /// Send values to the data provider
 /// </summary>
 /// <param name="data">
 /// Data to be send. Always null after return. Data buffer must be returned to the pool.
 /// </param>
 /// <param name="retries">Number of retries to wrtie data.</param>
 /// <returns>Result of the operation.</returns>
 AL_ReadData_Result IApplicationLayerMaster.WriteData(ref IWriteValue data, byte retries)
 {
     m_wPackNum++;
     myStatistic.IncStTxFrameCounter();
     if ((m_errorfrequency > 0) && (m_wPackNum % (ulong)m_errorfrequency == 0))
     {
         data.ReturnEmptyEnvelope();
         data = null;
         myStatistic.IncStRxFragmentedCounter();
         myStatistic.TxDataBlock(false);
         return(AL_ReadData_Result.ALRes_DatTransferErrr);
     }
     ((NULL_message)data).WriteToDB();
     data.ReturnEmptyEnvelope();
     data = null;
     myStatistic.IncStRxFrameCounter();
     myStatistic.TxDataBlock(true);
     return(AL_ReadData_Result.ALRes_Success);
 }