Exemple #1
0
        private void Disconnect( )
        {
#if _TRACE_OUT_PUT
            m_clsInterface.PrintMagToTxt("====== UpdateFW Disconnect======");
#endif

            //clear
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER, "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, "No device");
            m_Mode = DEV_MODE.NO;

            //close the device
            m_clsInterface.API_RadioClose();

            //Disable Item
            ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, false);


            //ControlItem(ENUM_ITEM_TYPE.MENU_SET_COM_PORT, true);

            ////If update progress is running, doesn't hide "Updtae" button which shows "Stop".
            //if (m_clsBackThread.IsBusy == false)
            //{
            //    btnUpdate.Enabled = false;
            //}
        }
Exemple #2
0
//==========================Other=========================================
        private DEV_MODE AskMode()
        {
            Result result = Result.FAILURE;

            do
            {
                //Check BL Mode
                result = GetVersion(DEV_MODE.BL);

                if (Result.OK == result)
                {
                    m_Mode = DEV_MODE.BL;
                    break;
                }
                else if (Result.FWUPD_CMD_IGN == result)
                {
                    m_Mode = DEV_MODE.BL_ENTER_UPDATE;
                    break;
                }

                //Check AP mode
                if (Result.OK == GetVersion(DEV_MODE.AP))
                {
                    m_Mode = DEV_MODE.AP;
                    break;
                }

                m_Mode = DEV_MODE.NO;
            }while(false);

            return(m_Mode);
        }
Exemple #3
0
        //private Result GetVersion( DEV_MODE r_mode )
        private Result GetVersion()
        {
            MacBootLoaderVersion Version = new MacBootLoaderVersion();
            Result result = Result.FAILURE;

            m_Mode = DEV_MODE.NO;
            FirmwareVersion ver = new FirmwareVersion();

            result = m_clsInterface.API_MacGetFirmwareVersion(ref ver);
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER, String.Format("[FW] {0}.{1}.{2}", ver.major, ver.minor, ver.release));
            //ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, String.Format("[FW] {0}.{1}.{2}",ver.major,ver.minor,ver.release) );

            //Show device type
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, rfid.clsPacket.TRANS_API_AskDevType().ToString());

            return(Result.OK);
        }
Exemple #4
0
        private void Disconnect( )
        {
#if _TRACE_OUT_PUT
            m_clsInterface.PrintMagToTxt("====== UpdateFW Disconnect======");
#endif

            //clear
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER, "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, "No device");
            m_Mode = DEV_MODE.NO;

            //close the device
            m_clsInterface.API_RadioClose();

            //Disable Item
            ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, false);
        }
Exemple #5
0
        private void Connect( )
        {
#if _TRACE_OUT_PUT
            m_clsInterface.PrintMagToTxt("======UpdateFW Connect======");
#endif

            //clear
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER, "");
            ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "");
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, "No device");
            m_Mode = DEV_MODE.NO;

            //close the device
            m_clsInterface.API_RadioClose();

            //Disable Item
            //btnUpdate.Enabled = false;
            ControlItem(ENUM_ITEM_TYPE.MENU_SET_COM_PORT, false);
            ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, false);

            //open the device
            if (true == OpenDevice())
            {
                //Enable Item
                btnUpdate.Enabled = true;

                //If update progress is running, hide "device Interface" item.
                if (m_clsBackThread.IsBusy == false)
                {
                    ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, true);
                }
            }

            ////If update progress is running, hide "Set Com Port" item.
            //if (m_clsBackThread.IsBusy == false)
            //{
            //    //always enable "set com port" item to let user set uless update progress is running.
            //    SetComPortToolStripMenuItem.Enabled = true;
            //}
            ControlItem(ENUM_ITEM_TYPE.MENU_SET_COM_PORT, true);
        }
Exemple #6
0
        private Result GetVersion(DEV_MODE r_mode)
        {
            MacBootLoaderVersion Version = new MacBootLoaderVersion();
            Result result = Result.FAILURE;

            m_Mode = DEV_MODE.NO;

            switch (r_mode)
            {
            case DEV_MODE.AP:

#if _TRACE_OUT_PUT
                m_clsInterface.PrintMagToTxt("====== Get FW AP Version======");
#endif

                FirmwareVersion ver = new FirmwareVersion();
                result = m_clsInterface.API_MacGetFirmwareVersion(ref ver);

                if (Result.OK != result)
                {
                    //ControlItem(ENUM_ITEM_TYPE.STATUS, "Can't get AP version");
                    return(result);
                }
                ControlItem(ENUM_ITEM_TYPE.TEXT_VER, String.Format("[AP] {0}.{1}.{2}", ver.major, ver.minor, ver.release));
                ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, String.Format("[AP] {0}.{1}.{2}", ver.major, ver.minor, ver.release));

                m_Mode = DEV_MODE.AP;
                break;

            case DEV_MODE.BL:

#if _TRACE_OUT_PUT
                m_clsInterface.PrintMagToTxt("====== Get BL AP Version======");
#endif


                result = m_clsInterface.API_UpdataGetVersion(ref Version);
                if (Result.OK != result)
                {
                    //ControlItem(ENUM_ITEM_TYPE.STATUS, "Can't get bootloader version");
                    return(result);
                }
                ControlItem(ENUM_ITEM_TYPE.TEXT_VER, String.Format("[BL] {0}.{1}.{2}", Version.major, Version.minor, Version.release));
                ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, String.Format("[BL] {0}.{1}.{2}", Version.major, Version.minor, Version.release));

                m_Mode = DEV_MODE.BL;
                break;

            case DEV_MODE.BL_ENTER_UPDATE:

#if _TRACE_OUT_PUT
                m_clsInterface.PrintMagToTxt("====== Get BL_ENTER_UPDATE Version======");
#endif

                //result = m_clsInterface.API_UpdataGetVersion(ref Version);
                //if (result != Result.OK && result != Result.FWUPD_CMD_IGN)
                //{
                //    //ControlItem(ENUM_ITEM_TYPE.STATUS, "Can't get bootloader version");
                //    return result;
                //}

                ControlItem(ENUM_ITEM_TYPE.TEXT_VER, "[BL] Update Mode.");
                ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "Enter update Mode.");

                m_Mode = DEV_MODE.BL_ENTER_UPDATE;
                break;

            default:
                m_Mode = DEV_MODE.NO;
                return(Result.FAILURE);

                break;
            }

            //Show device type
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, rfid.clsPacket.TRANS_API_AskDevType().ToString());

            return(Result.OK);
        }
Exemple #7
0
        private Result GetVersion( DEV_MODE r_mode )
        {
            MacBootLoaderVersion Version = new MacBootLoaderVersion();
            Result               result  = Result.FAILURE;

            m_Mode  = DEV_MODE.NO;

            switch (r_mode)
            {
                case DEV_MODE.AP:

            #if _TRACE_OUT_PUT
                m_clsInterface.PrintMagToTxt("====== Get FW AP Version======");
            #endif

                    FirmwareVersion ver = new FirmwareVersion();
                    result = m_clsInterface.API_MacGetFirmwareVersion(ref ver);

                    if (Result.OK != result)
                    {
                        //ControlItem(ENUM_ITEM_TYPE.STATUS, "Can't get AP version");
                        return result;
                    }
                    ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    String.Format("[AP] {0}.{1}.{2}",ver.major,ver.minor,ver.release) );
                    ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, String.Format("[AP] {0}.{1}.{2}",ver.major,ver.minor,ver.release) );

                    m_Mode = DEV_MODE.AP;
                    break;

                case DEV_MODE.BL:

            #if _TRACE_OUT_PUT
                m_clsInterface.PrintMagToTxt("====== Get BL AP Version======");
            #endif

                    result = m_clsInterface.API_UpdataGetVersion(ref Version);
                    if (Result.OK != result)
                    {
                        //ControlItem(ENUM_ITEM_TYPE.STATUS, "Can't get bootloader version");
                        return result;
                    }
                    ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    String.Format("[BL] {0}.{1}.{2}",Version.major,Version.minor,Version.release) );
                    ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, String.Format("[BL] {0}.{1}.{2}",Version.major,Version.minor,Version.release) );

                    m_Mode = DEV_MODE.BL;
                    break;

                case DEV_MODE.BL_ENTER_UPDATE:

            #if _TRACE_OUT_PUT
                m_clsInterface.PrintMagToTxt("====== Get BL_ENTER_UPDATE Version======");
            #endif

                    //result = m_clsInterface.API_UpdataGetVersion(ref Version);
                    //if (result != Result.OK && result != Result.FWUPD_CMD_IGN)
                    //{
                    //    //ControlItem(ENUM_ITEM_TYPE.STATUS, "Can't get bootloader version");
                    //    return result;
                    //}

                    ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    "[BL] Update Mode." );
                    ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "Enter update Mode." );

                    m_Mode = DEV_MODE.BL_ENTER_UPDATE;
                    break;

                default:
                    m_Mode = DEV_MODE.NO;
                    return Result.FAILURE;
                    break;
            }

            //Show device type
            ControlItem( ENUM_ITEM_TYPE.TEXT_DEVICE, rfid.clsPacket.TRANS_API_AskDevType().ToString() );

            return Result.OK;
        }
Exemple #8
0
        private void Disconnect( )
        {
            #if _TRACE_OUT_PUT
            m_clsInterface.PrintMagToTxt("====== UpdateFW Disconnect======");
            #endif

            //clear
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, "No device");
            m_Mode = DEV_MODE.NO;

            //close the device
            m_clsInterface.API_RadioClose();

            //Disable Item
            ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, false);

            //ControlItem(ENUM_ITEM_TYPE.MENU_SET_COM_PORT, true);

            ////If update progress is running, doesn't hide "Updtae" button which shows "Stop".
            //if (m_clsBackThread.IsBusy == false)
            //{
            //    btnUpdate.Enabled = false;
            //}
        }
Exemple #9
0
        private void Connect( )
        {
            #if _TRACE_OUT_PUT
               m_clsInterface.PrintMagToTxt("======UpdateFW Connect======");
            #endif

            //clear
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    "");
            ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "");
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, "No device");
            m_Mode = DEV_MODE.NO;

            //close the device
            m_clsInterface.API_RadioClose();

            //Disable Item
            //btnUpdate.Enabled = false;
            ControlItem(ENUM_ITEM_TYPE.MENU_SET_COM_PORT,     false);
            ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, false);

            //open the device
            if (true == OpenDevice())
            {
                //Enable Item
                btnUpdate.Enabled = true;

                //If update progress is running, hide "device Interface" item.
                if(m_clsBackThread.IsBusy == false)
                    ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, true);
            }

            ////If update progress is running, hide "Set Com Port" item.
            //if (m_clsBackThread.IsBusy == false)
            //{
            //    //always enable "set com port" item to let user set uless update progress is running.
            //    SetComPortToolStripMenuItem.Enabled = true;
            //}
               ControlItem(ENUM_ITEM_TYPE.MENU_SET_COM_PORT,  true);
        }
Exemple #10
0
        //==========================Other=========================================
        private DEV_MODE AskMode()
        {
            Result result = Result.FAILURE;

            do
            {
                //Check BL Mode
                result = GetVersion(DEV_MODE.BL);

                if ( Result.OK == result )
                {
                    m_Mode = DEV_MODE.BL;
                    break;
                }
                else if(  Result.FWUPD_CMD_IGN == result  )
                {
                    m_Mode = DEV_MODE.BL_ENTER_UPDATE;
                    break;
                }

                //Check AP mode
                if ( Result.OK == GetVersion(DEV_MODE.AP) )
                {
                    m_Mode = DEV_MODE.AP;
                    break;
                }

                m_Mode = DEV_MODE.NO;

            }while(false);

            return m_Mode;
        }
Exemple #11
0
        //private Result GetVersion( DEV_MODE r_mode )
        private Result GetVersion()
        {
            MacBootLoaderVersion Version = new MacBootLoaderVersion();
            Result               result  = Result.FAILURE;

            m_Mode  = DEV_MODE.NO;
            FirmwareVersion ver = new FirmwareVersion();
            result = m_clsInterface.API_MacGetFirmwareVersion(ref ver);
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    String.Format("[FW] {0}.{1}.{2}",ver.major,ver.minor,ver.release) );
            //ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, String.Format("[FW] {0}.{1}.{2}",ver.major,ver.minor,ver.release) );

            //Show device type
            ControlItem( ENUM_ITEM_TYPE.TEXT_DEVICE, rfid.clsPacket.TRANS_API_AskDevType().ToString() );

            return Result.OK;
        }
Exemple #12
0
        private void Disconnect( )
        {
            #if _TRACE_OUT_PUT
            m_clsInterface.PrintMagToTxt("====== UpdateFW Disconnect======");
            #endif

            //clear
            ControlItem(ENUM_ITEM_TYPE.TEXT_VER,    "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_STATUS, "Disconnected");
            ControlItem(ENUM_ITEM_TYPE.TEXT_DEVICE, "No device");
            m_Mode = DEV_MODE.NO;

            //close the device
            m_clsInterface.API_RadioClose();

            //Disable Item
            ControlItem(ENUM_ITEM_TYPE.MENU_DEVICE_INTERFACE, false);
        }