{"id":20160816,"url":"https://github.com/lukasbombach/sblendid","last_synced_at":"2025-04-10T00:10:55.758Z","repository":{"id":54438978,"uuid":"195518186","full_name":"LukasBombach/sblendid","owner":"LukasBombach","description":"A JavaScript Bluetooth Low Energy (BLE) Library","archived":false,"fork":false,"pushed_at":"2020-09-10T16:22:09.000Z","size":3673,"stargazers_count":63,"open_issues_count":10,"forks_count":5,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-10T00:10:47.554Z","etag":null,"topics":["ble","bluetooth","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LukasBombach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-06T08:48:25.000Z","updated_at":"2025-03-17T19:32:16.000Z","dependencies_parsed_at":"2022-08-13T15:40:48.520Z","dependency_job_id":null,"html_url":"https://github.com/LukasBombach/sblendid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasBombach%2Fsblendid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasBombach%2Fsblendid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasBombach%2Fsblendid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasBombach%2Fsblendid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LukasBombach","download_url":"https://codeload.github.com/LukasBombach/sblendid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131317,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ble","bluetooth","javascript","nodejs"],"created_at":"2024-11-14T00:16:03.464Z","updated_at":"2025-04-10T00:10:55.726Z","avatar_url":"https://github.com/LukasBombach.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Sblendid\" src=\"https://github.com/LukasBombach/sblendid/blob/master/packages/sblendid/docs/images/sblendid-logo.svg\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eBluetooth Low Energy for JavaScript\u003c/strong\u003e\u003cbr\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"separator\" src=\"https://raw.githubusercontent.com/LukasBombach/new-type-js/master/demo/images/separator.png\" height=\"59\"\u003e\n\u003c/p\u003e\n\n- [Usage](#basic-workflow) - How to use Sblendid and interact with Peripherals\n- [API](#api) - Full API description of all functions of this library\n- [Examples](#more-examples) - Further examples\n\nWith Sblendid you can find and connect to Bluetooth Low Energy (BLE) devices (called peripherals) and interact with them.\nIt is implemented in TypeScript and built on top of native code using the system's bluetooth APIs.\n\n![Build Status](https://github.com/LukasBombach/sblendid/workflows/build/badge.svg)\n![Code Climate Coverage](https://img.shields.io/codeclimate/coverage/LukasBombach/sblendid)\n![Code Climate Maintainability](https://img.shields.io/codeclimate/maintainability/LukasBombach/sblendid)\n![MIT License](https://img.shields.io/github/license/LukasBombach/sblendid?color=brightgreen)\n\n## Install\n\n```bash\nnpm install @sblendid/sblendid @sblendid/adapter-node\n```\n\n\u003e ##### Important development notice\n\u003e\n\u003e _Sblendid has not oficially been released yet. You can already install it, but this is a \"silent launch\" and supports macOS and Windows only thus far. I am currently [working on Linux support](https://github.com/LukasBombach/sblendid/pull/5) and will publish version 1.0.0 once I have finished this and the documentation._\n\nSblendid will support Linux, macOS and Windows. In the future, Sblendid should support other platforms\nincluding React Native and WebBluetooth. Hence, you have to install the `@sblendid/adapter-node`\npackage as a seperate dependency. Native modules for macOS and Windows are provided by\n[Timeular](https://github.com/Timeular) (thanks!)\n\n- If something doesn’t work, please [file an issue](https://github.com/LukasBombach/sblendid/issues/new).\u003cbr\u003e\n- If you have feature request, please [file an issue](https://github.com/LukasBombach/sblendid/issues/new).\u003cbr\u003e\n\nAs this is in an early stage, your feedback is very welcome, please don't hesitate to file issues.\n\n## Basic workflow\n\nWith BLE you usually use the [GATT protocol](https://www.bluetooth.com/specifications/gatt/). This means you\nconnect to a `peripheral`, get one ore more `services` of that peripheral and `read` / `write` / `subscribe to`\nvalues on these services. With Sblendid this works as follows:\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(\"My Peripheral\");\n  const service = await peripheral.getService(\"uuid\");\n\n  const value = await service.read(\"uuid\");\n  await service.write(\"uuid\", Buffer.from(\"value\", \"utf8\"));\n  service.on(\"uuid\", value =\u003e console.log(value));\n\n  // You need to power off your Bluetooth adapter or your Node process won't end\n  await Sblendid.powerOff();\n})();\n```\n\n\u003e ##### Timeouts\n\u003e\n\u003e It is important to know that no function in this libary has a timeout. `Sblendid.connect`\n\u003e will scan indefinitely unless you make sure it doesn't. At some point in the future\n\u003e timeouts will be built in but it is not a scope of version 1.0.0\n\n## Converters\n\nIn the previous example, all values you read, write or get notified for are\n[`Buffers`](https://nodejs.org/api/buffer.html). It might get weary to constantly convert\n`Buffers` to the values you actually want to work on. For this, Sblendid introduces a\nconcept called `converters`.\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\n// Converts buffers to another value and back. You can\n// work with numbers, objects, classes or anything as\n// long as you write appropriate decode and encode functions\nconst converters: {\n  myValue: {\n    uuid: \"uuid\",\n    decode: buffer =\u003e buffer.toString(),\n    encode: message =\u003e Buffer.from(message, \"utf8\")\n  },\n  otherValue: {\n    uuid: \"anotherUuid\",\n    decode: buffer =\u003e buffer.readUInt8(0),\n    encode: num =\u003e Buffer.from([num])\n  }\n};\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(\"My Peripheral\");\n  const service = await peripheral.getService(\"uuid\", converters);\n\n  // value will be a string\n  const value = await service.read(\"myValue\");\n\n  // you can pass a string\n  await service.write(\"myValue\", \"value\");\n\n  // value will also be a string\n  service.on(\"myValue\", value =\u003e console.log(value));\n\n  // values for \"otherValue\" will be numbers\n  const value2 = await service.read(\"otherValue\");\n  await service.write(\"otherValue\", 22);\n  service.on(\"otherValue\", value =\u003e console.log(value));\n\n  // You need to power off your Bluetooth adapter or your Node process won't end\n  await Sblendid.powerOff();\n})();\n```\n\n## Scan for Peripherals around you\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\n(async () =\u003e {\n  const sblendid = await Sblendid.powerOn();\n\n  sblendid.startScanning(peripheral =\u003e {\n    const { uuid, name, connectable, advertisement } = peripheral;\n    const { txPowerLevel, manufacturerData, serviceUUIDs } = advertisement;\n\n    console.log(\"Found Peripheral:\");\n    console.log(uuid, name, connectable);\n    console.log(txPowerLevel, manufacturerData, serviceUUIDs);\n  });\n\n  // You need to power off your Bluetooth adapter or your Node process won't end\n  // Note the lower case \"s\", powerOff is a static and an instance method\n  await sblendid.powerOff();\n})();\n```\n\nThe callback in `startScanning` will receive an instance of `Peripheral`. See\n\n- [Sblendid.powerOn](#static-async-poweron-promisesblendid)\n- [sblendid.startScanning](#startscanninglistener-peripherallistener-void)\n- [Peripheral](#peripheral)\n\n## Connect to a Peripheral\n\nThere are several ways to find and connect to a peripheral.\nYou can use `Sblendid.connect` and pass either a\n\n- Peripheral `Name`\n- Peripheral `UUID`\n- Peripheral `Address`\n- A `callback function` returning a boolean, or a Promise resolving to a boolean\n\nto it to tell Sblendid which peripheral you want to connect to.\n`Sblendid.connect` will use your criteria to scan your surroundings\nand connect to and return the peripheral once it's found.\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(\"My Peripheral\");\n  const peripheral = await Sblendid.connect(\"3A62F159\");\n  const peripheral = await Sblendid.connect(\"00-14-22-01-23-45\");\n  const peripheral = await Sblendid.connect(peripheral =\u003e\n    peripheral.name.startsWith(\"My\")\n  );\n  const peripheral = await Sblendid.connect(\n    async peripheral =\u003e await checkSomething(peripheral)\n  );\n  await Sblendid.powerOff();\n})();\n```\n\nThe return type of `connect` will be an instance of `Peripheral`. See\n\n- [Sblendid.connect](#static-async-connectcondition-condition-promiseperipheral)\n- [Peripheral](#peripheral)\n\n## Get all Services from a Peripheral\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(\"My Peripheral\");\n  const services = await peripheral.getServices();\n  await Sblendid.powerOff();\n})();\n```\n\nThe return type of `getServices` will be an array of instances of `Peripheral`. See\n\n- [peripheral.getServices]\n- [Service](#service)\n\n## Get all Characteristics from a Service\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(\"My Peripheral\");\n  const service = await peripheral.getService(\"a000\");\n  const characteristics = await service.getCharacteristics();\n  await Sblendid.powerOff();\n})();\n```\n\n## Read a Characteristic\n\n\u003e ##### Read Values\n\u003e\n\u003e Unless you use `converters`, values read will be Buffers\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst batteryServiceUuid = \"180f\";\nconst batteryLevelUuid = \"2a19\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(peripheral =\u003e\n    peripheral.hasService(batteryServiceUuid)\n  );\n\n  const batteryService = await peripheral.getService(batteryServiceUuid);\n  const batteryLevel = await batteryService.read(batteryLevelUuid);\n\n  console.log(\"Battery Level\", batteryLevel.readUInt8(0), \"%\");\n\n  await Sblendid.powerOff();\n})();\n```\n\n## Subscribe to a Characteristic\n\n\u003e ##### Subscribe Values\n\u003e\n\u003e Unless you use `converters`, values you get from a subscription will be Buffers\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst batteryServiceUuid = \"180f\";\nconst batteryLevelUuid = \"2a19\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(peripheral =\u003e\n    peripheral.hasService(batteryServiceUuid)\n  );\n\n  const batteryService = await peripheral.getService(batteryServiceUuid);\n\n  await batteryService.on(batteryLevelUuid, batteryLevel =\u003e {\n    console.log(\"Battery Level\", batteryLevel.readUInt8(0), \"%\");\n  });\n\n  await Sblendid.powerOff();\n})();\n```\n\n## Write to a Characteristic\n\n\u003e ##### Write Values\n\u003e\n\u003e Unless you use `converters`, values you pass to a write operation must be Buffers\n\n```js\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst alertServiceUuid = \"1811\";\nconst newAlertUuid = \"2a44\";\n\n(async () =\u003e {\n  const peripheral = await Sblendid.connect(peripheral =\u003e\n    peripheral.hasService(alertServiceUuid)\n  );\n\n  const alertService = await peripheral.getService(alertServiceUuid);\n  await alertService.write(newAlertUuid, Buffer.from(\"Message\", \"utf8\");\n\n  await Sblendid.powerOff();\n})();\n```\n\n## More examples\n\nYou can find more examples in the Examples folder:\n\n👉 [packages/sblendid/examples](https://github.com/LukasBombach/sblendid/tree/master/packages/sblendid/examples)\n\n\u003e ##### Running Examples\n\u003e\n\u003e You can run any of these examples by cloning this repository, building the library and calling `yarn example`:\n\u003e\n\u003e ```bash\n\u003e git clone git@github.com:LukasBombach/sblendid.git\n\u003e cd sblendid\n\u003e yarn \u0026\u0026 yarn build\n\u003e cd packages/sblendid\n\u003e yarn example examples/\u003cfilename\u003e\n\u003e ```\n\n## API\n\nSblendid has 4 main classes\n\n| Class            | Desciption                                                                                                                                                                                                                                                                                                             |\n| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `Sblendid`       | Lets you find and connect to peripherals                                                                                                                                                                                                                                                                               |\n| `Peripheral`     | Lets you connect to peripherals and read their services and RSSIs                                                                                                                                                                                                                                                      |\n| `Service`        | Lets you read, write and subscribe to updates on values (characteristics) of a service as well as                                                                                                                                                                                                                      | fetching all available characteristics |\n| `Characteristic` | A representation of a single characteristic of a service that lets you read, write and subscribe to updates of a specific value. Usually you will not need to use this class as everything you can do with this on a single characteristic, you can already do with the service class on all available characteristics |\n\n### `Sblendid`\n\n#### API Overview\n\nHere you can see the entire public API of the `Sblendid` class for an overview. You can find\na more detailed description below.\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nclass Sblendid {\n  public adapter: Adapter;\n\n  constructor() {}\n  public static async powerOn(): Promise\u003cSblendid\u003e {}\n  public static async powerOff(): Promise\u003cSblendid\u003e {}\n  public static async connect(condition: Condition): Promise\u003cPeripheral\u003e {}\n  public async powerOn(): Promise\u003cvoid\u003e {}\n  public async powerOff(): Promise\u003cvoid\u003e {}\n  public async find(condition: Condition): Promise\u003cPeripheral\u003e {}\n  public startScanning(listener?: PeripheralListener): void {}\n  public stopScanning(): void {}\n}\n```\n\n#### Properties\n\n- `adapter` - An instance of the low-level Bluetooth adapter\n  that Sblendid uses, right now this will be an instance of\n  `@sblendid/adapter-node`. See [packages/adapter-node](https://github.com/LukasBombach/sblendid/tree/master/packages/adapter-node)\n\n#### `static async powerOn(): Promise\u003cSblendid\u003e`\n\nBefore you can use BLE on your machine you need to turn on\nyour BLE adapter. This static method will turn on the adapter\nand return an instance of sblendid that you can then use to\nfind and connect to peripherals\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst sblendid = await Sblendid.powerOn();\nsblendid.startScanning();\n```\n\n#### `static async powerOff(): Promise\u003cvoid\u003e`\n\nWhen you use BLE you need power on your BLE adapter (Your actual\nhardware). This library will keep the BLE adapter running while\nyour node process runs. When you are done with using BLE you need\nto power off the BLE adapter again.\n\n\u003e If you don't do this, your Node process will keep running after\n\u003e your script is done. I.e. you will see the last line of your\n\u003e code being executed, but your Node script just won't return to\n\u003e your console.\n\u003e\n\u003e Don't worry, if you forgot to call powerOff, you can just press\n\u003e ctrl + c to stop your script and there will be no hard done\n\u003e whatsoever, It can just be very annoying.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst sblendid = await Sblendid.powerOn();\nsblendid.startScanning();\nawait Sblendid.powerOff();\n```\n\n#### `static async connect(condition: Condition): Promise\u003cPeripheral\u003e`\n\nOften times you have a specific peripheral in mind you want to\nconnect to. You would usually\n\n1. turn on your BLE adapter\n1. start scanning\n1. check each peripheral if it is what you are looking for\n1. stop scanning\n1. connect to the peripheral\n\nThere is a shortcut for that. You can call `Sblendid.connect` to do all that.\nPass either a peripheral name, uuid, address or callback function as an argument\nand you will get a connected peripheral as return value once the peripheral has\nbeen found.\n\nThe callback function will receive an instance of a `Peripheral` that represents any\nperipheral found while scanning. The callback function can be sync or async\n(i.e. return a Promise) and must always return aór resolve to a Boolean signaling\nof the given peripheral is the one you were looking for. If true, `Sblendid.connect`\nwill stop scanning, connect to that peripheral and return it.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\n// By Name\nconst peripheral = await Sblendid.connect(\"My Peripheral\");\n\n// By UUID\nconst peripheral = await Sblendid.connect(\"3A62F159\");\n\n// By Address\nconst peripheral = await Sblendid.connect(\"00-14-22-01-23-45\");\n\n// With a callback\nconst peripheral = await Sblendid.connect(periperal =\u003e\n  Boolean(periperal.connectable)\n);\n\n// With an async callback\nconst peripheral = await Sblendid.connect(\n  async periperal =\u003e await isPeripheralIAmLookingFor(periperal)\n);\n```\n\n#### `new Sblendid()` (Constructor)\n\nYou can instantiate Sblendid like any other class. It has no parameters. You will have to\nturn it on before using it though.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst sblendid = new Sblendid();\n```\n\n#### `async powerOn(): Promise\u003cvoid\u003e`\n\nIf you instantiate Sblendid in your own, this method lets you turn on your BLE adapter.\nIt returns a promise that resolves (with no value) when the adater ist powered on.\n\nNote that you can also use `const sblendid = await Sblendid.powerOn();` to achieve the\nsame thing.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst sblendid = new Sblendid();\nawait sblendid.powerOn();\n```\n\n#### `async powerOff(): Promise\u003cvoid\u003e`\n\nThe `powerOff` method is available as a class method as well as an instance method.\nThey do exactly the same thing. It is only there for convencience in sutations where\nyou have an instance but not the class. Please refer to the documentation of\n`Sblendid.powerOff` to read about it.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst sblendid = await Sblendid.powerOn();\nsblendid.startScanning();\nawait sblendid.powerOff();\n```\n\n#### `async find(condition: Condition): Promise\u003cPeripheral\u003e`\n\nWill scan for a peripheral and return it once it's found. Unlike `Sblendid.connect`\n`find` will not automatically connect to the peripheral. `find` will accept the same\nparameters as `Sblendid.connect` to find a a peripheral.\n\nNote that this is an instance method, so you will have to instantiate and turn on\nSblendid first.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst sblendid = await Sblendid.powerOn();\nconst peripheral = await sblendid.find(\"My Peripheral\");\n```\n\n#### `startScanning(listener?: PeripheralListener): void`\n\nWill start scanning for peripherals. Instead of finding a specific peripheral\nand returning it, this method will just scan your surroundings and call a\ncallback for every peripheral it finds. It will do so indefinitely until you\ncall `sblendid.stopScanning()`. This method has no return value and is not\nasynchronous.\n\nThe callback function will receive a single argument which is an instance of\n`Peripheral`.\n\n\u003e Note that when you call `sblendid.startScanning` multiple times with different\n\u003e listeners only the last listener will be used and all others will be discarded.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nfunction listener(peripheral) {\n  console.log(\"Found peripheral with uuid\", peripheral.uuid);\n}\n\nconst sblendid = await Sblendid.powerOn();\nsblendid.startScanning(listener);\n```\n\n#### `stopScanning(): void`\n\nWill tell sblendid to stop scanning. The listener you may have provided in\n`sblendid.startScanning` will be discarded and not be called anymore.\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nfunction listener(peripheral) {\n  console.log(\"Found peripheral with uuid\", peripheral.uuid);\n}\n\nconst sblendid = await Sblendid.powerOn();\nsblendid.startScanning(listener);\n\nawait new Promise(resolve =\u003e setTimeout(resolve, 1000));\n\nsblendid.stopScanning();\n```\n\n### `Peripheral`\n\n#### API Overview\n\nHere you can see the entire public API of the `Peripheral` class for an overview. You can find\na more detailed description below.\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nclass Peripheral {\n  public uuid: PUUID;\n  public adapter: Adapter;\n  public name: string;\n  public address: string;\n  public addressType: AddressType;\n  public advertisement: Advertisement;\n  public connectable?: boolean;\n  public state: State;\n\n  constructor(uuid: PUUID, adapter: Adapter, options: Options) {}\n  public async connect(): Promise\u003cvoid\u003e {}\n  public async disconnect(): Promise\u003cvoid\u003e {}\n  public async getService(uuid: SUUID, converters?: Converters): Promise\u003cService\u003cConverters\u003e | undefined\u003e {}\n  public async getServices(serviceConverters?: ServiceConverters): Promise\u003cService\u003cany\u003e[]\u003e {}\n  public async hasService(uuid: SUUID): Promise\u003cboolean\u003e {}\n  public async getRssi(): Promise\u003cnumber\u003e {}\n  public isConnected(): boolean {}\n}\n```\n\n#### Properties\n\n- `uuid` - The UUID of the peripheral\n- `adapter` - An instance of the low-level Bluetooth adapter\n  that Sblendid uses, right now this will be an instance of\n  `@sblendid/adapter-node`. See [packages/adapter-node](https://github.com/LukasBombach/sblendid/tree/master/packages/adapter-node)\n- `name` - The `localName` of the peripheral. This\n  is the same as `peripheral.advertisement.localName` and will\n  be an empty string if localName on the advertisement is\n  not available\n- `address` - The address of the peripheral\n- `addressType` - The address type of the peripheral, can\n  either be `public`, `random` or `unknown`\n- `advertisement` - An object with the advertisement information of a peripheral. See [packages/adapter-node/src/peripheral.ts](https://github.com/LukasBombach/sblendid/blob/2c4de5914cb3372aca6eb80d686c903e3d1c27bc/packages/adapter-node/src/peripheral.ts#L10-L16)\n- `connectable` - Whether or not the peripheral can be connected to. _Important_ This is\n  an info the peripheral advertises itself with. Sometimes, even thought it says it's not\n  connectable, it actually is.\n- `state` - The connection state of the peripheral, can either be `connecting`, `connected`, `disconnecting` or `disconnected`\n\n#### `new Peripheral(uuid: PUUID, adapter: Adapter, options: Options)` (Constructor)\n\nCreates a new Peripheral instance\n\n```ts\nimport { Peripheral } from \"@sblendid/sblendid\";\nimport Adapter from \"@sblendid/adapter-node\";\n\nconst options = {\n  address: \"00-14-22-01-23-45\",\n  addressType: \"public\",\n  advertisement: {\n    localName: \"My Peripheral\",\n    txPowerLevel: 10,\n    serviceUUIDs: [\"f055e3\", \"143cba\", \"e72a1e\"],\n    manufacturerData: Buffer.from([]),\n    serviceData: [\n      {\n        uuid: \"43f9d8\",\n        data: Buffer.from([])\n      }\n    ]\n  },\n  connectable: true\n};\n\nconst adapter = new Adapter();\nconst peripheral = new Peripheral(\"3A62F159\", adapter, options);\n```\n\n_However_, you would usually create a Peripheral instance by\ngetting it from the `Sblendid` class using `connect`, `find`\nor `startScanning`\n\n```ts\nimport Sblendid from \"@sblendid/sblendid\";\n\nconst peripheral = Sblendid.connect();\nconst peripheral = new Sblendid().find();\nnew Sblendid().startScanning(peripheral =\u003e {});\n```\n\n\u003e To bring this API documentation close to how most people\n\u003e would use this library I will receive my `Periperal`\n\u003e instance from the `Sblendid` class instead of the constructor\n\u003e in the following examples\n\n### `Service`\n\n#### API Overview\n\nHere you can see the entire public API of the `Service` class for an overview. You can find\na more detailed description below.\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nclass Service {\n  public uuid: SUUID;\n  public peripheral: Peripheral;\n\n  public async read(name: Name): Promise\u003cValue\u003e {}\n  public async write( name: Name, value: Value, withoutResponse?: boolean): Promise\u003cvoid\u003e {}\n  public async on(name: Name, listener: Listener): Promise\u003cvoid\u003e {}\n  public async off(name: Name, listener: Listener): Promise\u003cvoid\u003e {}\n  public async getCharacteristic(name: Name): Promise\u003cCharacteristic\u003e {}\n  public async getCharacteristics(): Promise\u003cCharacteristic[]\u003e {}\n}\n```\n\n### `Characteristic`\n\n#### API Overview\n\nHere you can see the entire public API of the `Characteristic` class for an overview. You can find\na more detailed description below.\n\n\u003c!-- prettier-ignore --\u003e\n```ts\nclass Characteristic {\n  public uuid: CUUID;\n  public service: Service;\n  public properties: Properties;\n\n  public async read(): Promise\u003cValue\u003e {}\n  public async write(value: Value, withoutResponse?: boolean): Promise\u003cvoid\u003e {}\n  public async on(event: \"notify\", listener: Listener): Promise\u003cvoid\u003e {}\n  public async off(event: \"notify\", listener: Listener): Promise\u003cvoid\u003e {}\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasbombach%2Fsblendid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasbombach%2Fsblendid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasbombach%2Fsblendid/lists"}