W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > July 2017

[web-bluetooth] TypeError: server.getPrimaryService is not a function

From: Zhangrui via GitHub <sysbot+gh@w3.org>
Date: Fri, 14 Jul 2017 09:36:22 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issues.opened-242946449-1500024981-sysbot+gh@w3.org>
brave2016 has just created a new issue for https://github.com/WebBluetoothCG/web-bluetooth:

== TypeError: server.getPrimaryService is not a function ==
	navigator.bluetooth.requestDevice(options).then(device => {
			console.log('Got device:', device.name);
			console.log('id:', device.id);
			console.log('Connected:' + device.gatt.connected);
			console.log('Connected:' + device.gatt.connected);
			document.getElementById("demo").innerHTML="My First JavaScript"+device.name;
		//	bltr =device.gatt.connect();
		          return device;
			}).then(device => {
				document.getElementById("conn").innerHTML="true";
			    return device.gatt.connect;
			}).then(server => {
				document.getElementById("service").innerHTML="trurservcice";
			 server.getPrimaryService('00000000-0000-1000-8000-00805F9B34FB');
			}).then(service => {
	
	              service.getCharacteristic('00000002-0000-1000-8000-00805F9B34FB');
             })
			
			.catch(error => {
			document.getElementById("demo").innerHTML="error"+error;
			});

Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/369 using your GitHub account
Received on Friday, 14 July 2017 09:36:29 UTC

This archive was generated by hypermail 2.3.1 : Friday, 14 July 2017 09:36:29 UTC