Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09ac478ae3 | ||
|
|
c72613bd76 | ||
|
|
6f9ac2f9e3 | ||
|
|
c5904331d3 | ||
|
|
1754b6a812 | ||
|
|
3354416f6b | ||
|
|
a1efac9fd1 | ||
|
|
0359652b9c | ||
|
|
8c9bc8b53c | ||
|
|
eab4ea5567 | ||
|
|
d0843a9518 | ||
|
|
f40b309886 | ||
|
|
830a2e908a | ||
|
|
e77cb835eb | ||
|
|
bb116775c4 | ||
|
|
424c0f7049 | ||
|
|
8bdb1fcd27 | ||
|
|
6e1eb9b9a5 | ||
|
|
bc3ac09f0c | ||
|
|
df87a5e811 | ||
|
|
62e1a286a7 | ||
|
|
43ad1645b2 | ||
|
|
da50a0f466 |
No files matched your search
@@ -41,6 +41,20 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Unduh pnpm
|
||||||
|
uses: pnpm/setup@v2
|
||||||
|
with:
|
||||||
|
version: 11
|
||||||
|
|
||||||
|
- name: Penerbitan paket NPM
|
||||||
|
run: |
|
||||||
|
pnpm i
|
||||||
|
npm config set @${{ needs.persiapan.outputs.organisasi }}:registry=https://${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/
|
||||||
|
npm config set -- '//${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/:_authToken' "${{ secrets.KUNCI_PENERBITAN }}"
|
||||||
|
npm run prepublishOnly
|
||||||
|
npm publish
|
||||||
|
rm -rf pnpm-lock.yaml .pnpm-store/
|
||||||
|
|
||||||
- name: Unduh Rust
|
- name: Unduh Rust
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
@@ -52,16 +66,3 @@ jobs:
|
|||||||
cargo publish
|
cargo publish
|
||||||
env:
|
env:
|
||||||
CARGO_REGISTRIES_GITEA_TOKEN: Bearer ${{ secrets.KUNCI_PENERBITAN }}
|
CARGO_REGISTRIES_GITEA_TOKEN: Bearer ${{ secrets.KUNCI_PENERBITAN }}
|
||||||
|
|
||||||
- name: Unduh pnpm
|
|
||||||
uses: pnpm/setup@v2
|
|
||||||
with:
|
|
||||||
version: 11
|
|
||||||
|
|
||||||
- name: Penerbitan paket NPM
|
|
||||||
run: |
|
|
||||||
pnpm i
|
|
||||||
npm config set @${{ needs.persiapan.outputs.organisasi }}:registry=https://${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/
|
|
||||||
npm config set -- '//${{ vars.ALAMAT_GITEA }}/api/packages/${{ needs.persiapan.outputs.organisasi }}/npm/:_authToken' "${{ secrets.KUNCI_PENERBITAN }}"
|
|
||||||
npm publish
|
|
||||||
rm -rf pnpm-lock.yaml .pnpm-store/
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tauri-plugin-bluclas"
|
name = "tauri-plugin-bluclas"
|
||||||
version = "0.1.23"
|
version = "0.1.19"
|
||||||
authors = [ "Rizky Denianto" ]
|
authors = [ "Rizky Denianto" ]
|
||||||
description = "Program sederhana untuk interaksi dengan bluetooth classic"
|
description = "Program sederhana untuk interaksi dengan bluetooth classic"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
@@ -28,7 +28,7 @@ ios = { level = "none" }
|
|||||||
tauri = { version = "2.11.5" }
|
tauri = { version = "2.11.5" }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
serialport = "4.10.1"
|
serialport = "4.10.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-plugin = { version = "2.6.3", features = ["build"] }
|
tauri-plugin = { version = "2.6.3", features = ["build"] }
|
||||||
@@ -37,11 +37,11 @@ class KirimArgs {
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
||||||
private val uuid: UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB")
|
private val uuidSpp: UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB")
|
||||||
|
|
||||||
private val bluetoothAdapter: BluetoothAdapter? = this.activity.getSystemService(BluetoothManager::class.java).getAdapter()
|
private val adapter: BluetoothAdapter? = this.activity.getSystemService(BluetoothManager::class.java).getAdapter()
|
||||||
private var bluetoothSocket: BluetoothSocket? = null
|
private var soket: BluetoothSocket? = null
|
||||||
private var outputStream: OutputStream? = null
|
private var keluaran: OutputStream? = null
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
override fun checkPermissions(invoke: Invoke) {
|
override fun checkPermissions(invoke: Invoke) {
|
||||||
@@ -55,13 +55,13 @@ class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
|||||||
|
|
||||||
@Command
|
@Command
|
||||||
fun daftarPerangkat(invoke: Invoke) {
|
fun daftarPerangkat(invoke: Invoke) {
|
||||||
if (bluetoothAdapter == null) {
|
if (adapter == null) {
|
||||||
invoke.reject("Bluetooth tidak didukung")
|
invoke.reject("Bluetooth tidak didukung")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val daftarRes = JSArray()
|
val daftarRes = JSArray()
|
||||||
bluetoothAdapter.bondedDevices.map { i ->
|
adapter.bondedDevices.map { i ->
|
||||||
val res = JSObject()
|
val res = JSObject()
|
||||||
res.put("nama", i.name ?: "Unknown")
|
res.put("nama", i.name ?: "Unknown")
|
||||||
res.put("alamat", i.address)
|
res.put("alamat", i.address)
|
||||||
@@ -74,17 +74,17 @@ class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun menghubungkanKoneksi(alamat: String) {
|
fun menghubungkanKoneksi(alamat: String) {
|
||||||
val bluetoothDevice: BluetoothDevice = bluetoothAdapter!!.getRemoteDevice(alamat)
|
val perangkat: BluetoothDevice = adapter!!.getRemoteDevice(alamat)
|
||||||
bluetoothSocket = bluetoothDevice.createInsecureRfcommSocketToServiceRecord(uuid)
|
soket = perangkat.createInsecureRfcommSocketToServiceRecord(uuidSpp)
|
||||||
bluetoothSocket!!.connect()
|
soket!!.connect()
|
||||||
outputStream = bluetoothSocket!!.outputStream
|
keluaran = soket!!.outputStream
|
||||||
}
|
}
|
||||||
|
|
||||||
fun memutusKoneksi() {
|
fun memutusKoneksi() {
|
||||||
outputStream?.close()
|
keluaran?.close()
|
||||||
outputStream = null
|
keluaran = null
|
||||||
bluetoothSocket?.close()
|
soket?.close()
|
||||||
bluetoothSocket = null
|
soket = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@@ -99,12 +99,12 @@ class BluclasPlugin(private val activity: Activity) : Plugin(activity) {
|
|||||||
try {
|
try {
|
||||||
menghubungkanKoneksi(alamat)
|
menghubungkanKoneksi(alamat)
|
||||||
|
|
||||||
if (outputStream == null) {
|
if (keluaran == null) {
|
||||||
throw Exception("Tidak ada perangkat yang terhubung")
|
throw Exception("Tidak ada perangkat yang terhubung")
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream!!.write(args.data)
|
keluaran!!.write(args.data)
|
||||||
outputStream!!.flush()
|
keluaran!!.flush()
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
memutusKoneksi()
|
memutusKoneksi()
|
||||||
|
|||||||
+1
-18
@@ -1,21 +1,4 @@
|
|||||||
import {
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
checkPermissions as checkPermissions_,
|
|
||||||
invoke,
|
|
||||||
PermissionState,
|
|
||||||
requestPermissions as requestPermissions_,
|
|
||||||
} from "@tauri-apps/api/core";
|
|
||||||
|
|
||||||
export async function checkPermissions(): Promise<PermissionState> {
|
|
||||||
return await checkPermissions_<{ bluetooth: PermissionState }>(
|
|
||||||
"bluclas",
|
|
||||||
).then((e) => e.bluetooth);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function requestPermissions(): Promise<PermissionState> {
|
|
||||||
return await requestPermissions_<{ bluetooth: PermissionState }>(
|
|
||||||
"bluclas",
|
|
||||||
).then((e) => e.bluetooth);
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SDaftarPerangkatBlueclasResponDaftarPerangkat = {
|
export type SDaftarPerangkatBlueclasResponDaftarPerangkat = {
|
||||||
nama: string;
|
nama: string;
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@segubi/tauri-plugin-bluclas-api",
|
"name": "@segubi/tauri-plugin-bluclas-api",
|
||||||
"version": "0.1.23",
|
"version": "0.1.19",
|
||||||
"author": "Rizky Denianto",
|
"author": "Rizky Denianto",
|
||||||
"description": "Program sederhana untuk interaksi dengan bluetooth classic",
|
"description": "Program sederhana untuk interaksi dengan bluetooth classic",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-typescript": "^12.3.0",
|
"@rollup/plugin-typescript": "^12.3.0",
|
||||||
"rollup": "^4.63.2",
|
"rollup": "^4.63.1",
|
||||||
"typescript": "^6.0.3",
|
"typescript": "^6.0.3",
|
||||||
"tslib": "^2.8.1"
|
"tslib": "^2.8.1"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -20,8 +20,7 @@ export default {
|
|||||||
plugins: [
|
plugins: [
|
||||||
typescript({
|
typescript({
|
||||||
declaration: true,
|
declaration: true,
|
||||||
declarationDir: dirname(pkg.exports.import),
|
declarationDir: dirname(pkg.exports.import)
|
||||||
rootDir: 'guest-js'
|
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
external: [
|
external: [
|
||||||
|
|||||||
Reference in new issue
Block a user