Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="bufferLength"></param>
        /// <returns></returns>
        public FunctionResult Send(
            byte[] buffer,
            uint bufferLength)
        {
            FunctionResult functionResult;

            // check if it is a request message and parse it
            functionResult = Model.RequestModel.Update(buffer, bufferLength);

            if (functionResult == FunctionResult.Success)
            {
            }
            else
            {
                return(FunctionResult.Fail);
            }

            // send the frame
            byte[] frame       = Model.RequestModel.MessageBuf;
            uint   frameLength = Model.RequestModel.MessageBufLength;

            functionResult = FFTAICommunicationInterface.SendFrame(frame, frameLength);

            if (functionResult == FunctionResult.Success)
            {
            }
            else
            {
                return(FunctionResult.Fail);
            }

            return(FunctionResult.Success);
        }
        //-------------------------------------------- Function Definition (Receive) ---------------------------------------

        //-------------------------------------------- Function Definition (Request) ---------------------------------------

        /// <summary>
        ///
        /// </summary>
        /// <param name="opType"></param>
        /// <returns></returns>
        public FunctionResult RequestInitOp(byte opType)
        {
            byte[] data = new byte[]
            {
                48, 49, 255,
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                160
            };

            byte[] opTypeArray = new byte[4];

            opTypeArray = BitConverter.GetBytes(opType);

            Array.Copy(opTypeArray, 0, data, 3, 1);

            FFTAICommunicationInterface.SendFrame(data, (uint)data.Length);

            return(FunctionResult.Success);
        }