{"_id":"@bintangf/capacitor-bluetooth-serial","_rev":"1-8ac79fbeca31ff84212b2205e0b95add","name":"@bintangf/capacitor-bluetooth-serial","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@bintangf/capacitor-bluetooth-serial","version":"2.0.0","keywords":["capacitor","plugin","native"],"author":{"name":"SpeedEngineering GmbH"},"license":"MIT","_id":"@bintangf/capacitor-bluetooth-serial@2.0.0","maintainers":[{"name":"bintangf","email":"bintangfadjrulfallah@gmail.com"}],"contributors":[{"name":"SpeedEngineering GmbH"},{"url":"https://github.com/agro1desenvolvimento/capacitor-bluetooth-serial","name":"Agro1 Desenvolvimento de Sistemas"},{"name":"Gerson Groth"}],"homepage":"https://github.com/speedengineering/capacitor-bluetooth-serial#readme","bugs":{"url":"https://github.com/speedengineering/capacitor-bluetooth-serial/issues"},"dist":{"shasum":"146bc1a22e9885538b41e2145ee675bfdcc10d49","tarball":"https://registry.npmjs.org/@bintangf/capacitor-bluetooth-serial/-/capacitor-bluetooth-serial-2.0.0.tgz","fileCount":31,"integrity":"sha512-BSE3emcAfS90igRWOYvU+roaXKJSzZClkvipMl4CPGu1Cbm+raub0c2J2MyvGPc/H+WpAVyNIgIYng12Q4z2dw==","signatures":[{"sig":"MEUCIQCuRCB0U8wc80ko6L6EAJZ8x5r8Uu1Slsx1D7I8XsXG5gIgahehbrckTTQ01ovIB39MAxnTSn+wZeQg4+AUeIS4/6o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":109391},"main":"dist/plugin.cjs.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","module":"dist/esm/index.js","authors":["SpeedEngineering GmbH","Gerson Groth","Bintang F."],"gitHead":"af03d6fdf1dabe6d8ea36ea1a74e52c3ed76dc39","scripts":{"fmt":"npm run eslint -- --fix && npm run prettier -- --write","lint":"npm run eslint && npm run prettier -- --check","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","docgen":"docgen --api BluetoothSerialPlugin --output-readme README.md --output-json dist/docs.json","eslint":"eslint . --ext ts","verify":"npm run verify:android && npm run verify:web","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","verify:web":"npm run build","prepublishOnly":"npm run build","verify:android":"cd android && ./gradlew clean build test && cd .."},"_npmUser":{"name":"bintangf","email":"bintangfadjrulfallah@gmail.com"},"prettier":"@ionic/prettier-config","capacitor":{"android":{"src":"android"}},"repository":{"url":"git+https://github.com/speedengineering/capacitor-bluetooth-serial.git","type":"git"},"_npmVersion":"10.8.2","description":"Capacitor Bluetooth Serial Plugin","directories":{},"_nodeVersion":"22.6.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^7.32.0","rimraf":"^5.0.7","rollup":"^4.18.0","prettier":"~3.3.1","typescript":"~5.4.5","@capacitor/core":"^6.0.0","@capacitor/docgen":"^0.2.2","@capacitor/android":"^6.0.0","@ionic/eslint-config":"^0.4.0","@ionic/prettier-config":"^4.0.0"},"peerDependencies":{"@capacitor/core":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/capacitor-bluetooth-serial_2.0.0_1730360303803_0.24781305869781955","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"@bintangf/capacitor-bluetooth-serial","version":"2.0.1","description":"Capacitor Bluetooth Serial Plugin","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","scripts":{"verify":"npm run verify:android && npm run verify:web","verify:android":"cd android && ./gradlew clean build test && cd ..","verify:web":"npm run build","lint":"npm run eslint && npm run prettier -- --check","fmt":"npm run eslint -- --fix && npm run prettier -- --write","eslint":"eslint . --ext ts","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","docgen":"docgen --api BluetoothSerialPlugin --output-readme README.md --output-json dist/docs.json","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","prepublishOnly":"npm run build"},"author":{"name":"SpeedEngineering GmbH"},"authors":["SpeedEngineering GmbH","Gerson Groth","Bintang F."],"license":"MIT","devDependencies":{"@capacitor/android":"^6.0.0","@capacitor/core":"^6.0.0","@capacitor/docgen":"^0.2.2","@ionic/eslint-config":"^0.4.0","@ionic/prettier-config":"^4.0.0","eslint":"^7.32.0","prettier":"~3.3.1","rimraf":"^5.0.7","rollup":"^4.18.0","typescript":"~5.4.5"},"peerDependencies":{"@capacitor/core":"^6.0.0"},"prettier":"@ionic/prettier-config","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"android":{"src":"android"}},"keywords":["capacitor","plugin","native"],"repository":{"type":"git","url":"git+https://github.com/speedengineering/capacitor-bluetooth-serial.git"},"bugs":{"url":"https://github.com/speedengineering/capacitor-bluetooth-serial/issues"},"_id":"@bintangf/capacitor-bluetooth-serial@2.0.1","contributors":[{"name":"SpeedEngineering GmbH"},{"name":"Agro1 Desenvolvimento de Sistemas","url":"https://github.com/agro1desenvolvimento/capacitor-bluetooth-serial"},{"name":"Gerson Groth"}],"gitHead":"8c9f3ce1cc305d2c698effa7c69883a644114031","homepage":"https://github.com/speedengineering/capacitor-bluetooth-serial#readme","_nodeVersion":"22.6.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-bWbAwCIhcj5EymimJiuEI5Qiqd2MKo/S4xj1DcQoevfIynvdSAX5TphgIyswsu6O0N8kCo9Tk8+OC6MWRXAm3Q==","shasum":"9605372d9f8f05bcf1fa755f6db0ef16d97049b6","tarball":"https://registry.npmjs.org/@bintangf/capacitor-bluetooth-serial/-/capacitor-bluetooth-serial-2.0.1.tgz","fileCount":31,"unpackedSize":109389,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEN9TAvjMNWwn5YipL6xpE7i6wd01cpTFhRgN8z72zsFAiEAxyJV8PFcm+p8TCX1syejuxVqo2cV7Q1gkw6KIblHXJU="}]},"_npmUser":{"name":"bintangf","email":"bintangfadjrulfallah@gmail.com"},"directories":{},"maintainers":[{"name":"bintangf","email":"bintangfadjrulfallah@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/capacitor-bluetooth-serial_2.0.1_1730362257809_0.6669834974679518"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-31T07:38:23.699Z","modified":"2024-10-31T08:10:58.215Z","2.0.0":"2024-10-31T07:38:24.054Z","2.0.1":"2024-10-31T08:10:58.037Z"},"bugs":{"url":"https://github.com/speedengineering/capacitor-bluetooth-serial/issues"},"author":{"name":"SpeedEngineering GmbH"},"license":"MIT","homepage":"https://github.com/speedengineering/capacitor-bluetooth-serial#readme","keywords":["capacitor","plugin","native"],"repository":{"type":"git","url":"git+https://github.com/speedengineering/capacitor-bluetooth-serial.git"},"description":"Capacitor Bluetooth Serial Plugin","contributors":[{"name":"SpeedEngineering GmbH"},{"name":"Agro1 Desenvolvimento de Sistemas","url":"https://github.com/agro1desenvolvimento/capacitor-bluetooth-serial"},{"name":"Gerson Groth"}],"maintainers":[{"name":"bintangf","email":"bintangfadjrulfallah@gmail.com"}],"readme":"# Capacitor Bluetooth Serial Plugin\n\nA client implementation for interacting with classic Bluetooth SPP devices\n\n**Supported platforms**\n\n- [ ] Web\n- [x] Android\n- [ ] iOS\n\n**Capacitor 4 ONLY for now!**\n\n## Todo\n\n- Update documentation\n- Provide examples\n- Add iOS support\n- Refactor and clean up some code\n- Update to Capacitor 5\n\n## Usage\n\nTODO\n\n### Install\n\nTODO\n\n## API Documentation\n\nInterface and type definitions can be found [here](./src/definitions.ts).\n\n### Methods\n\n**TODO: Update to current**\n\n- [BluetoothSerial.isEnabled](#isEnabled)\n- [BluetoothSerial.enable](#enable)\n- [BluetoothSerial.scan](#scan)\n- [BluetoothSerial.connect](#connect)\n- [BluetoothSerial.connectInsecure](#connectInsecure)\n- [BluetoothSerial.disconnect](#disconnect)\n- [BluetoothSerial.isConnected](#isConnected)\n- [BluetoothSerial.read](#read)\n- [BluetoothSerial.readUntil](#readUntil)\n- [BluetoothSerial.enableNotifications](#enableNotifications)\n- [BluetoothSerial.disableNotifications](#disableNotifications)\n- [BluetoothSerial.enableRawNotifications](#enableRawNotifications)\n- [BluetoothSerial.disableRawNotifications](#disableRawNotifications)\n- [BluetoothSerial.write](#write)\n- [BluetoothSerial.getPairedDevices](#getPairedDevices)\n\n## isEnabled\n\nReports if bluetooth is enabled.\n\n  `isEnabled(): Promise<BluetoothEnabledResult>;`\n\n### Description\n\nFunction `isEnabled` calls the success whatever bluetooth is enabled or not. The promise will contain an attribute `enabled` indicating if bluetooth is enabled or *not* enabled. The failure callback will be called only if an error occurs.\n\nIf you want to enable bluetooth afterwards, you can use #enable directly, once #enable also check if the bluetooth is conected or not.\n\n### Parameters\n\nNone.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .isEnabled()\n  .then((response: BluetoothEnabledResult) => {\n    const message = response.enabled ? 'enabled' : 'disabled';\n    console.log(`Bluetooth is ${message}`);\n  })\n  .catch(() => {\n    console.log('Error checking bluetooth status');\n  });\n```\n\n## enable\n\n  Enable bluetooth if it is not enabled. Also request permissions for bluetooth access if it is necessary.\n\n  `enable(): Promise<BluetoothEnabledResult>;`\n\n### Description\n\nFunction `enable` calls the success whatever bluetooth is successfully enabled or not. The promise will contain an attribute `enabled` indicating if bluetooth is enabled or *not* enabled after the process. The failure callback will be called only if an error occurs.\n\nIf the app does not have permission to use bluetooth, it will request it.\n\n### Parameters\n\nNone.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .enable()\n  .then((response: BluetoothEnabledResult) => {\n    const message = response.enabled ? 'enabled' : 'disabled';\n    console.log(`Bluetooth is ${message}`);\n  })\n  .catch(() => {\n    console.log('Error enabling bluetooth');\n  });\n```\n\n## scan\n\nDiscover devices visible and close to the device\n\n  `scan(): Promise<BluetoothScanResult>;`\n\n### Description\n\n#### Android\n\nFunction `scan` discovers Bluetooth devices close to the device and visible. The success callback is called with a list of objects similar to `list`, or an empty list if no devices are found.\n\nExample list passed to success callback.\n\n```json\n[{\n    \"class\": 0,\n    \"id\": \"00:11:22:33:44:55\",\n    \"address\": \"00:11:22:33:44:55\",\n    \"name\": \"Device 1\"\n}, {\n    \"class\": 7936,\n    \"id\": \"01:23:6645:4D67:89:00\",\n    \"address\": \"01:23:6645:4D67:89:00\",\n    \"name\": \"Device 2\"\n}]\n```\n\nThe discovery process takes a while to happen.\nYou may want to show a progress indicator while waiting for the discover proces to finish, and the sucess callback to be invoked.\n\nCalling `connect` on an unpaired Bluetooth device should begin the Android pairing process.\n\n### Parameters\n\nNone.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .scan()\n  .then((result: BluetoothScanResult) => {\n    result.devices.forEach((device: BluetoothDevice) {\n        console.log(device.id);\n    });\n  })\n  .catch(() => {\n    console.log('Error scanning devices');\n  });\n```\n\n## connect\n\nConnect to a Bluetooth device.\n\n  `connect(options: BluetoothConnectOptions): Promise<void>`;\n\n### Description\n\nFunction `connect` connects to a Bluetooth device.  The callback Success will be called when the connection is successful.  Failure is called if the connection fails.\n\n#### Android\n\nFor Android, `connect` takes a MAC address of the remote device.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .connect({\n    address: '00:11:22:33:44:55',\n  })\n  .then(() => {\n    console.log('Successfully connected')\n  })\n  .catch(() => {\n    console.log('Error connecting...');\n  });\n```\n\n## connectInsecure\n\nConnect insecurely to a Bluetooth device.\n\n  `connectInsecure(options: BluetoothConnectOptions): Promise<void>`;\n\n### Description\n\nFunction `connectInsecure` connects to a Bluetooth device.  The callback Success will be called when the connection is successful.  Failure is called if the connection fails.\nFunction `connectInsecure` works like [BluetoothSerial.connect](#connect), but creates an insecure connection to a Bluetooth device. See the [Android docs](https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createInsecureRfcommSocketToServiceRecord(java.util.UUID)) for more information.\n\n#### Android\n\nFor Android, `connectInsecure` takes a MAC address of the remote device.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .connectInsecure({\n    address: '00:11:22:33:44:55',\n  })\n  .then(() => {\n    console.log('Successfully connected')\n  })\n  .catch(() => {\n    console.log('Error connecting...');\n  });\n```\n\n## disconnect\n\nDisconnect a Bluetooth device.\n\n  `disconnect(options: BluetoothConnectOptions): Promise<void>`;\n\n### Description\n\nFunction `disconnect` disconnects a Bluetooth device.  The callback Success will be called when the disconnection is successful.  Failure is called if the disconnection fails.\n\n#### Android\n\nFor Android, `disconnect` takes a MAC address of the remote device.\n\n__Warning__: If no address is passed, all devices will be disconnected.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .disconnect({\n    address: '00:11:22:33:44:55',\n  })\n  .then(() => {\n    console.log('Successfully disconnected')\n  })\n  .catch(() => {\n    console.log('Error disconnecting...');\n  });\n```\n\n## isConnected\n\nReports the connection status.\n\n  `isConnected(options: BluetoothConnectOptions): Promise<BluetoothConnectResult>`;\n\n### Description\n\nFunction `isConnected` calls the success callback with the connection status (connected or not connected). Failure will be called only if an error occurs.\n\n#### Android\n\nFor Android, `isConnected` takes a MAC address of the remote device.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .isConnected({\n    address: '00:11:22:33:44:55',\n  })\n  .then((result: BluetoothConnectResult) => {\n    const status = result.connected ? 'connected' : 'disconnected';\n    console.log(`Device is ${status}`);\n  })\n  .catch(() => {\n    console.log('Error checking connection status');\n  });\n```\n\n## read\n\nReads data from the buffer.\n\n  `read(options: BluetoothReadOptions): Promise<BluetoothDataResult>`;\n\n### Description\n\nFunction `read` reads the data from the buffer. The data is passed to the success callback as a String.  Calling `read` when no data is available will pass an empty String to the callback.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .read({\n    address: '00:11:22:33:44:55',\n  })\n  .then((result: BluetoothDataResult) => {\n    console.log(result.data);\n  })\n  .catch(() => {\n    console.log('Error reading data from device');\n  });\n```\n\n## readUntil\n\nReads data from the buffer until it reaches a delimiter.\n\n  `readUntil(options: BluetoothReadUntilOptions): Promise<BluetoothDataResult>`;\n\n### Description\n\nFunction `readUntil` reads the data from the buffer until it reaches a delimiter.  The data is passed to the success callback as a String.  If the buffer does not contain the delimiter, an empty String is passed to the callback.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n- { __delimiter__ }: Delimiter.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .readUntil({\n    address: '00:11:22:33:44:55',\n    delimiter: '\\n',\n  })\n  .then((result: BluetoothDataResult) => {\n    console.log(result.data);\n  })\n  .catch(() => {\n    console.log('Error reading data from device');\n  });\n```\n\n## enableNotifications\n\nEnable and be notified when any data is received.\n\n  `enableNotifications(options: BluetoothEnableNotificationsOptions): Promise<BluetoothEnableNotificationsResult>`;\n\n### Description\n\nFunction `enableNotifications` enable notifications. The success callback will return an event name. In order to retrieve the values, one has to use an Event Listener with the returned event name.\n\n``` typescript\nconst listener = BluetoothSerial.addListener( eventName , (data: BluetoothDataResult) => {\n\n    const { value } = data.data;\n    //Do something with the data\nq\n});\n```\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n- { __delimiter__ }: Delimiter for notification.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .enableNotifications({\n    address: '00:11:22:33:44:55',\n    delimiter: '\\n',\n  })\n  .then((result: BluetoothEnableNotificationsResult) => {\n    event = BluetoothSerial.addListener(result.eventName, (data: BluetoothDataResult) => {\n        console.log(data.data);\n      });\n  })\n  .catch(() => {\n    console.log('Error enabling listener for device');\n  });\n```\n\n## disableNotifications\n\nStops the propagation of value changes.\n\n  `disableNotifications(options: BluetoothDisableNotificationsOptions): Promise<void>`;\n\n### Description\n\nFunction `disableNotifications` disable notifications. Additionally, the event listener has to be removed.\n\n```typescript\nlistener.remove();\n```\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .disableNotifications({\n    address: '00:11:22:33:44:55',\n  })\n  .then(() => {\n    event.remove();\n  })\n  .catch(() => {\n    console.log('Error disabling listener for device');\n  });\n```\n\n## enableRawNotifications\n\n  Under development.\n\n## disableRawNotifications\n\n  Under development.\n\n## write\n\nWrite data to the buffer.\n\n  `write(options: BluetoothWriteOptions): Promise<void>`;\n\n### Description\n\nFunction `write` writes data to the buffer.\n\n### Parameters\n\n- { __address__ }: Identifier of the remote device.\n- { __value__ }: String to send.\n- { __charset__ }: Charset of the string (Optional, default: UTF-8).\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .write({\n    address: '00:11:22:33:44:55',\n    value: 'Hello world',\n  })\n  .then(() => {\n    console.log('Value sent to device');\n  })\n  .catch(() => {\n    console.log('Error writing data to device');\n  });\n```\n## getPairedDevices\n\nGet a list of paired devices.\n\n  `getPairedDevices(): Promise<PairedDevicesResult>;`\n\n### Description\n\n#### Android\n\nFunction `getPairedDevices` shows all paired devices. The success callback is called with a list of objects similar to `list`, or an empty list if no devices are found.\n\nExample list passed to success callback.\n\n```json\n[{\n    \"class\": 0,\n    \"id\": \"00:11:22:33:44:55\",\n    \"address\": \"00:11:22:33:44:55\",\n    \"name\": \"Device 1\"\n}, {\n    \"class\": 7936,\n    \"id\": \"01:23:6645:4D67:89:00\",\n    \"address\": \"01:23:6645:4D67:89:00\",\n    \"name\": \"Device 2\"\n}]\n```\n\n### Parameters\n\nNone.\n\n### Quick Example\n\n```typescript\nBluetoothSerial\n  .getPairedDevices()\n  .then((result: PairedDevicesResult) => {\n    result.devices.forEach((device: BluetoothDevice) {\n        console.log(device.id);\n    });\n  })\n  .catch(() => {\n    console.log('Error getting devices');\n  });\n```\n","readmeFilename":"README.md"}