[Verification] Code compiles without errors.
Change-Id: I13cb9c82ee862e869cd079ba85eef23fd1ecda44
Signed-off-by: Tomasz Marciniak <t.marciniak@samsung.com>
'bluetooth_health_profile_handler.h',
'bluetooth_instance.cc',
'bluetooth_instance.h',
- 'bluetooth_privilege.cc',
- 'bluetooth_privilege.h',
'bluetooth_service_handler.cc',
'bluetooth_service_handler.h',
'bluetooth_socket.cc',
#include "bluetooth/bluetooth_class.h"
#include "bluetooth/bluetooth_device.h"
#include "bluetooth/bluetooth_instance.h"
-#include "bluetooth/bluetooth_privilege.h"
#include "bluetooth/bluetooth_socket.h"
#include "bluetooth/bluetooth_util.h"
void BluetoothAdapter::SetName(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothAdmin, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
const auto name = FromJson<std::string>(args, "name");
void BluetoothAdapter::SetPowered(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothAdmin, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
const auto new_powered = FromJson<bool>(args, "powered");
void BluetoothAdapter::SetVisible(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothManager, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
const auto visible = FromJson<bool>(args, "visible");
void BluetoothAdapter::DiscoverDevices(const picojson::value& /* data */, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
PlatformResult result = PlatformResult(ErrorCode::NO_ERROR);
if (!is_initialized_) {
void BluetoothAdapter::StopDiscovery(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
PlatformResult result = PlatformResult(ErrorCode::NO_ERROR);
void BluetoothAdapter::GetKnownDevices(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
auto get_known_devices = [this](const std::shared_ptr<picojson::value>& response) -> void {
void BluetoothAdapter::GetDevice(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
void BluetoothAdapter::CreateBonding(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
{
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothGap, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
void BluetoothAdapter::RegisterRFCOMMServiceByUUID(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
const auto callback_handle = util::GetAsyncCallbackHandle(data);
const auto& args = util::GetArguments(data);
var T = xwalk.utils.type;
var Converter = xwalk.utils.converter;
var AV = xwalk.utils.validator;
+var Privilege = xwalk.utils.privilege;
var native = new xwalk.utils.NativeManager(extension);
});
};
-var _PRIVILEGE_BLUETOOTH_GAP = 'http://tizen.org/privilege/bluetooth.gap';
-
BluetoothClass.prototype.hasService = function() {
console.log('Entered BluetoothClass.hasService()');
-
- xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_GAP);
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
var args = AV.validateMethod(arguments, [
{
BluetoothSocket.prototype.writeData = function() {
console.log('Entered BluetoothSocket.writeData()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
var args = AV.validateMethod(arguments, [
{
BluetoothSocket.prototype.readData = function() {
console.log('Entered BluetoothSocket.readData()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
var callArgs = {
id : this._id
BluetoothSocket.prototype.close = function() {
console.log('Entered BluetoothSocket.close()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
if (_BLUETOOTH_SOCKET_STATE_CLOSED !== this.state) {
var callArgs = {
BluetoothDevice.prototype.connectToServiceByUUID = function() {
console.log('Entered BluetoothDevice.connectToServiceByUUID()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
var args = AV.validateMethod(arguments, [
{
BluetoothServiceHandler.prototype.unregister = function() {
console.log('Entered BluetoothServiceHandler.unregister()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
+
var args = AV.validateMethod(arguments, [
{
name : 'successCallback',
BluetoothHealthApplication.prototype.unregister = function() {
console.log('Entered BluetoothHealthApplication.unregister()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
+
var args = AV.validateMethod(arguments, [
{
name : 'successCallback',
BluetoothHealthProfileHandler.prototype.registerSinkApplication = function() {
console.log('Entered BluetoothHealthProfileHandler.registerSinkApplication()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
var args = AV.validateMethod(arguments, [
{
BluetoothHealthProfileHandler.prototype.connectToSource = function() {
console.log('Entered BluetoothHealthProfileHandler.connectToSource()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
var args = AV.validateMethod(arguments, [
{
BluetoothHealthChannel.prototype.close = function() {
console.log('Entered BluetoothHealthChannel.close()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
if (this.isConnected) {
var callArgs = {
BluetoothHealthChannel.prototype.sendData = function() {
console.log('Entered BluetoothHealthChannel.sendData()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
var args = AV.validateMethod(arguments, [
{
}
}
-var _PRIVILEGE_BLUETOOTH_HEALTH = 'http://tizen.org/privilege/bluetooth.health';
-
BluetoothHealthChannel.prototype.setListener = function() {
console.log('Entered BluetoothHealthChannel.setListener()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
+
var args = AV.validateMethod(arguments, [
{
name : 'changeCallback',
}
]);
- xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_HEALTH);
-
if (T.isEmptyObject(_healthListeners)) {
native.addListener('BluetoothHealthChannelChangeCallback',
_BluetoothHealthChannelChangeCallback);
BluetoothHealthChannel.prototype.unsetListener = function() {
console.log('Entered BluetoothHealthChannel.unsetListener ()');
-
- xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_HEALTH);
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_HEALTH);
delete _healthListeners[this._id];
BluetoothAdapter.prototype.setName = function() {
console.log('Entered BluetoothAdapter.setName()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_ADMIN);
+
var args = AV.validateMethod(arguments, [
{
name : 'name',
BluetoothAdapter.prototype.setPowered = function() {
console.log('Entered BluetoothAdapter.setPowered()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_ADMIN);
+
var args = AV.validateMethod(arguments, [
{
name : 'powered',
BluetoothAdapter.prototype.setVisible = function() {
console.log('Entered BluetoothAdapter.setVisible()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTHMANAGER);
+
var args = AV.validateMethod(arguments, [
{
name : 'visible',
BluetoothAdapter.prototype.discoverDevices = function() {
console.log('Entered BluetoothAdapter.discoverDevices()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
var args = AV.validateMethod(arguments, [
{
name : 'successCallback',
BluetoothAdapter.prototype.stopDiscovery = function() {
console.log('Entered BluetoothAdapter.stopDiscovery()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
var args = AV.validateMethod(arguments, [
{
name : 'successCallback',
BluetoothAdapter.prototype.getKnownDevices = function() {
console.log('Entered BluetoothAdapter.getKnownDevices()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
var args = AV.validateMethod(arguments, [
{
name : 'successCallback',
BluetoothAdapter.prototype.getDevice = function() {
console.log('Entered BluetoothAdapter.getDevice()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
var args = AV.validateMethod(arguments, [
{
name : 'address',
BluetoothAdapter.prototype.createBonding = function() {
console.log('Entered BluetoothAdapter.createBonding()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
var args = AV.validateMethod(arguments, [
{
name : 'address',
BluetoothAdapter.prototype.destroyBonding = function() {
console.log('Entered BluetoothAdapter.destroyBonding()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
+
var args = AV.validateMethod(arguments, [
{
name : 'address',
BluetoothAdapter.prototype.registerRFCOMMServiceByUUID = function() {
console.log('Entered BluetoothAdapter.registerRFCOMMServiceByUUID()');
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_SPP);
+
var args = AV.validateMethod(arguments, [
{
name : 'uuid',
BluetoothManager.prototype.getDefaultAdapter = function() {
console.log('Entered BluetoothManager.getDefaultAdapter()');
- xwalk.utils.checkPrivilegeAccess(_PRIVILEGE_BLUETOOTH_GAP);
+ xwalk.utils.checkPrivilegeAccess(Privilege.BLUETOOTH_GAP);
return new BluetoothAdapter();
};
#include "bluetooth_adapter.h"
#include "bluetooth_class.h"
-#include "bluetooth_privilege.h"
#include "bluetooth_util.h"
namespace extension {
void BluetoothDevice::ConnectToServiceByUUID(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
const auto& args = util::GetArguments(data);
adapter_.ConnectToServiceByUUID(FromJson<std::string>(args, "address"),
#include "common/extension.h"
#include "bluetooth_health_profile_handler.h"
-#include "bluetooth_privilege.h"
#include "bluetooth_util.h"
namespace extension {
void BluetoothHealthApplication::Unregister(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
const auto& args = util::GetArguments(data);
handler_.UnregisterSinkAppAsync(FromJson<std::string>(args, "id"),
#include "common/extension.h"
#include "bluetooth_device.h"
-#include "bluetooth_privilege.h"
#include "bluetooth_util.h"
namespace extension {
void BluetoothHealthChannel::Close(const picojson::value& data , picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
const auto& args = util::GetArguments(data);
unsigned int channel = common::stol(FromJson<std::string>(args, "channel"));
void BluetoothHealthChannel::SendData(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
const auto& args = util::GetArguments(data);
unsigned int channel = common::stol(FromJson<std::string>(args, "channel"));
#include "bluetooth/bluetooth_instance.h"
#include "bluetooth/bluetooth_health_application.h"
#include "bluetooth/bluetooth_health_channel.h"
-#include "bluetooth/bluetooth_privilege.h"
#include "bluetooth/bluetooth_util.h"
namespace extension {
void BluetoothHealthProfileHandler::RegisterSinkApp(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
const auto& args = util::GetArguments(data);
const auto data_type = static_cast<short>(FromJson<double>(args, "dataType"));
const auto& name = FromJson<std::string>(args, "name");
void BluetoothHealthProfileHandler::ConnectToSource(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothHealth, &out);
-
const auto& args = util::GetArguments(data);
const auto& address = FromJson<std::string>(args, "address");
const auto& app_id = FromJson<std::string>(args, "appId");
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "bluetooth_privilege.h"
-
-namespace extension {
-namespace bluetooth {
-
-namespace Privilege {
-const std::string kBluetoothAdmin = "http://tizen.org/privilege/bluetooth.admin";
-const std::string kBluetoothManager = "http://tizen.org/privilege/bluetoothmanager";
-const std::string kBluetoothGap = "http://tizen.org/privilege/bluetooth.gap";
-const std::string kBluetoothSpp = "http://tizen.org/privilege/bluetooth.spp";
-const std::string kBluetoothHealth = "http://tizen.org/privilege/bluetooth.health";
-} // namespace Privilege
-
-} // namespace bluetooth
-} // namespace extension
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef BLUETOOTH_BLUETOOTH_PRIVILEGE_H_
-#define BLUETOOTH_BLUETOOTH_PRIVILEGE_H_
-
-#include <string>
-
-namespace extension {
-namespace bluetooth {
-
-namespace Privilege {
-
-extern const std::string kBluetoothAdmin;
-extern const std::string kBluetoothManager;
-extern const std::string kBluetoothGap;
-extern const std::string kBluetoothSpp;
-extern const std::string kBluetoothHealth;
-
-} // namespace Privilege
-
-} // namespace bluetooth
-} // namespace extension
-
-#endif // BLUETOOTH_BLUETOOTH_PRIVILEGE_H_
#include "common/extension.h"
#include "bluetooth_adapter.h"
-#include "bluetooth_privilege.h"
#include "bluetooth_util.h"
namespace extension {
void BluetoothServiceHandler::Unregister(const picojson::value& data, picojson::object& out) {
LoggerD("Entered");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
const auto& args = util::GetArguments(data);
adapter_.UnregisterUUID(FromJson<std::string>(args, "uuid"),
#include "bluetooth_adapter.h"
#include "bluetooth_device.h"
-#include "bluetooth_privilege.h"
#include "bluetooth_util.h"
namespace extension {
void BluetoothSocket::WriteData(const picojson::value& data, picojson::object& out) {
LoggerD("Enter");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
const auto& args = util::GetArguments(data);
int socket = common::stol(FromJson<std::string>(args, "id"));
void BluetoothSocket::ReadData(const picojson::value& data, picojson::object& out) {
LoggerD("Enter");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
const auto& args = util::GetArguments(data);
int socket = common::stol(FromJson<std::string>(args, "id"));
void BluetoothSocket::Close(const picojson::value& data, picojson::object& out) {
LoggerD("Enter");
- CHECK_PRIVILEGE_ACCESS(Privilege::kBluetoothSpp, &out);
-
const auto& args = util::GetArguments(data);
int socket = common::stol(FromJson<std::string>(args, "id"));