Skip to content

Serial connection issue #17

@shohamrot

Description

@shohamrot

Since the change in the underlying dbus dependency and using the registerDummyAgent I'm unable to detect a serial connection.
I'm using a raspberry pi as a "server".

This is my code:

bluetooth.on('device', async (address, props) => {
        const device = await bluetooth.getDevice(address);
        logger.info("Found new Device " + address +" "+props.Paired+" "+props.Connected+" "+props.Name+ " ")
        if(props.Paired){
          logger.debug("paired device "+address)
        }
        else{
          logger.debug("unpaired device", address )
        }



    });

    bluetooth.init().then(async ()=>{

        // Register Agent that accepts everything and uses key 1234
        const agentResult = await bluetooth.registerDummyAgent();
        logger.info("Agent registered",agentResult);

        // Register a Serial Client Service
        const result = await bluetooth.registerSerialProfile(this.handleSocketConnection.bind(this), "server");
        logger.info("SerialProfile registered",result);

        // listen on first bluetooth adapter
        const adapter = await bluetooth.getAdapter('hci0');
        adapter.DiscoverableTimeout(config.bluetooth.discoverTimeOut)
        await adapter.Discoverable('on')

        await adapter.Pairable('on')


    });

The handleSocketConnection function starts like this:

  async handleSocketConnection(device,socket){
    const name = await device.Name();
    logger.info("Serial Connection from " + name);

"Serial Connection from" is never printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions