javaextensions/bluetooth/omjbluetooth/src.s60/bluetoothstacks60native.cpp
changeset 79 2f468c1958d0
parent 21 2a9601315dfc
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
   204         {
   204         {
   205             std::wstring str(L"");
   205             std::wstring str(L"");
   206             ret = java::util::JniUtils::wstringToJstring(aJni, str);
   206             ret = java::util::JniUtils::wstringToJstring(aJni, str);
   207         }
   207         }
   208     }
   208     }
   209     catch (ExceptionBase ex)
   209     catch (ExceptionBase &ex)
   210     {
   210     {
   211         ELOG1(EJavaBluetooth,
   211         ELOG1(EJavaBluetooth,
   212               "- JNI::getRemoteDeviceFriendlyName Exception:%S", ex.what());
   212               "- JNI::getRemoteDeviceFriendlyName Exception:%S", ex.what());
   213         java::util::JniUtils::throwNewException(aJni,
   213         java::util::JniUtils::throwNewException(aJni,
   214                                                 "java/lang/RunTimeException", "Retrieving friendly name failed");
   214                                                 "java/lang/RunTimeException", "Retrieving friendly name failed");
   303     return ret;
   303     return ret;
   304 }
   304 }
   305 
   305 
   306 JNIEXPORT jint JNICALL
   306 JNIEXPORT jint JNICALL
   307 Java_com_nokia_mj_impl_bluetooth_BluetoothStackS60__1populateServiceRecordAttributeValues
   307 Java_com_nokia_mj_impl_bluetooth_BluetoothStackS60__1populateServiceRecordAttributeValues
   308 (JNIEnv *aEnv, jobject aPeer, jlong aRemoteDevice, jlong aHandle,
   308 (JNIEnv *aEnv, jobject /*aPeer*/, jlong aRemoteDevice, jlong aHandle,
   309  jintArray aAttrSet, jobject aServiceRecordImpl, jlong aDiscAgent)
   309  jintArray aAttrSet, jobject aServiceRecordImpl, jlong aDiscAgent)
   310 {
   310 {
   311     JELOG2(EJavaBluetooth);
   311     JELOG2(EJavaBluetooth);
   312     java::bluetooth::DiscoveryAgent* agent =
   312     java::bluetooth::DiscoveryAgent* agent =
   313         reinterpret_cast<java::bluetooth::DiscoveryAgent *>(
   313         reinterpret_cast<java::bluetooth::DiscoveryAgent *>(
   325 
   325 
   326     LOG(EJavaBluetooth, EInfo,
   326     LOG(EJavaBluetooth, EInfo,
   327         "   JNI::populateServiceRecordAttributeValues calling PopulateServiceRecord");
   327         "   JNI::populateServiceRecordAttributeValues calling PopulateServiceRecord");
   328     int result = KErrNone;
   328     int result = KErrNone;
   329     result = agent->PopulateServiceRecordAttrValue(
   329     result = agent->PopulateServiceRecordAttrValue(
   330                  aEnv, aPeer, aRemoteDevice, aHandle, attrIdsDes, serviceRecGlobalRef,
   330                  aEnv, aRemoteDevice, aHandle, attrIdsDes, serviceRecGlobalRef,
   331                  serviceSearchMonitor);
   331                  serviceSearchMonitor);
   332 
   332 
   333     if (KErrNone != result)
   333     if (KErrNone != result)
   334     {
   334     {
   335         aEnv->DeleteGlobalRef(serviceRecGlobalRef);
   335         aEnv->DeleteGlobalRef(serviceRecGlobalRef);
   705     std::wstring connectionUrl;
   705     std::wstring connectionUrl;
   706     try
   706     try
   707     {
   707     {
   708         connectionUrl = JniUtils::jstringToWstring(aJni, aUrl);
   708         connectionUrl = JniUtils::jstringToWstring(aJni, aUrl);
   709     }
   709     }
   710     catch (ExceptionBase ex)
   710     catch (ExceptionBase &ex)
   711     {
   711     {
   712         ELOG1(EJavaBluetooth,
   712         ELOG1(EJavaBluetooth,
   713               "- JNI::l2ServerOpen Exception:%S", ex.what());
   713               "- JNI::l2ServerOpen Exception:%S", ex.what());
   714         java::util::JniUtils::throwNewException(aJni,
   714         java::util::JniUtils::throwNewException(aJni,
   715                                                 "java/lang/RunTimeException",
   715                                                 "java/lang/RunTimeException",
  1075     std::wstring connectionUrl;
  1075     std::wstring connectionUrl;
  1076     try
  1076     try
  1077     {
  1077     {
  1078         connectionUrl = JniUtils::jstringToWstring(aJni, aUrl);
  1078         connectionUrl = JniUtils::jstringToWstring(aJni, aUrl);
  1079     }
  1079     }
  1080     catch (ExceptionBase ex)
  1080     catch (ExceptionBase &ex)
  1081     {
  1081     {
  1082         ELOG1(EJavaBluetooth,
  1082         ELOG1(EJavaBluetooth,
  1083               "- JNI::rfServerOpen Exception:%S", ex.what());
  1083               "- JNI::rfServerOpen Exception:%S", ex.what());
  1084         java::util::JniUtils::throwNewException(aJni,
  1084         java::util::JniUtils::throwNewException(aJni,
  1085                                                 "java/lang/RunTimeException",
  1085                                                 "java/lang/RunTimeException",
  1399 
  1399 
  1400     try
  1400     try
  1401     {
  1401     {
  1402         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1402         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1403     }
  1403     }
  1404     catch (ExceptionBase ex)
  1404     catch (ExceptionBase &ex)
  1405     {
  1405     {
  1406         ELOG1(EJavaBluetooth,
  1406         ELOG1(EJavaBluetooth,
  1407               "- JNI::initializeUpdateRecord Exception:%S", ex.what());
  1407               "- JNI::initializeUpdateRecord Exception:%S", ex.what());
  1408         java::util::JniUtils::throwNewException(aJni,
  1408         java::util::JniUtils::throwNewException(aJni,
  1409                                                 "java/lang/RunTimeException", "Updating service record failed");
  1409                                                 "java/lang/RunTimeException", "Updating service record failed");
  1448 
  1448 
  1449     try
  1449     try
  1450     {
  1450     {
  1451         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1451         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1452     }
  1452     }
  1453     catch (ExceptionBase ex)
  1453     catch (ExceptionBase &ex)
  1454     {
  1454     {
  1455         ELOG1(EJavaBluetooth,
  1455         ELOG1(EJavaBluetooth,
  1456               "- JNI::completesUpdateRecord Exception:%S", ex.what());
  1456               "- JNI::completesUpdateRecord Exception:%S", ex.what());
  1457         java::util::JniUtils::throwNewException(aJni,
  1457         java::util::JniUtils::throwNewException(aJni,
  1458                                                 "java/lang/RunTimeException", "Updating service record failed");
  1458                                                 "java/lang/RunTimeException", "Updating service record failed");
  1500 
  1500 
  1501     try
  1501     try
  1502     {
  1502     {
  1503         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1503         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1504     }
  1504     }
  1505     catch (ExceptionBase ex)
  1505     catch (ExceptionBase &ex)
  1506     {
  1506     {
  1507         ELOG1(EJavaBluetooth,
  1507         ELOG1(EJavaBluetooth,
  1508               "- JNI::sdpAddAttribute Exception:%S", ex.what());
  1508               "- JNI::sdpAddAttribute Exception:%S", ex.what());
  1509         java::util::JniUtils::throwNewException(aJni,
  1509         java::util::JniUtils::throwNewException(aJni,
  1510                                                 "java/lang/RunTimeException", "Updating service record failed");
  1510                                                 "java/lang/RunTimeException", "Updating service record failed");
  1653 
  1653 
  1654     try
  1654     try
  1655     {
  1655     {
  1656         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1656         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1657     }
  1657     }
  1658     catch (ExceptionBase ex)
  1658     catch (ExceptionBase &ex)
  1659     {
  1659     {
  1660         ELOG1(EJavaBluetooth,
  1660         ELOG1(EJavaBluetooth,
  1661               "- JNI::sdpAttributeListStart Exception:%S", ex.what());
  1661               "- JNI::sdpAttributeListStart Exception:%S", ex.what());
  1662         java::util::JniUtils::throwNewException(aJni,
  1662         java::util::JniUtils::throwNewException(aJni,
  1663                                                 "java/lang/RunTimeException", "Updating service record failed");
  1663                                                 "java/lang/RunTimeException", "Updating service record failed");
  1715 
  1715 
  1716     try
  1716     try
  1717     {
  1717     {
  1718         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1718         protocol = java::util::JniUtils::jstringToWstring(aJni, aProtocol);
  1719     }
  1719     }
  1720     catch (ExceptionBase ex)
  1720     catch (ExceptionBase &ex)
  1721     {
  1721     {
  1722         ELOG1(EJavaBluetooth,
  1722         ELOG1(EJavaBluetooth,
  1723               "- JNI::sdpAttributeListEnd Exception:%S", ex.what());
  1723               "- JNI::sdpAttributeListEnd Exception:%S", ex.what());
  1724         java::util::JniUtils::throwNewException(aJni,
  1724         java::util::JniUtils::throwNewException(aJni,
  1725                                                 "java/lang/RunTimeException", "Updating service record failed");
  1725                                                 "java/lang/RunTimeException", "Updating service record failed");