Skip to content

Create own Characteristic with UUID #11

@Severon96

Description

@Severon96

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions