/// <summary>
        /// Write the specified data to the watch variable specified by the <paramref name="DictionaryIndex"/> parameter.
        /// </summary>
        /// <param name="DictionaryIndex">The dictionary index.</param>
        /// <param name="DataType">The data type.</param>
        /// <param name="Data">The value of the data to be written.</param>
        /// <returns>CommunicationError.Success (0) if all is well; otherwise another enumeration which is less than 0</returns>
        public CommunicationError SendVariable(Int16 DictionaryIndex, Int16 DataType, Double Data)
        {
            UInt32 data = (UInt32)Data;

            ProtocolPTU.SendVariableReq request = new ProtocolPTU.SendVariableReq(DictionaryIndex, data);

            CommunicationError commError = m_PtuTargetCommunication.SendCommandToEmbedded(m_CommDevice, request);

            return(commError);
        }
Esempio n. 2
0
        /// <summary>
        /// Start the self test task.
        /// </summary>
        /// <remarks>This request will start the self test process on the VCU.
        /// process.</remarks>
        /// <param name="Result">The result of the call. A value of: (1) 1 represents success; (2) indicates that the error message defined by the
        /// <paramref name="Reason"/> parameter applies and (3) represents an unknown error.</param>
        /// <param name="Reason">A value of 1 represents success; otherwise, the value is mapped to the <c>ERRID</c> field of the
        /// <c>SELFTESTERRMESS</c> table of the data dictionary in order to determine the error message returned from the VCU.</param>
        /// <returns>Success, if the communication request was successful; otherwise, an error code.</returns>
        public CommunicationError StartSelfTestTask(out Int16 Result, out Int16 Reason)
        {
            Result = -1;
            Reason = -1;

            // Initiate transaction with embedded target
            CommunicationError commError = m_PtuTargetCommunication.SendCommandToEmbedded(m_CommDevice, ProtocolPTU.PacketType.START_SELF_TEST_TASK);

            if (commError != CommunicationError.Success)
            {
                return(commError);
            }

            // original code has a hard-coded while--loop delay
            Thread.Sleep(100);

            commError = GetSelfTestSpecialMessage(out Result, out Reason);

            return(commError);
        }