javaextensions/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 60 6c158198356e
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
   146     TUUID uuid;
   146     TUUID uuid;
   147 
   147 
   148     TPtrC8 uuidDes(uuidBytes, uuidByteLength);
   148     TPtrC8 uuidDes(uuidBytes, uuidByteLength);
   149     TRAPD(err, uuid.SetL(uuidDes));
   149     TRAPD(err, uuid.SetL(uuidDes));
   150 
   150 
   151     delete[] uuidBytes;
   151     delete uuidBytes;
   152     uuidBytes = NULL;
   152     uuidBytes = NULL;
   153 
   153 
   154     if (KErrNone != err)
   154     if (KErrNone != err)
   155     {
   155     {
   156         LOG2(EJavaBluetooth, EInfo,
   156         LOG2(EJavaBluetooth, EInfo,
   203         try
   203         try
   204         {
   204         {
   205             char *fileName = java::util::JavaCommonUtils::wstringToUtf8(
   205             char *fileName = java::util::JavaCommonUtils::wstringToUtf8(
   206                                  persistentFileName);
   206                                  persistentFileName);
   207             persistentRecFd = open(fileName, O_RDONLY);
   207             persistentRecFd = open(fileName, O_RDONLY);
   208             delete[] fileName;
   208             delete fileName;
   209         }
   209         }
   210         catch (ExceptionBase ex)
   210         catch (ExceptionBase ex)
   211         {
   211         {
   212             ELOG1(
   212             ELOG1(
   213                 EJavaBluetooth,
   213                 EJavaBluetooth,
   616             }
   616             }
   617             // Storing the Current DeviceClass (32 bits)
   617             // Storing the Current DeviceClass (32 bits)
   618             write(mSrvRecFd, (char *) &aDeviceServiceClasses,
   618             write(mSrvRecFd, (char *) &aDeviceServiceClasses,
   619                   sizeof(aDeviceServiceClasses));
   619                   sizeof(aDeviceServiceClasses));
   620 
   620 
   621             delete[] fileName;
   621             delete fileName;
   622         }
   622         }
   623         catch (ExceptionBase ex)
   623         catch (ExceptionBase ex)
   624         {
   624         {
   625             ELOG1(
   625             ELOG1(
   626                 EJavaBluetooth,
   626                 EJavaBluetooth,
  1284         try
  1284         try
  1285         {
  1285         {
  1286             char *fileName =
  1286             char *fileName =
  1287                 java::util::JavaCommonUtils::wstringToUtf8(persistentFileName);
  1287                 java::util::JavaCommonUtils::wstringToUtf8(persistentFileName);
  1288             persistentRecFd = open(fileName, O_RDONLY);
  1288             persistentRecFd = open(fileName, O_RDONLY);
  1289             delete[] fileName;
  1289             delete fileName;
  1290         }
  1290         }
  1291         catch (ExceptionBase ex)
  1291         catch (ExceptionBase ex)
  1292         {
  1292         {
  1293             ELOG1(EJavaBluetooth,
  1293             ELOG1(EJavaBluetooth,
  1294                   "- ServiceRecord::restoreJavaServiceRecord exception caught: %S",
  1294                   "- ServiceRecord::restoreJavaServiceRecord exception caught: %S",
  1308 
  1308 
  1309     // Reading and restoring the DeviceServiceClasses bits (If any)
  1309     // Reading and restoring the DeviceServiceClasses bits (If any)
  1310     unsigned int devServClass = 0;
  1310     unsigned int devServClass = 0;
  1311     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
  1311     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
  1312     if (ret <= 0)
  1312     if (ret <= 0)
  1313     {
       
  1314         delete srvRecPopulator;
       
  1315         return;
  1313         return;
  1316     }
       
  1317 
  1314 
  1318     elementBuilder = srvRecPopulator->SetDeviceServiceClass(devServClass);
  1315     elementBuilder = srvRecPopulator->SetDeviceServiceClass(devServClass);
  1319 
  1316 
  1320 
  1317 
  1321     // Calling first BuildDESL, is mandatory
  1318     // Calling first BuildDESL, is mandatory