Example #1
0
int main() {

		BioAPI_RETURN bioReturn;
		BioAPI_VERSION bioVersion;
		BioAPI_BSP_SCHEMA *BspSchemaArray;
		BioAPI_BSP_SCHEMA *CurrSchema;

		int index;
		uint32 ArraySize, ElementsNeeded, NumElementsReturned, i;

		printf("Starting BioAPI Test Application\n");

		bioVersion.Major = BioAPI_MAJOR;
		bioVersion.Minor = BioAPI_MINOR;
		printf("Major=%d Minor=%d\n", bioVersion.Major, bioVersion.Minor);
		bioReturn = BioAPI_Init(&bioVersion, 0, NULL, 0, NULL);

		if(BioAPI_OK != bioReturn) {
				if(BioAPIERR_H_FRAMEWORK_INCOMPATIBLE_VERSION == bioReturn) {
					printf("This application is not compatible with the installed version of the BioAPI\n");
				} else {
					PrintErrorCode(bioReturn);
				}
				return 0;

		}

		bioReturn = BioAPI_EnumModules(NULL, 0, &ElementsNeeded, 
										&NumElementsReturned);
    if(bioReturn != BioAPI_OK) {
			if (bioReturn == BioAPIERR_H_FRAMEWORK_FUNCTION_FAILED) {
				printf("No BSPs have been installed");
		} else {
			PrintErrorCode(bioReturn);
		}
		return 0;
																													      }
		ArraySize = ElementsNeeded;
		BspSchemaArray = (BioAPI_BSP_SCHEMA *)
						          malloc(ElementsNeeded * sizeof(BioAPI_BSP_SCHEMA));
		if(BspSchemaArray == NULL) {
			printf("Unable to allocate BSP list\n");
			return 0;
		}
		bioReturn = BioAPI_EnumModules(BspSchemaArray, ArraySize, &ElementsNeeded, 
										&NumElementsReturned);
		if(bioReturn != BioAPI_OK) {
			free(BspSchemaArray);
			PrintErrorCode(bioReturn);
			return 0;
		}
		CurrSchema = BspSchemaArray;
		for(i = 0; i < NumElementsReturned; i++) {
			printf("BSP Index= %d\n", i);			
			printf("BSP Name: %s\n", CurrSchema->BSPName);
			printf("Description: %s\n", CurrSchema->Description);
			printf("Vendor: %s\n", CurrSchema->Vendor);
			PrintModuleId(CurrSchema->ModuleId);
			printf("Device ID: 0x%.8x\n", CurrSchema->DeviceId);
			CurrSchema++;
		} 
		free(BspSchemaArray);
		BioAPI_Terminate();

		printf("Ending BioAPI Test Application\n");

}
Example #2
0
File: main.c Project: ozgend/hive
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
					PSTR szCmdLine, int iCmdShow)
	{
		HWND		 hwnd ;
		MSG			 msg ;
		WNDCLASSEX	 wndclass ;
		BioAPI_RETURN bioReturn;
		BioAPI_VERSION bioVersion;
		BioAPI_BSP_SCHEMA * BspSchemaArray;
		BioAPI_BSP_SCHEMA * CurrSchema;
		int index;
		uint32 ArraySize, ElementsNeeded, NumElementsReturned, i;

		RegisterWindowsClass(hInstance, &wndclass);

		bioVersion.Major = BioAPI_MAJOR;
		bioVersion.Minor = BioAPI_MINOR;
		bioReturn = BioAPI_Init(&bioVersion, 0, NULL, 0, NULL);
		if(BioAPI_OK != bioReturn)
			{
				if(BioAPIERR_H_FRAMEWORK_INCOMPATIBLE_VERSION == bioReturn)
					{
						MessageBox(GetActiveWindow(),
							TEXT("This application is not compatible with the installed version of the BioAPI"),
								TEXT("BioAPI Error"),
									MB_OK | MB_ICONSTOP);
					}
				else
					{
						PrintErrorCode(bioReturn);
					}
				return 0;

			}
		gModuleHandle = 0;
		hwnd = CreateDialog (hInstance, szAppName, 0, NULL) ;

		ShowWindow (hwnd, iCmdShow) ;

		EnumChildWindows(hwnd, EnumChildProc, IDC_USERID);
		hUserId = g_hWnd;
		EnumChildWindows(hwnd, EnumChildProc, IDC_BIOTECH);
		hEnumTech = g_hWnd;
		EnumChildWindows(hwnd, EnumChildProc, IDC_CURRENTHBT);
		hCurrHbt = g_hWnd;

		bioReturn = BioAPI_EnumModules(NULL,
									0,
									&ElementsNeeded,
									&NumElementsReturned);

		if(bioReturn != BioAPI_OK)
			{
				PrintErrorCode(bioReturn);
				return 0;
			}
		ArraySize = ElementsNeeded;
		BspSchemaArray = (BioAPI_BSP_SCHEMA *)malloc(ElementsNeeded * sizeof(BioAPI_BSP_SCHEMA));
		if(BspSchemaArray == NULL)
		{
			MessageBox(GetActiveWindow(), TEXT("Unable to allocate BSP list"),
									TEXT("BioAPI Sample"), MB_OK);
			return 0;
		}
		bioReturn = BioAPI_EnumModules(BspSchemaArray,
									ArraySize,
									&ElementsNeeded,
									&NumElementsReturned);
		if(bioReturn != BioAPI_OK)
			{
				PrintErrorCode(bioReturn);
				free(BspSchemaArray);
				return 0;
			}
		CurrSchema = BspSchemaArray;
		for(i = 0; i < NumElementsReturned; i ++)
			{
				index = SendMessage(hEnumTech, CB_ADDSTRING, (WPARAM)0, (LPARAM)(CurrSchema->Description));
				SendMessage(hEnumTech, CB_SETITEMDATA, (WPARAM)index, (LPARAM)CurrSchema);
				CurrSchema ++;
			}

		 while (GetMessage (&msg, NULL, 0, 0))
			{
				TranslateMessage (&msg) ;
				DispatchMessage (&msg) ;
			}
		 free(BspSchemaArray);
		 BioAPI_Terminate();
		 return msg.wParam ;
	}