Skip to content

Create own Characteristic with UUID #11

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

Open
Severon96 opened this issue Sep 5, 2022 · 1 comment
Open

Create own Characteristic with UUID #11

Severon96 opened this issue Sep 5, 2022 · 1 comment

Comments

@Severon96
Copy link

Hello,

is it possible to create an own UartCharacteristic with a predefined UUID?
I tried to extend the HostGattCharacteristic and call the super with my own UUID but something is missing in my code, I guess, because the dbus throws me the following error:

/home/pi/node-ble-peripheral-concept/node_modules/dbus-next/lib/service/object.js:29
      throw new Error(`an interface with name '${iface.$name}' is already exported on this object`);
            ^

Error: an interface with name 'org.bluez.GattCharacteristic1' is already exported on this object
    at ServiceObject.addInterface (/home/pi/node-ble-peripheral-concept/node_modules/dbus-next/lib/service/object.js:29:13)
    at MessageBus.export (/home/pi/node-ble-peripheral-concept/node_modules/dbus-next/lib/bus.js:379:9)
    at Bluez.exportInterface (/home/pi/node-ble-peripheral-concept/node_modules/@sorrir/bluetooth/lib/core/bluez.js:154:32)
    at TriveParkCharacteristic._init (/home/pi/node-ble-peripheral-concept/node_modules/@sorrir/bluetooth/lib/core/host-interfaces/models/base-host-interface.js:98:18)
    at new HostGattCharacteristic (/home/pi/node-ble-peripheral-concept/node_modules/@sorrir/bluetooth/lib/core/host-interfaces/host-gatt-characteristic.js:101:13)
    at new TriveParkCharacteristic (/home/pi/node-ble-peripheral-concept/src/TriveParkRxCharacteristic.js:5:5)
    at startBluetooth (/home/pi/node-ble-peripheral-concept/src/app.js:45:28)

This is how i'm trying to create the characteristic:

const { HostGattCharacteristic } = require("@sorrir/bluetooth");

class TriveParkCharacteristic extends HostGattCharacteristic {
  constructor(bluez, service, uuid) {
    super(bluez, service, uuid, ["write"], 0);
    _initialize((0, _assertThisInitialized2["default"])(_this));

    this.update();
  }
}

module.exports = TriveParkCharacteristic;

Maybe someone know what I'm doing wrong?

@QuadratClown
Copy link
Member

It is possible. Can you provide a minimum example to reproduce the error? The code snippet looks fine so far

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