コード例 #1
0
ファイル: RFID prototype.cpp プロジェクト: yourgods/RFID
BOOL CRFIDprototypeApp::InitInstance()
{

	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO: 应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));

	if(!CheckPeripheral()){
		AfxMessageBox(L"校车安全系统无法正常启动,请联系厂商!");
		return FALSE;
	}
	CRFIDprototypeDlg dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: 在此放置处理何时用
		// “确定”来关闭对话框的代码
		CloseGSM();
		CloseRFID();
		CloseGPS();
		CloseOthers();
	}

	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}
コード例 #2
0
int main() // MAIN PROGRAM AND First Level Menu
{
	uint8 c,MenuSel;		// local var to hold result of which menu item we selected

	InitPIC32();			// initialise MPU
	CloseWiFi();			// Wifi powered Off
	CloseBarcode();		// Barcode powered Off
	PeripheralReset();
	InitLCD();				// initialise LCD
	CloseRFID();			// RFID off / sleep

	if(BrownOutReset()) // if the system crapped out previously, then just warn the user to charge the device and power off
	{
		LCDInform(" POWER! ","Please Charge!");
	  PWR_HOLD(0); // turn off power when above message acknowleged
	}

	while(1) // main program loop (do this until powered off or sleep)
	{
 	  MenuSel = GetMenuItem("READY","Scan Barcode","Scan RFID","Setup","Shutdown","");

		if(MenuSel==1) // SCAN barcode
		{
			if(ReadBarcode()>1) // we got a barcode! Barcodes are encoded with the first letter designating the barcode type (or obviously the system wont have a clue!)
			{
				if(BarcodeData[0]=='J') OldJobMenu(BarcodeData);
				else
				if(BarcodeData[0]=='X') NewJobMenu(BarcodeData);
				else
				if(BarcodeData[0]=='S' && BarcodeData[1]=='M') StockMenu(BarcodeData);
				else
				if(BarcodeData[0]=='A') AssetMenu(BarcodeData);
				else
				if(BarcodeData[0]=='L') LabMenu(BarcodeData);
				else
  				LCDInform("UID",BarcodeData);
			}
		}

		if(MenuSel==2) // scan RFID tag
		{
			CLS();
      LCDWriteStrAt(1,6,"SCAN RFID TAG");
  		if (ReadRFIDUID()) // get UID
			{
				LCDInform("UID",uid.SerialNo);
        ReadRFIDBlock(1);
			}
		}

		if(MenuSel==3) // setup menu
		{
   		SetupMenu();
		}

		if(MenuSel==4) // power off
		{
		  PWR_HOLD(0); // remove power to CPU - if on battery power this will turn off power to CPU and effectively end the program here!
			CLS();
			if(ReadFloatAt(0,8,500,7))	LCDInform("Number was",KeypadData);
		}

	}
}