From: zhaofeng Date: Tue, 15 Sep 2020 08:45:21 +0000 (+0800) Subject: [common][bluetooth][TSIX-6237, add new tct-help wgt with wearable profile] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F244153%2F4;p=test%2Ftct%2Fweb%2Fapi.git [common][bluetooth][TSIX-6237, add new tct-help wgt with wearable profile] Change-Id: Iccd83daef894055bfeb1c68d94c7f8737309e94f Signed-off-by: zhaofeng --- diff --git a/common/tct-bluetooth-tizen-tests/suite.json b/common/tct-bluetooth-tizen-tests/suite.json index dc3c85281..44db39249 100755 --- a/common/tct-bluetooth-tizen-tests/suite.json +++ b/common/tct-bluetooth-tizen-tests/suite.json @@ -32,6 +32,14 @@ ], "install-path": "apps", "sign-flag": "true" + }, + "wearable-tct-bt-helper": { + "app-name": "wearable-tct-bt-helper", + "blacklist": [ + "manifest.json" + ], + "install-path": "apps", + "sign-flag": "true" } } }, diff --git a/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/config.xml b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/config.xml new file mode 100755 index 000000000..8a4c03b71 --- /dev/null +++ b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/config.xml @@ -0,0 +1,10 @@ + + + + + + wearable-tct-bt-helper + + + + diff --git a/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/css/style.css b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/css/style.css new file mode 100755 index 000000000..a55f48205 --- /dev/null +++ b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/css/style.css @@ -0,0 +1,86 @@ +/* + +Copyright (c) 2013 Samsung Electronics Co., Ltd. + +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. + + + +Authors: + + + +*/ + +* { + font-family: Lucida Sans, Arial, Helvetica, sans-serif; +} + +body { + margin: 0px auto; +} + +header h1 { + font-size: 36px; + margin: 0px; +} + +header h2 { + font-size: 18px; + margin: 0px; + color: #888; + font-style: italic; +} + +article select { + width: 150px; +} + +article p { + clear: both; +} + +article > section form { + border: 1px solid #888; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; + -moz-box-shadow: 10px 10px 5px #888; + -webkit-box-shadow: 10px 10px 5px #888; + box-shadow: 10px 10px 5px #888; + background-color: #eee; + padding: 10px; + margin-bottom: 30px; +} + +article > section label { + font-weight: bold; + font-size: 13px; +} + +article > section input { + margin-bottom: 3px; + font-size: 13px; +} + +#serviceTxt { + width: 300px; +} + +footer p { + text-align: center; + font-size: 12px; + color: #888; + margin-top: 24px; +} + diff --git a/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/icon.png b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/icon.png new file mode 100755 index 000000000..c22cfa8db Binary files /dev/null and b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/icon.png differ diff --git a/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/images/tizen_32.png b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/images/tizen_32.png new file mode 100755 index 000000000..983c88349 Binary files /dev/null and b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/images/tizen_32.png differ diff --git a/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/index.html b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/index.html new file mode 100755 index 000000000..133059d01 --- /dev/null +++ b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/index.html @@ -0,0 +1,72 @@ + + + + + + + + + + tct-bt-helper + + + + + + +
+
+

Bluetooth

+

tct-bt-helper

+
+
+ + + +
+

Service UUID

+
+ +
+
+ +    + +
+
+

Bluetooth device list

+ + +
+
+

Connect to service

+ +
+
+ + + + diff --git a/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/js/main.js b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/js/main.js new file mode 100755 index 000000000..89d08bf75 --- /dev/null +++ b/common/tct-bluetooth-tizen-tests/wearable-tct-bt-helper/js/main.js @@ -0,0 +1,137 @@ +/* + +Copyright (c) 2013 Samsung Electronics Co., Ltd. + +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. + + + +Authors: + + + +*/ + +var serviceHandler = null; + +function discoverDevicesError() { + alert("Error discoverDevices"); +} + +function setPoweredError() { + alert("Error setPowered"); +} + +function startDiscoveryDevice() { + var length, k; + alert("searching - it's gona take about 10 seconds"); + var discoverDevicesSuccessCallback = { + onstarted: function() { + }, + ondevicefound: function(device) { + }, + ondevicedisappeared: function(address) { + }, + onfinished: function(devices) { + length = devices.length; + document.getElementById("devicesList").options.length = 0; + for (k = 0; k < length; k++) { + document.getElementById("devicesList").options[k] = new Option(devices[k].address + " - " + devices[k].name, devices[k].address); + } + alert("search completed"); + } + }; + adapter.discoverDevices(discoverDevicesSuccessCallback, discoverDevicesError); +} + +function registerServiceSuccessCallback(handler) { + serviceHandler = handler; + handler.onconnect = function(socket) { + var textmsg = "Test", sendtextmsg = [], length, i; + length = textmsg.length; + for (i = 0; i < length; i++) { + sendtextmsg[i] = textmsg.charCodeAt(i); + } + socket.writeData(sendtextmsg); + } + alert("service registered"); +} + +function registerServiceError() { + alert("Error registerService"); +} + +function startRegisterService() { + adapter.registerRFCOMMServiceByUUID(document.getElementById("serviceTxt").value,"Chat service",registerServiceSuccessCallback,registerServiceError); +} + +function discover() { + adapter = tizen.bluetooth.getDefaultAdapter(); + adapter.setPowered(true, startDiscoveryDevice, setPoweredError) +} + +function registerService() { + adapter = tizen.bluetooth.getDefaultAdapter(); + adapter.setPowered(true,startRegisterService,setPoweredError); +} + +function unregisterServiceSuccessCallback() { + chatServiceHandler = null; + alert("Service is unregistered."); +} + +function unregisterServiceError() { + alert("Error unregisterService"); +} + +function unregisterService() { + if (serviceHandler != null) { + serviceHandler.unregister(unregisterServiceSuccessCallback,unregisterServiceError); + } +} + +function createBondingError() { + alert("Error createBonding"); +} + +function getDeviceError() { + alert("Error getDevice"); +} + +function connectError() { + alert("Error connectToServiceByUUID"); +} + +function connectCallback(device) { + if (device != null && device.uuids.indexOf(document.getElementById("serviceTxt").value) !== -1) { + // open socket + device.connectToServiceByUUID(document.getElementById("serviceTxt").value, function() { + alert("connected"); + },connectError); + } else { + alert("device UUID is null"); + } +} + +function getDeviceCallback() { + adapter.getDevice(document.getElementById("devicesList").value, connectCallback, getDeviceError); +} + +function createBondingCallback() { + adapter.createBonding(document.getElementById("devicesList").value, getDeviceCallback, createBondingError); +} + +function connectService() { + adapter = tizen.bluetooth.getDefaultAdapter(); + adapter.setPowered(true, createBondingCallback, setPoweredError); +}