Exemplo n.º 1
0
        /// <summary>
        /// Writes the current data.
        /// </summary>
        private void WriteCurrentData(ConnectedClient client, DataPacket request, out ResponsePacket response)
        {
            byte[]   buffer    = request.Buffer;
            int      index     = ArgumentIndex;
            DateTime timestamp = GetTime(buffer, ref index);
            int      cnlCnt    = GetInt32(buffer, ref index);
            Slice    slice     = new Slice(timestamp, cnlCnt);

            for (int i = 0, idx1 = index, idx2 = idx1 + cnlCnt * 4; i < cnlCnt; i++)
            {
                slice.CnlNums[i] = GetInt32(buffer, ref idx1);
                slice.CnlData[i] = GetCnlData(buffer, ref idx2);
            }

            index += cnlCnt * 14;
            int        deviceNum  = GetInt32(buffer, ref index);
            WriteFlags writeFlags = (WriteFlags)buffer[index];

            coreLogic.WriteCurrentData(slice, deviceNum, writeFlags);

            response = new ResponsePacket(request, client.OutBuf);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Writes the current data.
        /// </summary>
        protected void WriteCurrentData(ConnectedClient client, DataPacket request, out ResponsePacket response)
        {
            byte[] buffer    = request.Buffer;
            int    index     = ArgumentIndex;
            int    deviceNum = GetInt32(buffer, ref index);
            int    cnlCnt    = GetInt32(buffer, ref index);

            int[]     cnlNums = new int[cnlCnt];
            CnlData[] cnlData = new CnlData[cnlCnt];

            for (int i = 0, idx1 = index, idx2 = idx1 + cnlCnt * 4; i < cnlCnt; i++)
            {
                cnlNums[i] = GetInt32(buffer, ref idx1);
                cnlData[i] = GetCnlData(buffer, ref idx2);
            }

            index += cnlCnt * 14;
            bool applyFormulas = buffer[index] > 0;

            coreLogic.WriteCurrentData(deviceNum, cnlNums, cnlData, applyFormulas);

            response = new ResponsePacket(request, client.OutBuf);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Writes the current data of the input channel.
 /// </summary>
 public void WriteCurrentData(int cnlNum, CnlData cnlData)
 {
     coreLogic.WriteCurrentData(0, new int[] { cnlNum }, new CnlData[] { cnlData }, true);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Writes the current data of the specified channel.
 /// </summary>
 public void WriteCurrentData(int cnlNum, CnlData cnlData)
 {
     coreLogic.WriteCurrentData(
         new Slice(DateTime.MinValue, new int[] { cnlNum }, new CnlData[] { cnlData }),
         0, WriteFlags.EnableAll);
 }