javaextensions/bluetooth/omjbluetooth/src.s60/discoveryagent.cpp
changeset 79 2f468c1958d0
parent 21 2a9601315dfc
child 80 d6dafc5d983f
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
   176             try
   176             try
   177             {
   177             {
   178                 devAddr = java::util::JniUtils::wstringToJstring(aJni,
   178                 devAddr = java::util::JniUtils::wstringToJstring(aJni,
   179                           *(aDiscoveredDevice.mDeviceAddr));
   179                           *(aDiscoveredDevice.mDeviceAddr));
   180             }
   180             }
   181             catch (ExceptionBase ex)
   181             catch (ExceptionBase &ex)
   182             {
   182             {
   183                 // Nothing to handle
   183                 // Nothing to handle
   184             }
   184             }
   185         }
   185         }
   186         else
   186         else
   194             try
   194             try
   195             {
   195             {
   196                 devName = java::util::JniUtils::wstringToJstring(aJni,
   196                 devName = java::util::JniUtils::wstringToJstring(aJni,
   197                           *(aDiscoveredDevice.mDeviceName));
   197                           *(aDiscoveredDevice.mDeviceName));
   198             }
   198             }
   199             catch (ExceptionBase ex)
   199             catch (ExceptionBase &ex)
   200             {
   200             {
   201                 // Nothing to handle
   201                 // Nothing to handle
   202             }
   202             }
   203         }
   203         }
   204         else
   204         else
   370          mServiceSearchStatus);
   370          mServiceSearchStatus);
   371     return mServiceSearchStatus;
   371     return mServiceSearchStatus;
   372 }
   372 }
   373 
   373 
   374 int DiscoveryAgent::PopulateServiceRecordAttrValue(JNIEnv* aJni,
   374 int DiscoveryAgent::PopulateServiceRecordAttrValue(JNIEnv* aJni,
   375         jobject& aPeer, TInt64 aRemoteAddress, long aHandle,
   375         TInt64 aRemoteAddress, long aHandle,
   376         TPtrC16 aAttrIdsDes, jobject aServiceRecordImpl,
   376         TPtrC16 aAttrIdsDes, jobject aServiceRecordImpl,
   377         java::util::Monitor* aMonitor)
   377         java::util::Monitor* aMonitor)
   378 {
   378 {
   379     JELOG2(EJavaBluetooth);
   379     JELOG2(EJavaBluetooth);
   380 
   380 
   381     mServiceSearchMonitor = aMonitor;
   381     mServiceSearchMonitor = aMonitor;
   382 
       
   383     jclass peerClass = (*aJni).GetObjectClass(aPeer);
       
   384 
   382 
   385     LOG(EJavaBluetooth, EInfo,
   383     LOG(EJavaBluetooth, EInfo,
   386         "  DiscoveryAgent::PopulateServiceRecord: Starting populating service records ");
   384         "  DiscoveryAgent::PopulateServiceRecord: Starting populating service records ");
   387     TRAPD(err, CallMethodL(this,
   385     TRAPD(err, CallMethodL(this,
   388                            &java::bluetooth::DiscoveryAgent::populateServiceRecordAttrValueFs,
   386                            &java::bluetooth::DiscoveryAgent::populateServiceRecordAttrValueFsL,
   389                            aRemoteAddress, aHandle, aAttrIdsDes, aServiceRecordImpl,
   387                            aRemoteAddress, aHandle, aAttrIdsDes, aServiceRecordImpl,
   390                            mFunctionServer));
   388                            mFunctionServer));
   391 
   389 
   392     return err;
   390     return err;
   393 }
   391 }
   394 
   392 
   395 void DiscoveryAgent::populateServiceRecordAttrValueFs(TInt64 aRemoteAddress,
   393 void DiscoveryAgent::populateServiceRecordAttrValueFsL(TInt64 aRemoteAddress,
   396         long aHandle, TPtrC16 aAttrIdsDes, jobject aServiceRecordImpl)
   394         long aHandle, TPtrC16 aAttrIdsDes, jobject aServiceRecordImpl)
   397 {
   395 {
   398     mServiceSearcher = BluetoothServiceSearcher::New(this, mFunctionServer);
   396     mServiceSearcher = BluetoothServiceSearcher::New(this, mFunctionServer);
   399     mServiceSearcher->PopulateServiceRecordsL(aRemoteAddress, aHandle,
   397     mServiceSearcher->PopulateServiceRecordsL(aRemoteAddress, aHandle,
   400             aAttrIdsDes, aServiceRecordImpl);
   398             aAttrIdsDes, aServiceRecordImpl);