rf_stop.cpp

来自「关于MTK 的MATA开发工具的RF源码」· C++ 代码 · 共 113 行

CPP
113
字号
//#include "meta2.h"
#include <IniFiles.hpp>

#include "rf_stop.h"
#include "man_timer.h"
#include "man_active.h"
#include "man_fdm.h"
//===========================================================================

static CRFSTOP*  rf_stop_ptr;

//===========================================================================

//static void  CNF_RFStop( BOOL cnf )
//static void  CNF_RFStop(BOOL cnf, short token, void *usrData)
static void __stdcall CNF_RFStop(const unsigned char cnf, const short token, void *usrData)
{ // rf_stop_ptr->CNF_RFStop( cnf );
  rf_stop_ptr->CNF_RFStop( cnf, token, usrData );
}
static void  REQ_TimeOut( void )
{  rf_stop_ptr->REQ_TimeOut();
}
static void  REQ_Finish( void )
{   rf_stop_ptr->REQ_Finish();
}

//===========================================================================

CRFSTOP::CRFSTOP( void )
{
   IsRunning = false;
   ConfirmCallback = 0;
}
//---------------------------------------------------------------------------

CRFSTOP::~CRFSTOP( void )
{
   ConfirmCallback = 0;
   IsRunning = false;
}
//---------------------------------------------------------------------------

void  CRFSTOP::REQ_Finish( void )
{
   if(!IsRunning)  return;

   TimerMan->CounterStop();
   Confirm( STATE_STOP_OK );
   IsRunning = false;
}
//---------------------------------------------------------------------------

void  CRFSTOP::REQ_Stop( void )
{
   if(!IsRunning)  return;

   TimerMan->CounterStop();
   META_Cancel( RFID_STOP );
   Confirm( STATE_STOP_STOP );
   IsRunning = false;
}
//---------------------------------------------------------------------------

void  CRFSTOP::REQ_TimeOut( void )
{
   if(!IsRunning)  return;

   TimerMan->CounterStop();
   META_Cancel( RFID_STOP );
   Confirm( STATE_STOP_TIMEOUT );
   IsRunning = false;
}
//---------------------------------------------------------------------------

void  CRFSTOP::Confirm( int confirm_state )
{
   if(!IsRunning)  return;

   if(ConfirmCallback==0)  return;
   ConfirmState = confirm_state;
   ActiveMan->SetActiveFunction( ConfirmCallback );
}
//===========================================================================

void  CRFSTOP::REQ_Start( void )
{
   rf_stop_ptr = this;
   IsRunning = true;

   // modified by Andy Ueng
   // MetaResult = META_Rf_Stop( ::CNF_RFStop, &RFID_STOP );
   MetaResult = META_Rf_Stop( ::CNF_RFStop, &RFID_STOP, NULL );
   // end of modified
   
   if(MetaResult!=META_SUCCESS)
   {  Confirm( STATE_STOP_FAIL );  return;  }
}
//-------------------------------------

//void  CRFSTOP::CNF_RFStop( BOOL cnf )
//void  CRFSTOP::CNF_RFStop(BOOL cnf, short token, void *usrData)
void __stdcall CRFSTOP::CNF_RFStop(const unsigned char cnf, const short token, void *usrData)
{
   if(!IsRunning)  return;

   if(cnf==false)
   {  Confirm( STATE_STOP_FAIL );  return;  }

   ActiveMan->SetActiveFunction( ::REQ_Finish );
}
//===========================================================================

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?