--- /dev/null
+/*
+
+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;
+}
+
--- /dev/null
+<!DOCTYPE html>
+<!--
+
+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:
+ Karol Surma <k.surma@samsung.com>
+-->
+
+<html>
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+ <meta name="description" content="Tizen basic template generated by Tizen Web IDE"/>
+
+ <title>tct-bt-helper</title>
+
+ <link rel="stylesheet" type="text/css" href="css/style.css"/>
+ <script src="js/main.js"></script>
+</head>
+
+<body>
+ <header>
+ <hgroup>
+ <h1>Bluetooth</h1>
+ <h2>tct-bt-helper</h2>
+ </hgroup>
+ </header>
+
+
+
+ <article>
+ <p>Service UUID</p>
+ <div id="serviceUUID">
+ <input type="text" id="serviceTxt" value="5BCE9431-6C75-32AB-AFE0-2EC108A30860">
+ </div>
+ <div id="registerSection">
+ <button onclick="registerService();">Register service</button>
+
+ <button onclick="unregisterService();">Unregister service</button>
+ </div>
+ <div id="discoverSection">
+ <p>Bluetooth device list</p>
+ <select id="devicesList" >
+ </select>
+ <button onclick="discover();">Search</button>
+ </div>
+ <div id="connectService">
+ <p>Connect to service</p>
+ <button onclick="connectService();">Connect to service</button>
+ </div>
+ </article>
+
+ <footer>
+ <p>© 2013 Samsung. All rights reserved.</p>
+ </footer>
+</body>
+</html>
--- /dev/null
+/*
+
+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);
+}