}],
],
}, # tts
+ {
+ 'target_name': 'capi-system-device',
+ 'type': 'none',
+ 'conditions': [
+ ['is_tizen==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags capi-system-device)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other capi-system-device)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l capi-system-device)',
+ ],
+ },
+ }],
+ ],
+ }, # capi-system-device
],
}
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-appfw-app-manager)
BuildRequires: pkgconfig(capi-appfw-package-manager)
+BuildRequires: pkgconfig(capi-system-device)
BuildRequires: pkgconfig(capi-system-system-settings)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(chromium-efl)
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2018 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.
#include "atom/common/api/api_messages.h"
#include "common/string_utils.h"
#include "tizen/browser/tizen_browser_parts.h"
+#include "tizen/browser/vibration_manager.h"
#if defined(TIZEN_VIDEO_HOLE)
#include "atom/browser/native_window_efl.h"
} else {
security_model_version_ = 1;
}
+ tizen::VibrationManager::CreateInstance();
}
void TizenBrowserParts::GetCSP(std::string &csp_rule, std::string &csp_report_rule) {
--- /dev/null
+/*
+ * Copyright (c) 2018 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 "base/logging.h"
+#include "device/vibration/vibration_manager_impl_efl.h"
+#include "tizen/browser/vibration_manager.h"
+
+namespace tizen {
+
+VibrationManager::VibrationManager() : handle_(0) {
+ device::VibrationManagerImplEfl::RegisterProviderClient(this);
+}
+
+void VibrationManager::CreateInstance() {
+ static VibrationManager* vibration_provider_client = NULL;
+ // vibration_provider_client is deleted by device::VibrationProviderClient
+ if (!vibration_provider_client)
+ vibration_provider_client = new VibrationManager;
+}
+
+VibrationManager::~VibrationManager() {
+ LOG(INFO) << "~VibrationManager";
+ if (handle_ != 0) {
+ device_haptic_close(handle_);
+ handle_ = 0;
+ }
+}
+
+bool VibrationManager::Initialize() {
+ if (handle_ != 0)
+ return true;
+
+ int ret = device_haptic_open(0, &handle_);
+ if (ret != DEVICE_ERROR_NONE) {
+ LOG(ERROR) << "Fail to open haptic device";
+ handle_ = 0;
+ return false;
+ }
+ LOG(INFO) << "Device Haptic open successful";
+ return true;
+}
+
+void VibrationManager::Vibrate(uint64_t ms) {
+ if (Initialize()) {
+ LOG(INFO) << "Device Vibration Start";
+ device_haptic_vibrate(handle_, ms, 100, NULL);
+ }
+}
+
+void VibrationManager::CancelVibration() {
+ if (Initialize()) {
+ LOG(INFO) << "Device Vibration Stop";
+ device_haptic_stop(handle_, NULL);
+ }
+}
+
+} // namespace tizen
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2018 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 TIZEN_BROWSER_VIBRATION_MANAGER_H_
+#define TIZEN_BROWSER_VIBRATION_MANAGER_H_
+
+#include <device/haptic.h>
+#include "device/vibration/vibration_provider_client.h"
+
+namespace tizen {
+
+class VibrationManager : public device::VibrationProviderClient {
+ public:
+ static void CreateInstance();
+ VibrationManager();
+ /**
+ * Starts the vibration for the given amount of time
+ *
+ * @param vibrationTime amount of time for which vibration should happen
+ */
+ void Vibrate(uint64_t vibrationTime) override;
+
+ /**
+ * Cancels the vibration
+ */
+ void CancelVibration() override;
+ virtual ~VibrationManager();
+ private:
+ bool Initialize();
+ // haptic_devce_h was declared as int
+ haptic_device_h handle_;
+};
+
+} // namespace tizen
+
+#endif // TIZEN_BROWSER_VIBRATION_MANAGER_H_
'<(DEPTH)/efl/build/system.gyp:ecore',
'<(DEPTH)/efl/build/system.gyp:launchpad',
'<(DEPTH)/efl/build/system.gyp:capi-appfw-application',
+ '<(DEPTH)/efl/build/system.gyp:capi-system-device',
'<(DEPTH)/efl/build/system.gyp:elementary',
'<(DEPTH)/efl/build/system.gyp:tts',
'electron_shell_copy',
'dependencies': [
'wrt_lib',
'<(DEPTH)/efl/build/system.gyp:capi-appfw-application',
+ '<(DEPTH)/efl/build/system.gyp:capi-system-device',
'<(DEPTH)/tizen/common/common.gyp:wrt_common',
],
'sources': [
'tizen/src/browser/wrt_service.h',
'tizen/browser/tizen_browser_parts.cc',
'tizen/browser/tizen_browser_parts.h',
+ 'tizen/browser/vibration_manager.cc',
+ 'tizen/browser/vibration_manager.h',
],
'sources/': [
# chromium-efl supports only tizen webrtc using CAPI