From af1b0e6d8239072be410c9665a5e6acd490580c6 Mon Sep 17 00:00:00 2001 From: sukhman Date: Fri, 30 Aug 2024 19:12:47 +0530 Subject: [PATCH] refactor: clean android code and added docs string in kotlin ble_module. --- docs/qaul/commit-guidelines.md | 2 +- .../src/main/java/net/qaul/ble/AppLog.kt | 2 +- .../src/main/java/net/qaul/ble/BLEUtils.kt | 2 +- .../main/java/net/qaul/ble/DateTimeHelper.kt | 2 +- .../src/main/java/net/qaul/ble/RemoteLog.kt | 2 +- .../qaul/ble/callback/BleRequestCallback.kt | 2 +- .../main/java/net/qaul/ble/core/BleActor.kt | 85 +++++-------- .../java/net/qaul/ble/core/BleWrapperClass.kt | 75 +----------- .../main/java/net/qaul/ble/model/BLEDevice.kt | 2 +- .../java/net/qaul/ble/model/BLEScanDevice.kt | 2 +- .../main/java/net/qaul/ble/model/Message.kt | 3 + .../java/net/qaul/ble/service/BleService.kt | 114 ++++++------------ .../src/main/java/net/qaul/libqaul/libqaul.kt | 3 + .../qaul_rpc/lib/src/libqaul/channel.dart | 5 +- .../qaul_rpc/lib/src/libqaul/ffi.dart | 7 +- .../qaul_rpc/lib/src/libqaul/libqaul.dart | 2 +- rust/ble_module/src/ble/ble_service.rs | 3 + rust/ble_module/src/ble/ble_uuids.rs | 4 + rust/ble_module/src/ble/mod.rs | 3 + rust/ble_module/src/ble/utils.rs | 3 + rust/ble_module/src/rpc/msg_loop.rs | 3 + rust/ble_module/src/rpc/utils.rs | 3 + rust/clients/cli/src/ble.rs | 2 +- rust/clients/cli/src/chat.rs | 2 +- rust/clients/cli/src/chatfile.rs | 2 +- rust/clients/cli/src/cli.rs | 2 +- rust/clients/cli/src/connections.rs | 2 +- rust/clients/cli/src/debug.rs | 2 +- rust/clients/cli/src/dtn.rs | 2 +- rust/clients/cli/src/feed.rs | 2 +- rust/clients/cli/src/group.rs | 2 +- rust/clients/cli/src/main.rs | 2 +- rust/clients/cli/src/node.rs | 2 +- rust/clients/cli/src/router.rs | 2 +- rust/clients/cli/src/rpc.rs | 2 +- rust/clients/cli/src/rtc.rs | 2 +- rust/clients/cli/src/user_accounts.rs | 2 +- rust/clients/cli/src/users.rs | 2 +- rust/clients/qauld/src/main.rs | 2 +- rust/libp2p_modules/qaul_info/src/lib.rs | 2 +- rust/libp2p_modules/qaul_info/src/protocol.rs | 2 +- rust/libp2p_modules/qaul_info/src/types.rs | 2 +- rust/libp2p_modules/qaul_messaging/src/lib.rs | 2 +- .../qaul_messaging/src/protocol.rs | 2 +- .../qaul_messaging/src/types.rs | 2 +- rust/libqaul/build.rs | 2 +- rust/libqaul/src/api/android.rs | 2 +- rust/libqaul/src/api/c.rs | 2 +- rust/libqaul/src/api/mod.rs | 4 +- rust/libqaul/src/connections/ble/mod.rs | 42 +++---- rust/libqaul/src/connections/events.rs | 2 +- rust/libqaul/src/connections/internet.rs | 2 +- rust/libqaul/src/connections/lan.rs | 2 +- rust/libqaul/src/connections/mod.rs | 4 +- rust/libqaul/src/lib.rs | 2 +- rust/libqaul/src/node/mod.rs | 2 +- rust/libqaul/src/node/user_accounts.rs | 2 +- rust/libqaul/src/router/connections.rs | 2 +- rust/libqaul/src/router/feed_requester.rs | 2 +- rust/libqaul/src/router/flooder.rs | 2 +- rust/libqaul/src/router/info.rs | 2 +- rust/libqaul/src/router/mod.rs | 2 +- rust/libqaul/src/router/neighbours.rs | 2 +- rust/libqaul/src/router/table.rs | 2 +- rust/libqaul/src/router/user_requester.rs | 2 +- rust/libqaul/src/router/users.rs | 2 +- rust/libqaul/src/rpc/debug.rs | 2 +- rust/libqaul/src/rpc/mod.rs | 2 +- rust/libqaul/src/rpc/sys.rs | 2 +- rust/libqaul/src/services/chat/message.rs | 2 +- rust/libqaul/src/services/chat/mod.rs | 2 +- rust/libqaul/src/services/chat/storage.rs | 2 +- .../src/services/crypto/crypto25519.rs | 2 +- rust/libqaul/src/services/crypto/mod.rs | 2 +- rust/libqaul/src/services/crypto/noise.rs | 2 +- .../src/services/crypto/sessionmanager.rs | 2 +- rust/libqaul/src/services/crypto/storage.rs | 2 +- rust/libqaul/src/services/dtn/mod.rs | 2 +- rust/libqaul/src/services/feed/mod.rs | 2 +- rust/libqaul/src/services/group/group_id.rs | 2 +- rust/libqaul/src/services/messaging/mod.rs | 2 +- .../libqaul/src/services/messaging/process.rs | 2 +- .../src/services/messaging/retransmit.rs | 2 +- rust/libqaul/src/services/mod.rs | 2 +- rust/libqaul/src/storage/configuration.rs | 2 +- rust/libqaul/src/storage/database.rs | 2 +- rust/libqaul/src/storage/mod.rs | 2 +- rust/libqaul/src/utilities/mod.rs | 2 +- rust/libqaul/src/utilities/qaul_id.rs | 2 +- rust/libqaul/src/utilities/timestamp.rs | 2 +- rust/libqaul/src/utilities/upgrade/backup.rs | 2 +- rust/libqaul/src/utilities/upgrade/mod.rs | 2 +- .../utilities/upgrade/v2_0_0_beta_15/mod.rs | 2 +- .../upgrade/v2_0_0_beta_15/old_config.rs | 2 +- .../utilities/upgrade/v2_0_0_beta_17/mod.rs | 2 +- .../utilities/upgrade/v2_0_0_beta_18/mod.rs | 2 +- .../utilities/upgrade/v2_0_0_beta_9/mod.rs | 2 +- .../upgrade/v2_0_0_beta_9/old_config.rs | 2 +- 98 files changed, 203 insertions(+), 322 deletions(-) diff --git a/docs/qaul/commit-guidelines.md b/docs/qaul/commit-guidelines.md index aa9715ac3..912406c78 100644 --- a/docs/qaul/commit-guidelines.md +++ b/docs/qaul/commit-guidelines.md @@ -50,6 +50,6 @@ For automated code documentation generation, use triple slashes `///` line comme Each code file needs to start with the qaul license: ```rs -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. ``` diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/AppLog.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/AppLog.kt index 3716942b4..1ba33d9bf 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/AppLog.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/AppLog.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/BLEUtils.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/BLEUtils.kt index 74e88ea8e..c98ddeda1 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/BLEUtils.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/BLEUtils.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/DateTimeHelper.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/DateTimeHelper.kt index 8103b3925..887c0506f 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/DateTimeHelper.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/DateTimeHelper.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/RemoteLog.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/RemoteLog.kt index 1fae10509..76485923d 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/RemoteLog.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/RemoteLog.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/callback/BleRequestCallback.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/callback/BleRequestCallback.kt index 5ae6ff7ff..1eb6e7306 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/callback/BleRequestCallback.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/callback/BleRequestCallback.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble.callback diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleActor.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleActor.kt index 4b6099878..9b2e20aba 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleActor.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleActor.kt @@ -1,6 +1,9 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. +/** +* BleActor is an instance of GATT Client which is used to connect to other GATT Servers. +*/ package net.qaul.ble.core import android.annotation.SuppressLint @@ -59,19 +62,12 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene */ fun setDevice(device: BLEScanDevice?, isFromMessage: Boolean) { this.isFromMessage = isFromMessage -// if (mBluetoothGatt != null && !isFromMessage) { bleDevice = device bluetoothDevice = device!!.bluetoothDevice Handler(Looper.getMainLooper()).postDelayed({ connectDevice() }, 500) - -// } else { -// Handler(Looper.getMainLooper()).postDelayed({ -// send(BLEUtils.byteToHex(tempData)) -// }, 500) -// } } /** @@ -122,7 +118,6 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene closeGatt() cancelTimer() if (descriptorWriteQueue != null && descriptorWriteQueue.size > 0) descriptorWriteQueue.clear() -// listener!!.onDisconnected(bleDevice!!) if (!disconnectedFromDevice) listener!!.onDisconnected(bleDevice!!) else disconnectedFromDevice = false if (isFromMessage) { @@ -149,14 +144,7 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene TAG, "onCharacteristicRead : " + characteristic.uuid.toString() + " , value -> $data" ) - - if (isFromMessage) { - // AppLog.e( - // TAG, - // "tempData -> $tempData" - // ) -// gatt.requestMtu(180) send(BLEUtils.byteToHex(tempData)) return } @@ -169,21 +157,17 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene if (characteristic.uuid.toString() .lowercase() == BleService.READ_CHAR.lowercase() && !isFromMessage ) { -// disConnectedDevice() //onCharacteristicRead +// disConnectedDevice() } } - + /** + * This method keeps on sending the data to the device until the queue is empty + */ override fun onCharacteristicWrite( gatt: BluetoothGatt, characteristic: BluetoothGattCharacteristic, status: Int ) { super.onCharacteristicWrite(gatt, characteristic, status) - // AppLog.e( - // TAG, - // "onCharacteristicWrite -------------->, data : " + BLEUtils.byteToHex( - // characteristic.value - // ) - // ) if (listener != null) { if (messageId.isEmpty() || messageId.isBlank()) { listener!!.onCharacteristicWrite(gatt = gatt, characteristic = characteristic) @@ -193,7 +177,7 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene listener!!.onMessageSent( gatt = gatt, value = tempData, id = messageId ) - disConnectedDevice() //onCharacteristicWrite + disConnectedDevice() tempData = ByteArray(0) } } @@ -215,12 +199,14 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene } } + // Descriptor method (Unused for this architecture) override fun onDescriptorRead( gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int ) { super.onDescriptorRead(gatt, descriptor, status) } + // Descriptor method (Unused for this architecture) override fun onDescriptorWrite( gatt: BluetoothGatt, descriptor: BluetoothGattDescriptor, status: Int ) { @@ -230,21 +216,10 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene if (descriptorWriteQueue.size > 0) writeGattDescriptor(descriptorWriteQueue.element()) else { if (listener != null) { - // AppLog.e(TAG, "onDescriptorWrite asked") listener!!.onDescriptorWrite(bleDevice!!, this@BleActor) } } } -// if (isReconnect && isFromMessage) { - // AppLog.e(TAG, "onDescriptorWrite asked") - // writeServiceData(BleService.SERVICE_UUID, BleService.MSG_CHAR, tempData, attempt) -// attempt = 0 -// tempData = ByteArray(0) -// isReconnect = false -// } else if (isFromMessage) { -// writeServiceData(BleService.SERVICE_UUID, BleService.MSG_CHAR, tempData, 0) -// tempData = ByteArray(0) -// } } override fun onMtuChanged(gatt: BluetoothGatt?, mtu: Int, status: Int) { @@ -268,6 +243,12 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene } } + /** + * This method sends data to GATT Server and manages the bytes written. + * The android gatt client can write only 20 or less bytes at a time. + * So, here we use delimiters "$$" for every message before breaking into multiple and sending to the server + * On server side, it will concatenate the received bytes and check for the delimiters to form the complete message. + */ fun send(data: String): Int { AppLog.e(TAG, "send data-----------------> data $data") var data = data @@ -276,7 +257,6 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene data = data.substring(40) } if (data.isNotEmpty()) sendQueue.add(data) - // AppLog.e(TAG, "sendQueue.size: " + sendQueue.size) if(sendQueue.size > 0) { if (!isWriting) _send() } @@ -288,9 +268,7 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene AppLog.e(TAG, "_send(): EMPTY QUEUE") return false } - // AppLog.e(TAG, "_send(): $attempt Sending: " + sendQueue.peek()) val tx = BLEUtils.hexToByteArray(sendQueue.poll()) - // val tx = sendQueue.poll()?.toByteArray(Charset.forName("UTF-8")) isWriting = true // Set the write in progress flag if (!writeServiceData(BleService.SERVICE_UUID, BleService.MSG_CHAR, tx, attempt)) { return false; @@ -321,6 +299,8 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene if (characteristics != null && characteristics.size > 0) { for (i in characteristics.indices) { val characteristic = characteristics[i] + // Below lines of code are useless and are always false for current architecture. + // Present to maintain code consistency. if (characteristic != null && (isCharacteristicNotifiable(characteristic) || isCharacteristicIndicate( characteristic )) @@ -336,7 +316,6 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene } } if (!isQaulDevice) { - // listener?.addToBlackList(this.bleDevice!!) disConnectedDevice() //discoverServices return } @@ -345,9 +324,11 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene listener!!.onServiceDiscovered(bluetoothDevice!!.address) } } + // Descriptor write queue always empty for current architecture. + // It finally calls "readServiceData()" function to read read_char value from other qaul device. if (descriptorWriteQueue.size > 0) { - // writeGattDescriptor(descriptorWriteQueue.element()) - } else { + } + else { if (listener != null) { mBluetoothGatt listener!!.onDescriptorWrite(this.bleDevice!!, this) @@ -442,32 +423,22 @@ class BleActor(private val mContext: Context, var listener: BleConnectionListene serUUID: String, charUUID: String, data: ByteArray?, attempt: Int ): Boolean { if (attempt < 3) { - if (data != null) { - // AppLog.e( - // TAG, - // "writeServiceData -----------> : data : ${data}" - // ) + if (data != null) { if (mBluetoothGatt != null) { val service = mBluetoothGatt!!.getService(UUID.fromString(serUUID)) if (service != null) { val characteristic = service.getCharacteristic(UUID.fromString(charUUID)) if (characteristic != null) { - + /** + * This is a workaround for Android_Sdk_version 33 or less devices. + * The latest API is more efficient and reliable for writing data to the device. + */ if (Build.VERSION.SDK_INT >= 33) { val returnValue = mBluetoothGatt!!.writeCharacteristic(characteristic, data, BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT) - // AppLog.e( - // TAG, - // "writeServiceData -----------> : data : ${data} , returnValue : $returnValue" - // ) return true } else { characteristic.value = data return mBluetoothGatt!!.writeCharacteristic(characteristic) - // AppLog.e( - // TAG, - // "writeServiceData -----------> : data : ${data} , directSendResult : $directSendResult" - // ) - // return directSendResult } } } else { diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleWrapperClass.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleWrapperClass.kt index e8a1d4fac..2026363ae 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleWrapperClass.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/core/BleWrapperClass.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble.core @@ -276,7 +276,6 @@ open class BleWrapperClass(context: Activity) { directReceived.data = ByteString.copyFrom(msgObject.message) AppLog.e(TAG, "---->onMessageReceived3---> ${directReceived.data}") -// ByteString.copyFrom(msgObject.message, Charset.defaultCharset()) bleRes.directReceived = directReceived.build() // AppLog.e(TAG, "---->onMessageReceived msgObject $msgObject") sendResponse(bleRes) @@ -600,7 +599,6 @@ open class BleWrapperClass(context: Activity) { /** * Request User to Turn On Location */ - private fun enableLocation(context: Activity, locationReqCode: Int) { Log.i(TAG, "enableLocation()") @@ -608,77 +606,6 @@ open class BleWrapperClass(context: Activity) { Settings.ACTION_LOCATION_SOURCE_SETTINGS ) context.startActivityForResult(intent, locationReqCode) -// -// val googleApiClient: GoogleApiClient = GoogleApiClient.Builder(context) -// .addApi(LocationServices.API).build() -// googleApiClient.connect() -// -// val locationRequest: LocationRequest = LocationRequest.create() -// locationRequest.priority = LocationRequest.PRIORITY_HIGH_ACCURACY -// locationRequest.interval = 10000 -// locationRequest.fastestInterval = (10000 / 2).toLong() -// -// val builder: LocationSettingsRequest.Builder = -// LocationSettingsRequest.Builder().addLocationRequest(locationRequest) -// builder.setAlwaysShow(true) -// val activity1 = context -// val result: PendingResult = -// LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build()) -// result.setResultCallback { result -> -// val status = result.status -// when (status.statusCode) { -// LocationSettingsStatusCodes.SUCCESS -> AppLog.i( -// TAG, -// "All location settings are satisfied." -// ) -// LocationSettingsStatusCodes.RESOLUTION_REQUIRED -> { -// AppLog.e( -// TAG, -// "Location settings are not satisfied. Show the user a dialog to upgrade location settings " -// ) -// try { -//// Show the dialog by calling startResolutionForResult(), and check the result -//// in onActivityResult(). -// status.startResolutionForResult(activity1, locationReqCode) -// } catch (e: IntentSender.SendIntentException) { -// AppLog.e( -// TAG, -// "PendingIntent unable to execute request." -// ) -// } -// } -// LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE -> AppLog.e( -// TAG, -// "Location settings are inadequate, and cannot be fixed here. Dialog not created." -// ) -// } -// } - -// val locationRequest = LocationRequest.create() -// .setInterval(10 * 100000) -// .setFastestInterval(2 * 100000) -// .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) -// -// val builder = LocationSettingsRequest.Builder() -// .addLocationRequest(locationRequest) -// -// LocationServices -// .getSettingsClient(context) -// .checkLocationSettings(builder.build()) -// .addOnSuccessListener(context) { response: LocationSettingsResponse? -> } -// .addOnFailureListener(context) { ex -> -// if (ex is ResolvableApiException) { -// try { -// val intentSenderRequest = -// IntentSenderRequest.Builder((ex as ResolvableApiException).resolution) -// .build() -// context.startActivityForResult(intentSenderRequest.fillInIntent, locationReqCode) -// // resolutionForResult.launch(intentSenderRequest) -// } catch (exception: java.lang.Exception) { -// Log.d(TAG, "enableLocationSettings: $exception") -// } -// } -// } } /** diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEDevice.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEDevice.kt index 39acecf36..46943da2f 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEDevice.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEDevice.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble.model diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEScanDevice.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEScanDevice.kt index 803c3e4ad..a76456db3 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEScanDevice.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/BLEScanDevice.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble.model diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/Message.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/Message.kt index 77732f7c3..fcbb29b6d 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/Message.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/model/Message.kt @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + package net.qaul.ble.model import com.google.gson.annotations.SerializedName diff --git a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/service/BleService.kt b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/service/BleService.kt index a65e5c88d..5d36ba11f 100644 --- a/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/service/BleService.kt +++ b/qaul_ui/android/blemodule/src/main/java/net/qaul/ble/service/BleService.kt @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. package net.qaul.ble.service @@ -53,13 +53,21 @@ class BleService : LifecycleService() { private var lastWriteTime = System.currentTimeMillis() + 60000 private var executor = Executors.newSingleThreadExecutor() - // private val hashMap: HashMap>> = hashMapOf() private val sharedPrefFile = "sharedpreference_qaul_ble" private lateinit var sharedPreferences: SharedPreferences companion + /** + * SERVICE_UUID is the main service advertised by GATT Server + * MSG_SERVICE_UUID is not used for normal advertisements(In current architecture) + * It is used with extended advertisements (Future Goals). + * READ_CHAR and MSG_CHAR are the characteristics inside SERVICE_UUID. + * READ_CHAR stores qaul ID for other device to read and confirm qaul device. + * MSG_CHAR is used to send and receive messages. + * GD_CHAR is unused right now. + */ object { var bleService: BleService? = null var isAdvertisementRunning = false @@ -121,22 +129,20 @@ class BleService : LifecycleService() { mainChar.value = qaulId mainService.addCharacteristic(mainChar) - val msgService = BluetoothGattService( - UUID.fromString(MSG_SERVICE_UUID), BluetoothGattService.SERVICE_TYPE_PRIMARY - ) + // val msgService = BluetoothGattService( + // UUID.fromString(MSG_SERVICE_UUID), BluetoothGattService.SERVICE_TYPE_PRIMARY + // ) val msgChar = BluetoothGattCharacteristic( UUID.fromString(MSG_CHAR), BluetoothGattCharacteristic.PROPERTY_WRITE, BluetoothGattCharacteristic.PERMISSION_WRITE ) -// msgChar.writeType = BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT - - msgService.addCharacteristic(msgChar) + // msgService.addCharacteristic(msgChar) mainService.addCharacteristic(msgChar) val serviceList = arrayListOf() serviceList.add(mainService) - serviceList.add(msgService) + // serviceList.add(msgService) startGattServer(services = serviceList) val dataBuilder = AdvertiseData.Builder() @@ -181,8 +187,6 @@ class BleService : LifecycleService() { ) } } -// t.start() - } /** @@ -291,10 +295,8 @@ class BleService : LifecycleService() { AppLog.e(TAG, "device : " + device.address + " Device.name = " + device.name ) if (blackList.find { it.macAddress == device.address } == null) { val selectItem = devicesList.toMutableList().find { it.macAddress == device.address } -// handler.postDelayed({ if (selectItem == null) { // AppLog.e(TAG, "device : " + device.address) -// AppLog.e(TAG, "UUID : " + result.scanRecord!!.serviceUuids) RemoteLog[this]!!.addDebugLog("$TAG:device : " + device.address + " " + result.scanRecord!!.serviceUuids) val bleDevice: BLEScanDevice = BLEScanDevice.getDevice() bleDevice.bluetoothDevice = device @@ -303,36 +305,15 @@ class BleService : LifecycleService() { bleDevice.deviceRSSI = rssi bleDevice.macAddress = device.address bleDevice.isConnectable = result.isConnectable - //bleDevice.lastFoundTime = System.currentTimeMillis() + bleDevice.lastFoundTime = System.currentTimeMillis() devicesList.add(bleDevice) - -// Handler(Looper.getMainLooper()).postDelayed({ if (result.isConnectable) { connectDevice(bleDevice, isFromMessage = false) } -// }, 1200) - } else { -// val selectItemIgnore = ignoreList.find { it.macAddress == device.address } -// if (selectItemIgnore != null) { -// selectItemIgnore.deviceRSSI = rssi -// selectItemIgnore.scanResult = result -// selectItemIgnore.name = device.name -// selectItemIgnore.isConnectable = result.isConnectable -// selectItemIgnore.lastFoundTime = System.currentTimeMillis() -//// if (!selectItemIgnore.isConnected) { -//// connectDevice(selectItemIgnore, isFromMessage = false) -//// } -// } else { -//// selectItem.isConnected = false -//// devicesList.remove(selectItem) -// AppLog.e(TAG, "zzz device ignored: " + device.address) -// } - //AppLog.e(TAG, "-------------------> HERE FOR CONNECTION parseBLEFrame ") ignoreList.find { it.macAddress == device.address }?.lastFoundTime = System.currentTimeMillis() } -// }, 5000) } else { AppLog.e(TAG, "zzz device blacklisted: " + device.address) } @@ -408,11 +389,17 @@ class BleService : LifecycleService() { val `val` = ByteArray(characteristic.value.size) System.arraycopy( characteristic.value, 0, `val`, 0, characteristic.value.size - ) + ) return `val` } + /** + * This method receives write request from the client and manages the bytes written. + * The android gatt client can write only 20 or less bytes at a time. + * So, here we use delimiters "$$" for every message before breaking into multiple and sending to the server + * On server side, it will concatenate the received bytes and check for the delimiters to form the complete message. + */ override fun onCharacteristicWriteRequest( device: BluetoothDevice, requestId: Int, @@ -435,7 +422,7 @@ class BleService : LifecycleService() { gattServer!!.sendResponse( device, requestId, BluetoothGatt.GATT_SUCCESS, offset, value ) -// Log.e(TAG, "Device Address:: ${device.address}") + // Follwing block is for Bytes of same message are coming in packets if (msgMap.containsKey(device.address)) { var oldValue = msgMap[device.address] if (s.endsWith("2424") || (oldValue!!.endsWith("24") && s == "24")) { @@ -443,10 +430,8 @@ class BleService : LifecycleService() { oldValue += s val msgData = String(BLEUtils.hexToByteArray(oldValue)!!).removeSuffix("$$") .removePrefix("$$") - if (!msgData.contains("$$")) { - // AppLog.e(TAG, "Data in msgData:: $msgData") + if (!msgData.contains("$$")) { val msgObject = Gson().fromJson(msgData, Message::class.java) - // AppLog.e(TAG, "Data in msg Object:: ${msgObject.message}") if (bleDevice == null) { bleDevice = BLEScanDevice.getDevice() bleDevice.macAddress = device.address @@ -467,13 +452,12 @@ class BleService : LifecycleService() { msgMap[device.address] = oldValue } } else { + // Following block is for single message if (s.startsWith("2424") && s.endsWith("2424")) { - //Send Response of s val msgData = String(BLEUtils.hexToByteArray(s)!!).removeSuffix("$$") .removePrefix("$$") // AppLog.e(TAG, "Data in msgData:: $msgData") - val msgObject = Gson().fromJson(msgData, Message::class.java) - // AppLog.e(TAG, "Data in msg Object:: $msgObject.message") + val msgObject = Gson().fromJson(msgData, Message::class.java) if (bleDevice == null) { bleDevice = BLEScanDevice.getDevice() bleDevice.macAddress = device.address @@ -492,6 +476,7 @@ class BleService : LifecycleService() { } } + // Descriptor related methods (Useless for current architecture) override fun onDescriptorReadRequest( device: BluetoothDevice, requestId: Int, @@ -502,6 +487,7 @@ class BleService : LifecycleService() { AppLog.e(TAG, "onDescriptorReadRequest()") } + // Descriptor related methods (Useless for current architecture) override fun onDescriptorWriteRequest( device: BluetoothDevice, requestId: Int, @@ -524,6 +510,7 @@ class BleService : LifecycleService() { super.onExecuteWrite(device, requestId, execute) } + // Notif related methods (Useless for current architecture) override fun onNotificationSent(device: BluetoothDevice, status: Int) { super.onNotificationSent(device, status) } @@ -630,8 +617,6 @@ class BleService : LifecycleService() { } uuidList.clear() uuidList.add(ParcelUuid.fromString(SERVICE_UUID)) - // uuidList.add(ParcelUuid.fromString(MSG_SERVICE_UUID)) - // TODO: DK setFilter(uuidList) scanCallback = object : ScanCallback() { override fun onScanResult(callbackType: Int, result: ScanResult?) { @@ -639,17 +624,7 @@ class BleService : LifecycleService() { // App.Log.e(TAG, "device : " + result!!.device.name + " Device.address = " + result!!.device.address) RemoteLog[this@BleService]!!.addDebugLog("$TAG:device : " + result!!.device.address) - // var uuidsScanned = result!!.device!!.getUuids() - // AppLog.e(TAG, "UUID : " + uuidsScanned) - // for (uuid in uuidsScanned) { - // // AppLog.e(TAG, "UUID : " + uuid) - // if((uuid.toString().lowercase()).equals(SERVICE_UUID) || (uuid.toString()).lowercase().equals(MSG_SERVICE_UUID)) { - // AppLog.e(TAG, "UUID : " + uuid) - - parseBLEFrame(result!!.device, result.rssi, result) - // break - // } - // } + parseBLEFrame(result!!.device, result.rssi, result) } override fun onScanFailed(errorCode: Int) { @@ -689,7 +664,6 @@ class BleService : LifecycleService() { if (bLEDevice.lastFoundTime != null && (bLEDevice.lastFoundTime!! < System.currentTimeMillis() - 5000)) { bleCallback?.deviceOutOfRange(bleDevice = bLEDevice) AppLog.e(TAG, " outRangeRunnable- REMOVE HERE -> ${bLEDevice.macAddress} ") -// AppLog.d(TAG, "${bLEDevice.macAddress} out of range ${ignoreList.size}") devicesList.remove(bLEDevice) ignoreList.remove(bLEDevice) // AppLog.d(TAG, "${bLEDevice.macAddress} out of range ${ignoreList.size}") @@ -715,8 +689,6 @@ class BleService : LifecycleService() { override fun onDisconnected(bleScanDevice: BLEScanDevice) { AppLog.e(TAG, " onDisconnected : ${bleScanDevice.macAddress}") -// bleScanDevice.isConnected = false -// device.isConnected = false if (!blackList.contains(bleScanDevice)) { devicesList.remove(bleScanDevice) // ignoreList.remove(bleScanDevice) @@ -746,18 +718,14 @@ class BleService : LifecycleService() { AppLog.e(TAG, " onServiceDiscovered : $macAddress") } + // Descriptor related methods (Useless for current architecture) override fun onDescriptorWrite(bleScanDevice: BLEScanDevice, bleActor: BleActor) { AppLog.e(TAG, " onDescriptorWrite : ${bleScanDevice.macAddress}") -// if (!bleActor.isFromMessage) { bleActor.readServiceData(SERVICE_UUID, READ_CHAR) -// } } override fun onConnectionFailed(bleScanDevice: BLEScanDevice) { AppLog.e(TAG, "zzz onConnectionFailed : ${bleScanDevice.macAddress}") -// bleScanDevice.isConnected = false -// device.isConnected = false -// ignoreList.removeConcurrent(bleScanDevice) actorMap.remove(bleScanDevice.macAddress) Log.e( TAG, @@ -815,18 +783,13 @@ class BleService : LifecycleService() { override fun addToBlackList(bleScanDevice: BLEScanDevice) { blackList.add(bleScanDevice) - // AppLog.e(TAG, " addToBlackList : $blackList") } override fun addToIgnoreList(bleScanDevice: BLEScanDevice) { ignoreList.add(bleScanDevice) - // AppLog.e(TAG, " addToIgnoreList : $ignoreList") } } - -// device.isConnected = true - val baseBleActor: BleActor? = when { isFromMessage -> { if (actorMap[device.macAddress] == null) { @@ -840,7 +803,6 @@ class BleService : LifecycleService() { BleActor(this, BleConnectionListener()) } } - AppLog.e(TAG, "device222222--> ${device.macAddress}") baseBleActor?.setDevice(device = device, isFromMessage = isFromMessage) return baseBleActor!! @@ -869,23 +831,20 @@ class BleService : LifecycleService() { } hashMap[it.macAddress!!] = queue!! mainQueue = queue - // AppLog.d(TAG, " Manual send ======= Queue size was already 1 ") } else { - // AppLog.d(TAG, " Manual send ===== Queue size was empty ") val queue: Queue> = LinkedList() queue.add(Triple(id, from, message)) hashMap[it.macAddress!!] = queue mainQueue = queue } - // AppLog.e(TAG, "device--> ${it.macAddress} ${mainQueue?.size}") sendMessageFromQueu(it.macAddress!!, true) } } - - + /** + * This Method Will Be Used to add delimiters ""$$" and Send Data to Other Qaul-Device + */ private fun sendMessageFromQueu(macAddress: String, isFromSendMessage: Boolean = false) { - //Thread.sleep(10) executor.execute { if (hashMap.isNotEmpty()) { val queue = hashMap[macAddress] @@ -912,7 +871,6 @@ class BleService : LifecycleService() { ) val bleActor = connectDevice(device = bleDevice, isFromMessage = true) -// Handler(Looper.getMainLooper()).postDelayed({ bleActor.messageId = mesTrip.first val btArray = Gson().toJson(msg).toByteArray() val delimiter = ByteArray(2) @@ -923,8 +881,6 @@ class BleService : LifecycleService() { TAG, "data------------>sendMessage Id: ${bleActor.messageId} ${BLEUtils.byteToHex(bleActor.tempData)}" ) -// },500) - } else { AppLog.e( TAG, "data------------>onMessageSent Failed" diff --git a/qaul_ui/android/libqaul/src/main/java/net/qaul/libqaul/libqaul.kt b/qaul_ui/android/libqaul/src/main/java/net/qaul/libqaul/libqaul.kt index b6f2a47d8..4c91b2db1 100644 --- a/qaul_ui/android/libqaul/src/main/java/net/qaul/libqaul/libqaul.kt +++ b/qaul_ui/android/libqaul/src/main/java/net/qaul/libqaul/libqaul.kt @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + package net.qaul.libqaul import java.util.* diff --git a/qaul_ui/packages/qaul_rpc/lib/src/libqaul/channel.dart b/qaul_ui/packages/qaul_rpc/lib/src/libqaul/channel.dart index 4ca255bbd..1b5f6df35 100644 --- a/qaul_ui/packages/qaul_rpc/lib/src/libqaul/channel.dart +++ b/qaul_ui/packages/qaul_rpc/lib/src/libqaul/channel.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. part of 'libqaul.dart'; @@ -123,7 +123,8 @@ class LibqaulChannel extends LibqaulInterface { @override Future receiveRpc() async { try { - final Uint8List? result = await _channel.invokeMethod('receiveRpcMessage'); + final Uint8List? result = + await _channel.invokeMethod('receiveRpcMessage'); if (result == null) { _log.finest("channel receiveRpcMessage: null received"); diff --git a/qaul_ui/packages/qaul_rpc/lib/src/libqaul/ffi.dart b/qaul_ui/packages/qaul_rpc/lib/src/libqaul/ffi.dart index 85e49c97b..5abad89e7 100644 --- a/qaul_ui/packages/qaul_rpc/lib/src/libqaul/ffi.dart +++ b/qaul_ui/packages/qaul_rpc/lib/src/libqaul/ffi.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. part of 'libqaul.dart'; @@ -28,7 +28,7 @@ class LibqaulFFI extends LibqaulInterface { if (Platform.isLinux) { // find the library in the rust target build folder // TODO: target Raspberry - try{ + try { _lib = DynamicLibrary.open('../rust/target/$mode/liblibqaul.so'); } catch (e) { debugPrint("$e"); @@ -54,7 +54,8 @@ class LibqaulFFI extends LibqaulInterface { @override Future start() async { // check what system we are initializing - if (Platform.isLinux && Platform.environment.containsKey('SNAP_USER_COMMON')) { + if (Platform.isLinux && + Platform.environment.containsKey('SNAP_USER_COMMON')) { _log.finer("flutter start snap libqaul"); // start libqaul with path to storage location final start = diff --git a/qaul_ui/packages/qaul_rpc/lib/src/libqaul/libqaul.dart b/qaul_ui/packages/qaul_rpc/lib/src/libqaul/libqaul.dart index e367b7078..73624c3a5 100644 --- a/qaul_ui/packages/qaul_rpc/lib/src/libqaul/libqaul.dart +++ b/qaul_ui/packages/qaul_rpc/lib/src/libqaul/libqaul.dart @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. /// Communicate with libqaul diff --git a/rust/ble_module/src/ble/ble_service.rs b/rust/ble_module/src/ble/ble_service.rs index 4b2366d4b..b58f49814 100644 --- a/rust/ble_module/src/ble/ble_service.rs +++ b/rust/ble_module/src/ble/ble_service.rs @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + use super::super::BleRpc; use super::utils::find_device_by_mac; use crate::{ diff --git a/rust/ble_module/src/ble/ble_uuids.rs b/rust/ble_module/src/ble/ble_uuids.rs index e5bac3f72..1bf8ef051 100644 --- a/rust/ble_module/src/ble/ble_uuids.rs +++ b/rust/ble_module/src/ble/ble_uuids.rs @@ -1,8 +1,12 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + use bluer::Uuid; pub fn main_service_uuid() -> Uuid { Uuid::parse_str("99e91399-80ed-4943-9bcb-39c532a76023").unwrap() } +// Unused for normal advertisements but can be used in extended advertisements pub fn msg_service_uuid() -> Uuid { Uuid::parse_str("99e91400-80ed-4943-9bcb-39c532a76023").unwrap() } diff --git a/rust/ble_module/src/ble/mod.rs b/rust/ble_module/src/ble/mod.rs index 22af56457..4bb95b27b 100644 --- a/rust/ble_module/src/ble/mod.rs +++ b/rust/ble_module/src/ble/mod.rs @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + pub mod ble_service; mod ble_uuids; mod utils; diff --git a/rust/ble_module/src/ble/utils.rs b/rust/ble_module/src/ble/utils.rs index bbcd4c91b..ab6c5c937 100644 --- a/rust/ble_module/src/ble/utils.rs +++ b/rust/ble_module/src/ble/utils.rs @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + use crate::rpc::utils::*; use bluer::{Adapter, Address}; use lazy_static::lazy_static; diff --git a/rust/ble_module/src/rpc/msg_loop.rs b/rust/ble_module/src/rpc/msg_loop.rs index 0961f2d2d..aaf13284b 100644 --- a/rust/ble_module/src/rpc/msg_loop.rs +++ b/rust/ble_module/src/rpc/msg_loop.rs @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + use async_std::task::spawn; use bytes::Bytes; use std::error::Error; diff --git a/rust/ble_module/src/rpc/utils.rs b/rust/ble_module/src/rpc/utils.rs index faf183525..03ab35b9b 100644 --- a/rust/ble_module/src/rpc/utils.rs +++ b/rust/ble_module/src/rpc/utils.rs @@ -1,3 +1,6 @@ +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch +// This software is published under the AGPLv3 license. + use async_std::channel::Sender; use bluer::{Adapter, Address}; diff --git a/rust/clients/cli/src/ble.rs b/rust/clients/cli/src/ble.rs index a95f47b9b..1b370f5c6 100644 --- a/rust/clients/cli/src/ble.rs +++ b/rust/clients/cli/src/ble.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # BLE Module diff --git a/rust/clients/cli/src/chat.rs b/rust/clients/cli/src/chat.rs index 2ca7b53a5..eda5ac762 100644 --- a/rust/clients/cli/src/chat.rs +++ b/rust/clients/cli/src/chat.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Chat Module Interactions diff --git a/rust/clients/cli/src/chatfile.rs b/rust/clients/cli/src/chatfile.rs index 38bc811f8..d98a460ab 100644 --- a/rust/clients/cli/src/chatfile.rs +++ b/rust/clients/cli/src/chatfile.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # ChatFile module functions diff --git a/rust/clients/cli/src/cli.rs b/rust/clients/cli/src/cli.rs index 5f9c6e66b..5f571bcde 100644 --- a/rust/clients/cli/src/cli.rs +++ b/rust/clients/cli/src/cli.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Process CLI input diff --git a/rust/clients/cli/src/connections.rs b/rust/clients/cli/src/connections.rs index 16a242e8b..a8fa537e3 100644 --- a/rust/clients/cli/src/connections.rs +++ b/rust/clients/cli/src/connections.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Connections Management Functions diff --git a/rust/clients/cli/src/debug.rs b/rust/clients/cli/src/debug.rs index 05fcfe5a2..d22273c74 100644 --- a/rust/clients/cli/src/debug.rs +++ b/rust/clients/cli/src/debug.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Debug module functions diff --git a/rust/clients/cli/src/dtn.rs b/rust/clients/cli/src/dtn.rs index 1a16e9c06..cffd263e4 100644 --- a/rust/clients/cli/src/dtn.rs +++ b/rust/clients/cli/src/dtn.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Group module functions diff --git a/rust/clients/cli/src/feed.rs b/rust/clients/cli/src/feed.rs index f7416e240..1d0e48417 100644 --- a/rust/clients/cli/src/feed.rs +++ b/rust/clients/cli/src/feed.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Feed module functions diff --git a/rust/clients/cli/src/group.rs b/rust/clients/cli/src/group.rs index 1b3a3ffcc..fa3485517 100644 --- a/rust/clients/cli/src/group.rs +++ b/rust/clients/cli/src/group.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Group module functions diff --git a/rust/clients/cli/src/main.rs b/rust/clients/cli/src/main.rs index 8d3e83dee..e6fc1215d 100644 --- a/rust/clients/cli/src/main.rs +++ b/rust/clients/cli/src/main.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # qaul RPC CLI Client diff --git a/rust/clients/cli/src/node.rs b/rust/clients/cli/src/node.rs index 036d14335..a577b1912 100644 --- a/rust/clients/cli/src/node.rs +++ b/rust/clients/cli/src/node.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Node module functions diff --git a/rust/clients/cli/src/router.rs b/rust/clients/cli/src/router.rs index 9303ffd3d..baf1b37ae 100644 --- a/rust/clients/cli/src/router.rs +++ b/rust/clients/cli/src/router.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Router module functions diff --git a/rust/clients/cli/src/rpc.rs b/rust/clients/cli/src/rpc.rs index e03868471..a452f8c42 100644 --- a/rust/clients/cli/src/rpc.rs +++ b/rust/clients/cli/src/rpc.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # RPC client functions diff --git a/rust/clients/cli/src/rtc.rs b/rust/clients/cli/src/rtc.rs index 551680b85..504bee1de 100644 --- a/rust/clients/cli/src/rtc.rs +++ b/rust/clients/cli/src/rtc.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # ChatFile module functions diff --git a/rust/clients/cli/src/user_accounts.rs b/rust/clients/cli/src/user_accounts.rs index ab7470210..019dd073e 100644 --- a/rust/clients/cli/src/user_accounts.rs +++ b/rust/clients/cli/src/user_accounts.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # User Accounts Module Functions diff --git a/rust/clients/cli/src/users.rs b/rust/clients/cli/src/users.rs index 392fd5274..1593f7d4b 100644 --- a/rust/clients/cli/src/users.rs +++ b/rust/clients/cli/src/users.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Users functions diff --git a/rust/clients/qauld/src/main.rs b/rust/clients/qauld/src/main.rs index 4c1edff9c..14fc58f1e 100644 --- a/rust/clients/qauld/src/main.rs +++ b/rust/clients/qauld/src/main.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # qauld - qaul Daemon diff --git a/rust/libp2p_modules/qaul_info/src/lib.rs b/rust/libp2p_modules/qaul_info/src/lib.rs index d171b6ccb..499979659 100644 --- a/rust/libp2p_modules/qaul_info/src/lib.rs +++ b/rust/libp2p_modules/qaul_info/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Routing Info Behaviour diff --git a/rust/libp2p_modules/qaul_info/src/protocol.rs b/rust/libp2p_modules/qaul_info/src/protocol.rs index f45082069..cda6fce3c 100644 --- a/rust/libp2p_modules/qaul_info/src/protocol.rs +++ b/rust/libp2p_modules/qaul_info/src/protocol.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. use futures::{ diff --git a/rust/libp2p_modules/qaul_info/src/types.rs b/rust/libp2p_modules/qaul_info/src/types.rs index c623d44a0..5e24c205f 100644 --- a/rust/libp2p_modules/qaul_info/src/types.rs +++ b/rust/libp2p_modules/qaul_info/src/types.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Routing Info Types diff --git a/rust/libp2p_modules/qaul_messaging/src/lib.rs b/rust/libp2p_modules/qaul_messaging/src/lib.rs index ad6935b09..7758969a5 100644 --- a/rust/libp2p_modules/qaul_messaging/src/lib.rs +++ b/rust/libp2p_modules/qaul_messaging/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Messaging Behaviour diff --git a/rust/libp2p_modules/qaul_messaging/src/protocol.rs b/rust/libp2p_modules/qaul_messaging/src/protocol.rs index 29b405b33..b83d6c8a0 100644 --- a/rust/libp2p_modules/qaul_messaging/src/protocol.rs +++ b/rust/libp2p_modules/qaul_messaging/src/protocol.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! Qaul Messaging Protocol diff --git a/rust/libp2p_modules/qaul_messaging/src/types.rs b/rust/libp2p_modules/qaul_messaging/src/types.rs index b8825555f..a39db7f44 100644 --- a/rust/libp2p_modules/qaul_messaging/src/types.rs +++ b/rust/libp2p_modules/qaul_messaging/src/types.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Messaging Types diff --git a/rust/libqaul/build.rs b/rust/libqaul/build.rs index a5e8e55b4..6ef298d22 100644 --- a/rust/libqaul/build.rs +++ b/rust/libqaul/build.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Build Rust Prerequisits diff --git a/rust/libqaul/src/api/android.rs b/rust/libqaul/src/api/android.rs index 7a42a1965..ef623b692 100644 --- a/rust/libqaul/src/api/android.rs +++ b/rust/libqaul/src/api/android.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Android-API for libqaul diff --git a/rust/libqaul/src/api/c.rs b/rust/libqaul/src/api/c.rs index 13722b1ce..c4e634c31 100644 --- a/rust/libqaul/src/api/c.rs +++ b/rust/libqaul/src/api/c.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # C-API for the threaded libqaul diff --git a/rust/libqaul/src/api/mod.rs b/rust/libqaul/src/api/mod.rs index 096d7c9ad..608fb4dd5 100644 --- a/rust/libqaul/src/api/mod.rs +++ b/rust/libqaul/src/api/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Run Libqaul in an own Thread @@ -138,4 +138,4 @@ pub fn send_sys(binary_message: Vec) { /// receive a SYS message from libqaul pub fn receive_sys() -> Result, TryRecvError> { Sys::receive_from_libqaul() -} \ No newline at end of file +} diff --git a/rust/libqaul/src/connections/ble/mod.rs b/rust/libqaul/src/connections/ble/mod.rs index 7c60b2c4d..770ff43c1 100644 --- a/rust/libqaul/src/connections/ble/mod.rs +++ b/rust/libqaul/src/connections/ble/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! BLE Connection Module @@ -109,7 +109,7 @@ pub struct Ble { impl Ble { /// initialize the BLE module - pub fn init() { + pub async fn init() { // get small BLE ID let ble_id = Node::get_small_id(); #[cfg(target_os = "linux")] @@ -117,27 +117,27 @@ impl Ble { while !ble_module::is_ble_enabled().await { log::error!("BLE not enabled, Please power on bluetooth on your device"); async_std::task::sleep(std::time::Duration::from_secs(5)).await; - } - ble_module::init(Box::new(|sys_msg| Sys::send_to_libqaul(sys_msg))); - - // initialize local state - { - // create node states - TO_CONFIRM.set(RwLock::new(BTreeMap::new())); - NODES.set(RwLock::new(BTreeMap::new())); - - // set it to state - let ble = Ble { - ble_id, - status: ModuleStatus::Uninitalized, - devices: Vec::new(), - }; - BLE.set(RwLock::new(ble)); } - - //#[cfg(target_os = "android")] - Self::info_send_request(); + ble_module::init(Box::new(|sys_msg| Sys::send_to_libqaul(sys_msg))); }); + + // initialize local state + { + // create node states + TO_CONFIRM.set(RwLock::new(BTreeMap::new())); + NODES.set(RwLock::new(BTreeMap::new())); + + // set it to state + let ble = Ble { + ble_id, + status: ModuleStatus::Uninitalized, + devices: Vec::new(), + }; + BLE.set(RwLock::new(ble)); + } + async_std::task::sleep(std::time::Duration::from_secs(2)).await; + //#[cfg(target_os = "android")] + Self::info_send_request(); } /// set module status diff --git a/rust/libqaul/src/connections/events.rs b/rust/libqaul/src/connections/events.rs index bc5dc4757..8f90ca9c8 100644 --- a/rust/libqaul/src/connections/events.rs +++ b/rust/libqaul/src/connections/events.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! Event handling for connection modules diff --git a/rust/libqaul/src/connections/internet.rs b/rust/libqaul/src/connections/internet.rs index 1b80b8faa..330edef93 100644 --- a/rust/libqaul/src/connections/internet.rs +++ b/rust/libqaul/src/connections/internet.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Internet Overlay Connection Module diff --git a/rust/libqaul/src/connections/lan.rs b/rust/libqaul/src/connections/lan.rs index 9287b49f8..71089df6d 100644 --- a/rust/libqaul/src/connections/lan.rs +++ b/rust/libqaul/src/connections/lan.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # LAN Connection Module diff --git a/rust/libqaul/src/connections/mod.rs b/rust/libqaul/src/connections/mod.rs index 36e5e76b6..885d8990c 100644 --- a/rust/libqaul/src/connections/mod.rs +++ b/rust/libqaul/src/connections/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Connections Modules @@ -93,7 +93,7 @@ impl Connections { let internet = Internet::init(&node_keys).await; // initialize BLE module - Ble::init(); + Ble::init().await; let conn = Connections { lan: Some(lan), diff --git a/rust/libqaul/src/lib.rs b/rust/libqaul/src/lib.rs index 968b41ce7..dfc6c23cf 100644 --- a/rust/libqaul/src/lib.rs +++ b/rust/libqaul/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # libqaul diff --git a/rust/libqaul/src/node/mod.rs b/rust/libqaul/src/node/mod.rs index 6ab0f3253..eb5329f83 100644 --- a/rust/libqaul/src/node/mod.rs +++ b/rust/libqaul/src/node/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Node Module diff --git a/rust/libqaul/src/node/user_accounts.rs b/rust/libqaul/src/node/user_accounts.rs index 592e04318..6cfe9c592 100644 --- a/rust/libqaul/src/node/user_accounts.rs +++ b/rust/libqaul/src/node/user_accounts.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! User Account Module diff --git a/rust/libqaul/src/router/connections.rs b/rust/libqaul/src/router/connections.rs index 02c811a2c..c3dfa23c9 100644 --- a/rust/libqaul/src/router/connections.rs +++ b/rust/libqaul/src/router/connections.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Connection Module Connectivity Collection Table diff --git a/rust/libqaul/src/router/feed_requester.rs b/rust/libqaul/src/router/feed_requester.rs index 2e74c7ba6..65857f4bd 100644 --- a/rust/libqaul/src/router/feed_requester.rs +++ b/rust/libqaul/src/router/feed_requester.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! Feed Requester diff --git a/rust/libqaul/src/router/flooder.rs b/rust/libqaul/src/router/flooder.rs index 4b27849b6..bb78c7fd7 100644 --- a/rust/libqaul/src/router/flooder.rs +++ b/rust/libqaul/src/router/flooder.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! The flooder floods messages via floodsub/Gossipsub to the network. diff --git a/rust/libqaul/src/router/info.rs b/rust/libqaul/src/router/info.rs index bd9c8e8d1..670830557 100644 --- a/rust/libqaul/src/router/info.rs +++ b/rust/libqaul/src/router/info.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Routing Info diff --git a/rust/libqaul/src/router/mod.rs b/rust/libqaul/src/router/mod.rs index 9074ad4c4..52334f28b 100644 --- a/rust/libqaul/src/router/mod.rs +++ b/rust/libqaul/src/router/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! Qaul Community Router diff --git a/rust/libqaul/src/router/neighbours.rs b/rust/libqaul/src/router/neighbours.rs index 71df6527f..3125e7aef 100644 --- a/rust/libqaul/src/router/neighbours.rs +++ b/rust/libqaul/src/router/neighbours.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! Table of all direct neighbour nodes diff --git a/rust/libqaul/src/router/table.rs b/rust/libqaul/src/router/table.rs index 65a28acc7..9e976db23 100644 --- a/rust/libqaul/src/router/table.rs +++ b/rust/libqaul/src/router/table.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Global Routing Table diff --git a/rust/libqaul/src/router/user_requester.rs b/rust/libqaul/src/router/user_requester.rs index 6a828f1e9..d558da7ae 100644 --- a/rust/libqaul/src/router/user_requester.rs +++ b/rust/libqaul/src/router/user_requester.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! Feed Requester diff --git a/rust/libqaul/src/router/users.rs b/rust/libqaul/src/router/users.rs index b4c5848f7..1e45ddc7c 100644 --- a/rust/libqaul/src/router/users.rs +++ b/rust/libqaul/src/router/users.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Discovered user table diff --git a/rust/libqaul/src/rpc/debug.rs b/rust/libqaul/src/rpc/debug.rs index 2b9167008..8199fc1a1 100644 --- a/rust/libqaul/src/rpc/debug.rs +++ b/rust/libqaul/src/rpc/debug.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # RPC Debug Messages diff --git a/rust/libqaul/src/rpc/mod.rs b/rust/libqaul/src/rpc/mod.rs index 5a9c488ea..be393f478 100644 --- a/rust/libqaul/src/rpc/mod.rs +++ b/rust/libqaul/src/rpc/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Process RPC Messages diff --git a/rust/libqaul/src/rpc/sys.rs b/rust/libqaul/src/rpc/sys.rs index 13afc7779..d66b1d1e9 100644 --- a/rust/libqaul/src/rpc/sys.rs +++ b/rust/libqaul/src/rpc/sys.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Process SYS Messages diff --git a/rust/libqaul/src/services/chat/message.rs b/rust/libqaul/src/services/chat/message.rs index d83573e15..08fb531a8 100644 --- a/rust/libqaul/src/services/chat/message.rs +++ b/rust/libqaul/src/services/chat/message.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Chat Text Message Handling diff --git a/rust/libqaul/src/services/chat/mod.rs b/rust/libqaul/src/services/chat/mod.rs index f4955495e..117985274 100644 --- a/rust/libqaul/src/services/chat/mod.rs +++ b/rust/libqaul/src/services/chat/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Chat Module diff --git a/rust/libqaul/src/services/chat/storage.rs b/rust/libqaul/src/services/chat/storage.rs index aa7363a30..8f826c52e 100644 --- a/rust/libqaul/src/services/chat/storage.rs +++ b/rust/libqaul/src/services/chat/storage.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Chat Conversations Storage Functions diff --git a/rust/libqaul/src/services/crypto/crypto25519.rs b/rust/libqaul/src/services/crypto/crypto25519.rs index eb5ba3313..cd510e056 100644 --- a/rust/libqaul/src/services/crypto/crypto25519.rs +++ b/rust/libqaul/src/services/crypto/crypto25519.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Curve 25519 Operations diff --git a/rust/libqaul/src/services/crypto/mod.rs b/rust/libqaul/src/services/crypto/mod.rs index ebe91b7d7..7ddae069c 100644 --- a/rust/libqaul/src/services/crypto/mod.rs +++ b/rust/libqaul/src/services/crypto/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # End to End Encryption from user to user diff --git a/rust/libqaul/src/services/crypto/noise.rs b/rust/libqaul/src/services/crypto/noise.rs index 979fb3d08..d22a6f9ad 100644 --- a/rust/libqaul/src/services/crypto/noise.rs +++ b/rust/libqaul/src/services/crypto/noise.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Noise related Crypto Functions diff --git a/rust/libqaul/src/services/crypto/sessionmanager.rs b/rust/libqaul/src/services/crypto/sessionmanager.rs index 53f0c3e2c..5452fe278 100644 --- a/rust/libqaul/src/services/crypto/sessionmanager.rs +++ b/rust/libqaul/src/services/crypto/sessionmanager.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Crypto Session Manager diff --git a/rust/libqaul/src/services/crypto/storage.rs b/rust/libqaul/src/services/crypto/storage.rs index 93117d8e1..16d4ee3d4 100644 --- a/rust/libqaul/src/services/crypto/storage.rs +++ b/rust/libqaul/src/services/crypto/storage.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Storage of the Crypto Sessions State diff --git a/rust/libqaul/src/services/dtn/mod.rs b/rust/libqaul/src/services/dtn/mod.rs index c42f82beb..4ecf0300c 100644 --- a/rust/libqaul/src/services/dtn/mod.rs +++ b/rust/libqaul/src/services/dtn/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul DTN Service diff --git a/rust/libqaul/src/services/feed/mod.rs b/rust/libqaul/src/services/feed/mod.rs index 7d4cfef53..7dbc66bf4 100644 --- a/rust/libqaul/src/services/feed/mod.rs +++ b/rust/libqaul/src/services/feed/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Feed Service diff --git a/rust/libqaul/src/services/group/group_id.rs b/rust/libqaul/src/services/group/group_id.rs index 647bd57b1..fe9d91563 100644 --- a/rust/libqaul/src/services/group/group_id.rs +++ b/rust/libqaul/src/services/group/group_id.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Chat Group ID diff --git a/rust/libqaul/src/services/messaging/mod.rs b/rust/libqaul/src/services/messaging/mod.rs index 479ae872c..85053a76e 100644 --- a/rust/libqaul/src/services/messaging/mod.rs +++ b/rust/libqaul/src/services/messaging/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Qaul Messaging Service diff --git a/rust/libqaul/src/services/messaging/process.rs b/rust/libqaul/src/services/messaging/process.rs index dc0a67dc1..15f38366a 100644 --- a/rust/libqaul/src/services/messaging/process.rs +++ b/rust/libqaul/src/services/messaging/process.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Process Received Messages diff --git a/rust/libqaul/src/services/messaging/retransmit.rs b/rust/libqaul/src/services/messaging/retransmit.rs index cd3bf2ff2..fe8c3421e 100644 --- a/rust/libqaul/src/services/messaging/retransmit.rs +++ b/rust/libqaul/src/services/messaging/retransmit.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Retransmit Qaul Messages diff --git a/rust/libqaul/src/services/mod.rs b/rust/libqaul/src/services/mod.rs index b4a46569a..71a1ff2da 100644 --- a/rust/libqaul/src/services/mod.rs +++ b/rust/libqaul/src/services/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! qaul Services diff --git a/rust/libqaul/src/storage/configuration.rs b/rust/libqaul/src/storage/configuration.rs index ee3d6efe4..c62fa00fb 100644 --- a/rust/libqaul/src/storage/configuration.rs +++ b/rust/libqaul/src/storage/configuration.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Configuration diff --git a/rust/libqaul/src/storage/database.rs b/rust/libqaul/src/storage/database.rs index 302a6457e..4153a3190 100644 --- a/rust/libqaul/src/storage/database.rs +++ b/rust/libqaul/src/storage/database.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Libqaul Database diff --git a/rust/libqaul/src/storage/mod.rs b/rust/libqaul/src/storage/mod.rs index fa1f29f30..9184d9aef 100644 --- a/rust/libqaul/src/storage/mod.rs +++ b/rust/libqaul/src/storage/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Libqaul Storage Module diff --git a/rust/libqaul/src/utilities/mod.rs b/rust/libqaul/src/utilities/mod.rs index 1921775ea..19c605273 100644 --- a/rust/libqaul/src/utilities/mod.rs +++ b/rust/libqaul/src/utilities/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Libqaul Utilities diff --git a/rust/libqaul/src/utilities/qaul_id.rs b/rust/libqaul/src/utilities/qaul_id.rs index ac97bf8ca..7dc02fbef 100644 --- a/rust/libqaul/src/utilities/qaul_id.rs +++ b/rust/libqaul/src/utilities/qaul_id.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # qaul ID diff --git a/rust/libqaul/src/utilities/timestamp.rs b/rust/libqaul/src/utilities/timestamp.rs index 623f123c6..d5f65a969 100644 --- a/rust/libqaul/src/utilities/timestamp.rs +++ b/rust/libqaul/src/utilities/timestamp.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Libqaul Timestamp Utility diff --git a/rust/libqaul/src/utilities/upgrade/backup.rs b/rust/libqaul/src/utilities/upgrade/backup.rs index 5653facf4..f50189b3d 100644 --- a/rust/libqaul/src/utilities/upgrade/backup.rs +++ b/rust/libqaul/src/utilities/upgrade/backup.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Backup Utility Functions diff --git a/rust/libqaul/src/utilities/upgrade/mod.rs b/rust/libqaul/src/utilities/upgrade/mod.rs index 0a845354c..a35f0cc4a 100644 --- a/rust/libqaul/src/utilities/upgrade/mod.rs +++ b/rust/libqaul/src/utilities/upgrade/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Libqaul Upgrade Module diff --git a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/mod.rs b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/mod.rs index e716d493d..10791edef 100644 --- a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/mod.rs +++ b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Upgrade to new version 2.0.0-beta.15 diff --git a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/old_config.rs b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/old_config.rs index 989f1c8c3..ea8ceff15 100644 --- a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/old_config.rs +++ b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_15/old_config.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Configuration File from Version 2.0.0-beta.3 diff --git a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_17/mod.rs b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_17/mod.rs index e78d93b84..6bc9da58a 100644 --- a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_17/mod.rs +++ b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_17/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Upgrade to new version 2.0.0-beta.17 diff --git a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_18/mod.rs b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_18/mod.rs index bc441b73b..734310b92 100644 --- a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_18/mod.rs +++ b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_18/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Upgrade to new version 2.0.0-beta.18 diff --git a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/mod.rs b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/mod.rs index fdddc1882..9ca3dc820 100644 --- a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/mod.rs +++ b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/mod.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Upgrade to new version 2.0.0-beta.9 diff --git a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/old_config.rs b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/old_config.rs index 7653d2500..be13534fa 100644 --- a/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/old_config.rs +++ b/rust/libqaul/src/utilities/upgrade/v2_0_0_beta_9/old_config.rs @@ -1,4 +1,4 @@ -// Copyright (c) 2021 Open Community Project Association https://ocpa.ch +// Copyright (c) 2023 Open Community Project Association https://ocpa.ch // This software is published under the AGPLv3 license. //! # Configuration File from Version 2.0.0-beta.3