Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

how do I programatically retrieve the BrewMP version (e.g., '1.0.2.481')?

 

I see that GETAEEVERSION() returns a different, though presumably related, string...

 

thx.

-steve

 

GETAEEVERSION()  will return somthing as 5.x for BrewMP devices. which may be refered as platform version.
to make it generic across Brew/BrewMP, if platform version is "5.x" or greater, get the brewmp version using ISettings as below:-
 
void GetBrewMPVersion(IShell *piShell)
{
   ISettings *pISettings = NULL;
   char *pBMPVersion = NULL;
   AEEResult nErr = AEE_EFAILED;
   char *pBMPBuildId = NULL;
   AEEResult nErr2 = AEE_EFAILED;
   int iSize = 0;
   char szBuf[32] = {0};
 
      /* Create an ISettings interface */
      nErr = ISHELL_CreateInstance(piShell, AEECLSID_SettingsReg  , (void**) &pISettings);
                      if(AEE_SUCCESS != nErr) break;
 
      /* Retrieve the version information */  /* Retrieve the size required */
  nErr = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/Version", NULL, 0, (int *)&iSize);
  if ((AEE_SUCCESS != nErr) || (0 == iSize))      {
         nErr = AEE_EFAILED;
         break;
      }
 
      /* Allocate the required memory */
      pBMPVersion = (char *)MALLOC(iSize);
      if (NULL == pBMPVersion)      {
         nErr = ENOMEMORY;
         break;
      }
 
      /* Retrieve the version information */
      nErr = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/Version", pBMPVersion, iSize, NULL);
      if (nErr != AEE_SUCCESS)   break;
 
      /* Retrieve the Build ID information */      /* Retrieve the size required */
      nErr2 = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/BuildID", NULL, 0, (int *)&iSize);
      if ((nErr2 != AEE_SUCCESS) || (0 == iSize))      {
         nErr2 = AEE_EFAILED;
         break;
      }
 
      /* Allocate the required memory */
      pBMPBuildId = (char *)MALLOC(iSize);
      if (NULL == pBMPBuildId)      {
         nErr2 = ENOMEMORY;
         break;
      }
 
      /* Retrieve the Build ID information */
     nErr2 = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/BuildID", pBMPBuildId, iSize, NULL);
      if (nErr2 != AEE_SUCCESS)   break;     
 
 
   /* Now, form the Brew MP version */
   if(AEE_SUCCESS == nErr2)   {
      SNPRINTF(szBuf, sizeof(szBuf), "\tBrew MP Version\t%s.%s\n", pBMPVersion, pBMPBuildId);
     nErr = AEE_SUCCESS;
   }
   else if(AEE_SUCCESS == nErr)
   {
      SNPRINTF(szBuf, sizeof(szBuf), "\tBrew MP Version\t%s\n", pBMPVersion);
      nErr = AEE_SUCCESS;
   }
   else
   {     
      nErr = AEE_EVERSIONNOTSUPPORT;
   }
 
   /* Release the allocated resources */
   FREEIF(pBMPVersion);
   FREEIF(pBMPBuildId);
   IQI_RELEASEIF(pISettings);
}

GETAEEVERSION()  will return somthing as 5.x for BrewMP devices. which may be refered as platform version.
to make it generic across Brew/BrewMP, if platform version is "5.x" or greater, get the brewmp version using ISettings as below:-
 
void GetBrewMPVersion(IShell *piShell)
{
   ISettings *pISettings = NULL;
   char *pBMPVersion = NULL;
   AEEResult nErr = AEE_EFAILED;
   char *pBMPBuildId = NULL;
   AEEResult nErr2 = AEE_EFAILED;
   int iSize = 0;
   char szBuf[32] = {0};
 
      /* Create an ISettings interface */
      nErr = ISHELL_CreateInstance(piShell, AEECLSID_SettingsReg  , (void**) &pISettings);
                      if(AEE_SUCCESS != nErr) break;
 
      /* Retrieve the version information */  /* Retrieve the size required */
  nErr = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/Version", NULL, 0, (int *)&iSize);
  if ((AEE_SUCCESS != nErr) || (0 == iSize))      {
         nErr = AEE_EFAILED;
         break;
      }
 
      /* Allocate the required memory */
      pBMPVersion = (char *)MALLOC(iSize);
      if (NULL == pBMPVersion)      {
         nErr = ENOMEMORY;
         break;
      }
 
      /* Retrieve the version information */
      nErr = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/Version", pBMPVersion, iSize, NULL);
      if (nErr != AEE_SUCCESS)   break;
 
      /* Retrieve the Build ID information */      /* Retrieve the size required */
      nErr2 = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/BuildID", NULL, 0, (int *)&iSize);
      if ((nErr2 != AEE_SUCCESS) || (0 == iSize))      {
         nErr2 = AEE_EFAILED;
         break;
      }
 
      /* Allocate the required memory */
      pBMPBuildId = (char *)MALLOC(iSize);
      if (NULL == pBMPBuildId)      {
         nErr2 = ENOMEMORY;
         break;
      }
 
      /* Retrieve the Build ID information */
     nErr2 = ISettings_Get(pISettings, "/bmpversion/platform/BuildInfo/BuildID", pBMPBuildId, iSize, NULL);
      if (nErr2 != AEE_SUCCESS)   break;     
 
 
   /* Now, form the Brew MP version */
   if(AEE_SUCCESS == nErr2)   {
      SNPRINTF(szBuf, sizeof(szBuf), "\tBrew MP Version\t%s.%s\n", pBMPVersion, pBMPBuildId);
     nErr = AEE_SUCCESS;
   }
   else if(AEE_SUCCESS == nErr)
   {
      SNPRINTF(szBuf, sizeof(szBuf), "\tBrew MP Version\t%s\n", pBMPVersion);
      nErr = AEE_SUCCESS;
   }
   else
   {     
      nErr = AEE_EVERSIONNOTSUPPORT;
   }
 
   /* Release the allocated resources */
   FREEIF(pBMPVersion);
   FREEIF(pBMPBuildId);
   IQI_RELEASEIF(pISettings);
}

that works.
thx.
-sh

that works.
thx.
-sh