예제 #1
0
        public Result API_UpdataEnterUpdateMode
        (

        )
        {
#if _TRACE_OUT_PUT
            PrintMagToTxt("API_UpdataEnterUpdateMode");
#endif

            Result      result = Result.OK;
            ENUM_CMD    TxCmd  = ENUM_CMD.NOTHING;
            CommonParms common = new CommonParms();
            byte[]      buf    = new byte[57];
            Array.Clear(buf, 0, buf.Length);

            TxCmd  = ENUM_CMD.UPDAUE_ENTER_UPDATE_MODE;
            buf[0] = 0x0D;                     //Magic
            buf[1] = 0xF0;                     //Magic
            buf[2] = (byte)((int)TxCmd & 0xF); //command
            buf[3] = 0;                        //command
            buf[4] = 1;                        //Length
            buf[5] = 0;                        //Length
            buf[6] = 0;                        //Reserved
            buf[7] = 0;                        //Reserved
            buf[8] = 0;                        //0=>Enter update mode

            if (false == this.SendData(buf))
            {
                return(Result.FAILURE);
            }

            //Run report packet progress
            common.callback     = null;
            common.callbackCode = IntPtr.Zero;
            common.context      = IntPtr.Zero;
            if (CheckTagAccessPkt(common) == false)
            {
                return(Result.FAILURE);
            }



            Array.Clear(buf, 0, buf.Length);

            //Check receive data
            if (false == this.ReceiveData(TxCmd, ref buf))
            {
                return(Result.FAILURE);
            }

            //Check result
            result = ConvertResult(buf[4]);
            if (Result.OK != result)
            {
                return(result);
            }


            return(Result.OK);
        }
예제 #2
0
        public Result API_UpdataEnterUpdateMode(

        )
        {
            #if _TRACE_OUT_PUT
            PrintMagToTxt("API_UpdataEnterUpdateMode");
            #endif

            Result      result = Result.OK;
            ENUM_CMD    TxCmd  = ENUM_CMD.NOTHING;
            CommonParms common = new CommonParms();
            byte[]      buf    = new byte[57];
            Array.Clear(buf, 0, buf.Length);

            TxCmd  = ENUM_CMD.UPDAUE_ENTER_UPDATE_MODE;
            buf[0] = 0x0D; //Magic
            buf[1] = 0xF0; //Magic
            buf[2] = (byte)( (int)TxCmd & 0xF );//command
            buf[3] = 0; //command
            buf[4] = 1; //Length
            buf[5] = 0; //Length
            buf[6] = 0; //Reserved
            buf[7] = 0; //Reserved
            buf[8] = 0; //0=>Enter update mode

            if ( false == this.SendData(buf) )
                return Result.FAILURE;

            //Run report packet progress
            common.callback     = null;
            common.callbackCode = IntPtr.Zero;
            common.context      = IntPtr.Zero;
            if ( CheckTagAccessPkt(common) == false )
                return Result.FAILURE;

            Array.Clear(buf, 0, buf.Length);

            //Check receive data
            if ( false == this.ReceiveData( TxCmd, ref buf ) )
                return Result.FAILURE;

            //Check result
            result = ConvertResult(buf[4]);
            if (Result.OK != result)
                return result;

            return Result.OK;
        }