Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Using ConnectAL.dll

If you are working with a Brew MP Toolset version 7.11.5 or older, to use ConnectAL.dll, you need to copy your application to the %brewmp_toolset%/bin directory. If you want to keep your application in a separate directory, you need to copy the following .NET assemblies to the same directory as the application: TargetManagement.Core.dll, ConnectionMonitor.exe, Connect.Interop.dll, Btil.Interop.dll.

For Brew MP Toolset version 7.11.6 or newer, you no longer need to copy your .exe to %brewmp_toolset%/bin; the exe can reside in a different directory. Your application executable can either refer to ConnectAL.dll in %brewmp_toolset%/bin or have a local copy of ConnectAL.dll, but the local copy of ConnectAL.dll must be the same as the one in %brewmp_toolset%/bin.

Example: CppSample

CppSample is a good example of using ConnectAL.dll. The following code includes the ConnectAL header file, and uses Connect Abstraction Layer APIs.

#include "..\..\..\src\ConnectAL\ConnectAL.h"

void ScreenUpdateAvailableCallback(void* pUser, UINT32 targetId, UINT32 screenID,
       ConnectAL_BitmapInfo* pBitmapInfo)
{
	  printf("    In screen update callback\n");
	  unsigned char* bitmapBuffer = new unsigned char[pBitmapInfo->size];
	  int result = ConnectAL_GetScreenUpdate(targetId, screenID, bitmapBuffer, pBitmapInfo);
	  printf("    ConnectAL_GetScreenUpdate returned %d.\n", result);
	  printf("    Leaving screen update callback\n");
}

int _tmain(int argc, _TCHAR* argv[])
{
   int result = ConnectAL_InitializeTargetManagement();
	  printf("ConnectAL_InitializeTargetManagement returned %d\n", result);

	  UINT32 count = 0;
	  UINT32* pTargetListPtr = NULL;
	  result = ConnectAL_GetTargets(&pTargetListPtr, &count);
	  if (count > 0)
	  {
		    pTargetListPtr = new UINT32[count];
		    result = ConnectAL_GetTargets(&pTargetListPtr, &count);
		    printf("ConnectAL_GetTargets found %d targets, returned %d.\n", count, result);
		    result = ConnectAL_EnableScreenUpdate(pTargetListPtr[0], 
               ScreenUpdateAvailableCallback, NULL);
		    printf("ConnectAL_EnableScreenUpdate returned %d\n", result);
    }
	  else
	  {
		    printf("ConnectAL_GetTargets found no targets, returned %d.\n", result);
	  }

	  return 0;
}