Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = {
- initialize: function() {
- this.bindEvents();
- },
- bindEvents: function() {
- document.addEventListener('deviceready', this.onDeviceReady, false);
- },
- onDeviceReady: function() {
- app.receivedEvent('deviceready');
- alert("Before connect");
- //bluetoothSerial.enable(connectSuccess, connectFailure);
- bluetoothSerial.connect("98:D3:31:40:06:5C", connectSuccess, connectFailure);
- alert("After connect");
- },
- receivedEvent: function(id) {
- var parentElement = document.getElementById(id);
- var listeningElement = parentElement.querySelector('.listening');
- var receivedElement = parentElement.querySelector('.received');
- listeningElement.setAttribute('style', 'display:none;');
- receivedElement.setAttribute('style', 'display:block;');
- console.log('Received Event: ' + id);
- }
- };
- function connectSuccess(){
- alert("Success!");
- };
- function connectFailure(){
- alert("Failed");
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement