javaextensions/bluetooth/bluetoothcommons/src.s60/servicerecord.cpp
changeset 87 1627c337e51e
parent 72 1f0034e370aa
equal deleted inserted replaced
80:d6dafc5d983f 87:1627c337e51e
   217     }
   217     }
   218 
   218 
   219     if (persistentRecFd < 0)
   219     if (persistentRecFd < 0)
   220         return errno;
   220         return errno;
   221 
   221 
       
   222 
   222     // Reading and restoring the DeviceServiceClasses bits
   223     // Reading and restoring the DeviceServiceClasses bits
   223     int devServClass = 0;
   224     int devServClass = 0;
   224     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
   225     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
   225 
   226 
   226     if (ret <= 0)
   227     if (ret <= 0)
       
   228     {
       
   229         close(persistentRecFd);
   227         return errno;
   230         return errno;
       
   231     }
   228 
   232 
   229     if (devServClass != 0)
   233     if (devServClass != 0)
   230     {
   234     {
   231         LOG1(EJavaBluetooth, EInfo,
   235         LOG1(EJavaBluetooth, EInfo,
   232              "  ServiceRecord::restorePersistentRecordFs Setting COD:0x%X",
   236              "  ServiceRecord::restorePersistentRecordFs Setting COD:0x%X",
   427     }
   431     }
   428 
   432 
   429     // Indicates a successful retrieval
   433     // Indicates a successful retrieval
   430     // of the service record from the persistent file
   434     // of the service record from the persistent file
   431     mRestoredFromPersistentFile = true;
   435     mRestoredFromPersistentFile = true;
   432 
   436     close(persistentRecFd);
   433     return ret;
   437     return ret;
   434 }
   438 }
   435 
   439 
   436 /**
   440 /**
   437  * Creates and initializes the Service record.
   441  * Creates and initializes the Service record.
  1310     unsigned int devServClass = 0;
  1314     unsigned int devServClass = 0;
  1311     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
  1315     ret = read(persistentRecFd, &devServClass, sizeof(devServClass));
  1312     if (ret <= 0)
  1316     if (ret <= 0)
  1313     {
  1317     {
  1314         delete srvRecPopulator;
  1318         delete srvRecPopulator;
       
  1319         close(persistentRecFd);
  1315         return;
  1320         return;
  1316     }
  1321     }
  1317 
  1322 
  1318     elementBuilder = srvRecPopulator->SetDeviceServiceClass(devServClass);
  1323     elementBuilder = srvRecPopulator->SetDeviceServiceClass(devServClass);
  1319 
  1324 
  1523         if (0 == ret)
  1528         if (0 == ret)
  1524             break;
  1529             break;
  1525     }
  1530     }
  1526 
  1531 
  1527     delete srvRecPopulator;
  1532     delete srvRecPopulator;
  1528 
  1533     close(persistentRecFd);
  1529     return;
  1534     return;
  1530 }
  1535 }
  1531 
  1536 
  1532 // Helper function
  1537 // Helper function
  1533 HBufC8* ServiceRecord::convertIntToDesC(TUint8 *aBytes, int aDataType)
  1538 HBufC8* ServiceRecord::convertIntToDesC(TUint8 *aBytes, int aDataType)