{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
BluetoothDeviceDataClass devClass = BluetoothDeviceManager->getClass();
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
bool isConnected = BluetoothDeviceManager->getConnectProperty();
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
{
if (priv == NULL)
{
- Throw(UnknownException);
+ Throw(ConversionException);
}
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
{
LogError("InvalidArgumentException");
return JSTizenExceptionFactory::postException(context, exception,
- JSTizenException::TYPE_MISMATCH_ERROR, "invalid value error");
+ JSTizenException::INVALID_VALUES_ERROR, "invalid value error");
}
Catch(WrtDeviceApis::Commons::UnsupportedException)
{
JSBluetoothDevicePriv *priv = static_cast<JSBluetoothDevicePriv*>(JSObjectGetPrivate(thisObject));
JSValueRef successCallback = NULL;
JSValueRef errorCallBack = NULL;
-
+ size_t index = 0;
+ JSValueRef reserveArguments[4];
+ JSCallbackManagerPtr cbm = JSCallbackManager::createObject(priv->getContext(), NULL, NULL);
Try {
+ for (index = 0; index < 4; index++)
+ {
+ if (index < argumentCount)
+ reserveArguments[index] = arguments[index];
+ else
+ reserveArguments[index] = JSValueMakeNull(context);
+
+ }
if (priv == NULL)
{
LogError("priv null");
- Throw(UnknownException);
+ Throw(ConversionException);
}
LogDebug(bluetoothExportedNames[BLUETOOTH_FUNCTION_API_DEVICE_CONNECT_TO_SERVICE]);
AceSecurityStatus status = BLUETOOTH_CHECK_ACCESS(
- priv->getContext(),
bluetoothExportedNames[BLUETOOTH_FUNCTION_API_DEVICE_CONNECT_TO_SERVICE]);
TIZEN_SYNC_ACCESS_HANDLER(status, context, exception);
- if (argumentCount < 2 || argumentCount > 4)
- {
- LogError("InvalidArgumentException");
- return JSTizenExceptionFactory::postException(context,
- exception, JSTizenException::INVALID_VALUES_ERROR, "invalid parameter error");
-
- }
- if (JSValueIsNull(context, arguments[0]) == true || JSValueIsString(context, arguments[0]) == false)
- {
- LogError("hasInstance TypeMismatchException");
- return JSTizenExceptionFactory::postException(context,
- exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
- }
BluetoothConverter converter(context);
- successCallback = converter.toFunction(arguments[1]);
+ successCallback = converter.toFunction(reserveArguments[1]);
+ errorCallBack = converter.toFunctionOrNull(reserveArguments[2]);
- if (argumentCount >= 3)
- {
- errorCallBack = converter.toFunctionOrNull(arguments[2]);
- }
-
- JSCallbackManagerPtr cbm = JSCallbackManager::createObject(priv->getContext(), NULL, NULL);
if (cbm == NULL)
{
IBluetoothDeviceManagerPtr BluetoothDeviceManager(priv->getObject());
EventBTConnectToServiceByUUIDPtr event(new EventBTConnectToServiceByUUID);
BluetoothSocketData socketData;
- socketData.uuid = converter.toString(arguments[0]);
+ socketData.uuid = converter.toBluetoothUUIDString(reserveArguments[0]);
socketData.protocol = PROTOCOL_TYPE_RFCOMM_VALUE_INT;
if (argumentCount >= 4)
{
- if (JSValueIsNull(context, arguments[3]) == true)
- {
- socketData.protocol = PROTOCOL_TYPE_RFCOMM_VALUE_INT;
- }
- else
- {
- if (JSValueIsString(context, arguments[3]) == false)
- {
-
- LogError("InvalidArgumentException");
- return JSTizenExceptionFactory::postException(context,
- exception, JSTizenException::TYPE_MISMATCH_ERROR, "type mismatch error");
- }
-
- std::string protocol = converter.toString(arguments[3]);
- LogDebug(protocol.c_str());
-
- if (strcmp(protocol.c_str(), PROTOCOL_TYPE_RFCOMM_VALUE) == 0)
- {
- socketData.protocol = PROTOCOL_TYPE_RFCOMM_VALUE_INT;
- }
- else
- {
- LogError("BluetoothDeviceManager or event or listener NULL");
- Throw(WrtDeviceApis::Commons::UnsupportedException);
- }
-
- }
+ socketData.protocol = converter.toBluetoothProtocolInt(reserveArguments[3]);
}
if (BluetoothDeviceManager == NULL || event == NULL)
event->setForAsynchronousCall(&BluetoothDeviceManagerListener::getInstance());
event->setSocketData(socketData);
BluetoothDeviceManager->connectToServiceByUUID(event);
-
- return JSValueMakeNull(context);
}
Catch (WrtDeviceApis::Commons::ConversionException)
{
return JSValueMakeUndefined(context);
}
-
-
}
}