コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userNameByteArray"></param>
        /// <param name="userPasswordByteArray"></param>
        /// <returns></returns>
        public FunctionResult Authentication(byte[] userNameByteArray, byte[] userPasswordByteArray)
        {
            FunctionResult functionResult;

            if (userNameByteArray.Length != LENGTH_OF_AUTHENTICAION_NAME)
            {
                return(FunctionResult.Fail);
            }

            if (userPasswordByteArray.Length != LENGTH_OF_AUTHENTICAION_PASSWORD)
            {
                return(FunctionResult.Fail);
            }

            uint userNameUint =
                (uint)(userNameByteArray[0] << 24)
                + (uint)(userNameByteArray[1] << 16)
                + (uint)(userNameByteArray[2] << 8)
                + (uint)(userNameByteArray[3] << 0);

            uint userPasswordUint =
                (uint)(userPasswordByteArray[0] << 24)
                + (uint)(userPasswordByteArray[1] << 16)
                + (uint)(userPasswordByteArray[2] << 8)
                + (uint)(userPasswordByteArray[3] << 0);


            // build request model
            functionResult = Model.DataSectionModel.RequestModel.Update(
                (uint)FFTAICommunicationV2AuthenticationInterfaceOperationMode.Authentication,
                (uint)FFTAICommunicationV2NumberOfParameter.Two,
                (uint)FFTAICommunicationV2ReadWriteOperation.Set,
                (uint)FFTAICommunicationV2Saved.Zero,
                new uint[] { userNameUint, userPasswordUint });

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

            // send the frame
            functionResult = FFTAICommunicationV2Interface.Send(
                Model.DataSectionModel.RequestModel.MessageBufLength,
                Model.DataSectionModel.RequestModel.MessageBuf,
                Model.DataSectionModel.RequestModel.MessageBufParity);

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

            return(FunctionResult.Success);
        }
コード例 #2
0
        //-------------------------------------------- Function Definition (Receive) ----------------------------

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

        /// <summary>
        ///
        /// </summary>
        /// <param name="DO1Status"></param>
        /// <param name="DO2Status"></param>
        /// <param name="DO3Status"></param>
        /// <param name="DO4Status"></param>
        /// <returns></returns>
        public FunctionResult RequestSetGpioIoStatus(uint DO1Status, uint DO2Status, uint DO3Status, uint DO4Status)
        {
            FunctionResult functionResult;

            // build request model
            functionResult = Model.DataSectionModel.RequestModel.Update(
                (uint)FFTAICommunicationV2HardwareInterfaceOperationMode.ODLGpioIOStatus,
                (uint)FFTAICommunicationV2NumberOfParameter.Four,
                (uint)FFTAICommunicationV2ReadWriteOperation.Set,
                (uint)FFTAICommunicationV2Saved.Zero,
                new uint[] { DO1Status, DO2Status, DO3Status, DO4Status });

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

            // build request frame
            functionResult = FFTAICommunicationV2Interface.Send(
                FFTAICommunicationV2InterfaceRequestModel.HEADER_OF_REQUEST_FRAME,
                (uint)FFTAICommunicationV2ProtocolVersion.Version2,
                (uint)FFTAICommunicationV2RobotType.M2,
                (uint)FFTAICommunicationV2FunctionType.HardwareInterface,
                Model.DataSectionModel.RequestModel.MessageBufLength,
                Model.DataSectionModel.RequestModel.MessageBuf,
                Model.DataSectionModel.RequestModel.MessageBufParity,
                FFTAICommunicationV2InterfaceRequestModel.END_OF_REQUEST_FRAME);

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

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

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

        public FunctionResult RequestGetRobotType()
        {
            FunctionResult functionResult;

            // build request model
            functionResult = Model.DataSectionModel.RequestModel.Update(
                (uint)FFTAICommunicationV2RobotInterfaceOperationMode.RobotType,
                (uint)FFTAICommunicationV2NumberOfParameter.Zero,
                (uint)FFTAICommunicationV2ReadWriteOperation.Get,
                (uint)FFTAICommunicationV2Saved.Zero,
                new uint[] { });

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

            // build request frame
            functionResult = FFTAICommunicationV2Interface.Send(
                FFTAICommunicationV2InterfaceRequestModel.HEADER_OF_REQUEST_FRAME,
                (uint)FFTAICommunicationV2ProtocolVersion.Version2,
                (uint)FFTAICommunicationV2RobotType.All,
                (uint)FFTAICommunicationV2FunctionType.RobotInterface,
                Model.DataSectionModel.RequestModel.MessageBufLength,
                Model.DataSectionModel.RequestModel.MessageBuf,
                Model.DataSectionModel.RequestModel.MessageBufParity,
                FFTAICommunicationV2InterfaceRequestModel.END_OF_REQUEST_FRAME);

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

            return(FunctionResult.Success);
        }