コード例 #1
0
ファイル: MFUpdate.cs プロジェクト: leeholder/Netduino_SDK
        /// <summary>
        /// Performs an authentication command.  These commands are defined by the native
        /// code update provider.  This method is intented to enable handshaking during
        /// authentication.  For our samples, this method is only used to determine what
        /// validation is supported on the device.
        /// </summary>
        /// <param name="command">The command ID for the authentication call.</param>
        /// <param name="args">The argument object that corresponds to the command ID.</param>
        /// <param name="response">The response object for the command.</param>
        /// <returns>Returns true if the command succeeded, false otherwise.</returns>
        public bool AuthenticationCommand(int command, object args, ref object response)
        {
            byte[] resp = response == null ? null : MFNativeUpdate.SerializeParameter(response);

            bool fRet = MFNativeUpdate.AuthCommand(m_updateHandle, command, MFNativeUpdate.SerializeParameter(args), ref resp);

            if (fRet && resp != null)
            {
                response = MFNativeUpdate.DeserializeParameter(resp, response);
            }

            return(fRet);
        }
コード例 #2
0
ファイル: MFUpdate.cs プロジェクト: leeholder/Netduino_SDK
        /// <summary>
        /// Gets the update property given the property name.
        /// </summary>
        /// <param name="propName">The name of the property.</param>
        /// <param name="propValue">The returned property object.</param>
        /// <returns>Returns false if the property was not set or is not supported.  Returns true otherwise.</returns>
        public bool GetUpdateProperty(string propName, ref object propValue)
        {
            if (m_updateHandle == -1)
            {
                throw new InvalidOperationException();
            }

            byte[] ser = MFNativeUpdate.SerializeParameter(propValue);

            if (MFNativeUpdate.GetUpdateProperty(m_updateHandle, propName, ref ser))
            {
                return(MFNativeUpdate.DeserializeParameter(ser, propValue));
            }

            return(false);
        }