I am trying to send data from my Ionic app to Laptop I have written a simple bluetooth server in python using the PyBluez.
I try to connect the laptop using the bluetooth serial native api, but it never connects
Python Server:
import bluetooth
hostMACAddress = 'B8:81:98:9B:8A:6A' # The MAC address of a Bluetooth adapter on the server. The server might have multiple Bluetooth adapters.
port = 3
backlog = 1
size = 1024
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
s.bind((hostMACAddress, port))
s.listen(backlog)
print "open"
try:
client, clientInfo = s.accept()
while 1:
data = client.recv(size)
print "test"
if data:
print(data)
client.send(data) # Echo back to client
except:
print("Closing socket")
client.close()
s.close()
Ionic App:
private Bluetoothtest(){
this.bluetoothSerial.isEnabled().then((result) =>{
console.log(result);
this.bluetoothSerial.connect("00:15:83:0C:BF:RB");
this.bluetoothSerial.list().then((result) =>{
console.log(result);
this.bluetoothSerial.write('hello world').then((result) =>{
console.log(result);
})
})
})
}