Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not run server on Linux #235

Open
SoGoDev opened this issue Jun 24, 2020 · 2 comments
Open

could not run server on Linux #235

SoGoDev opened this issue Jun 24, 2020 · 2 comments

Comments

@SoGoDev
Copy link

SoGoDev commented Jun 24, 2020

I have such code , and when i check if server is running, it always return false.

import * as btSerial from "bluetooth-serial-port";

export default class Bluetooth {
  private bl;
  CHANNEL = 10; // My service channel. Defaults to 1 if omitted.
  UUID = '38e851bc-7144-44b4-9cd8-80549c6f2912'; // My own service UUID. Defaults to '1101' if omitted
  constructor() {
    this.onData = this.onData.bind(this);
    this.onError = this.onError.bind(this);
    this.onSuccess = this.onSuccess.bind(this);

    this.bl = new btSerial.BluetoothSerialPortServer();

    this.bl.listen(this.onSuccess, this.onError);
    this.bl.on('data', this.onData, {channel: this.CHANNEL})


  }

  onSuccess(address) {
    console.log('Client: ' + address + ' connected!');
  }

  onError(error) {
    console.error("Something wrong happened!:" + error);
  }

  onData(buffer){
    console.log('Received data from client: ' + buffer);
  }

}
@SoGoDev SoGoDev changed the title could not run server could not run server on Linux Jun 28, 2020
@zxfrank
Copy link

zxfrank commented Aug 14, 2020

same for me, raspberryPI, it must be a bluetooth config issue...

it may have a link with #202 (comment), or not

running sudo node [your server file name].js registers it as a "RFCOMM custom service" but no luck, can't connect to it

@zxfrank
Copy link

zxfrank commented Aug 14, 2020

Tried with https://github.com/dinohorvat/pybluez--rfcomm-server

sudo python rfcomm-server.py 
Waiting for connection on RFCOMM channel 1

sudo sdptool browse local can see it, but can't connect from android bluetooth serial

[...]
Service Name: SampleServer
Service RecHandle: 0x10007
Service Class ID List:
  UUID 128: 94f39d29-7d6d-437d-973b-fba39e49d4ee
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Profile Descriptor List:
  "Serial Port" (0x1101)
    Version: 0x0100
[...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants