-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding :core:network:light-streamer for #56
- Loading branch information
1 parent
f7d74f4
commit 954c740
Showing
13 changed files
with
159 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
plugins { | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
namespace 'garousi.dev.light_streamer' | ||
compileSdk 33 | ||
|
||
defaultConfig { | ||
minSdk 23 | ||
targetSdk 33 | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
consumerProguardFiles "consumer-rules.pro" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
} | ||
} | ||
|
||
dependencies { | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
|
||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" | ||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" | ||
|
||
api "com.lightstreamer:ls-android-client:4.2.6" | ||
api "com.lightstreamer:ls-log-adapter-java:1.0.2" | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...t-streamer/src/main/java/garousi/dev/light_streamer/connection/LightStreamerConnection.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package garousi.dev.light_streamer.connection | ||
|
||
import com.lightstreamer.client.LightstreamerClient | ||
import com.lightstreamer.client.Subscription | ||
import com.lightstreamer.client.SubscriptionListener | ||
import garousi.dev.light_streamer.models.SubscriptionMode | ||
|
||
interface LightStreamerConnection { | ||
val lsClient: LightstreamerClient? | ||
var subscriptionListener: SubscriptionListener? | ||
var subscription: Subscription? | ||
fun connect(serverAddress: String, adapterSet: String) | ||
fun disconnect() | ||
fun subscribe( | ||
subscriptionMode: SubscriptionMode, | ||
dataAdapter: String? = null, | ||
requestedSnapshot: String? = null, | ||
requestedMaxFrequency: String? = null, | ||
itemNames: Array<String>, | ||
fieldNames: Array<String>, | ||
): Subscription? | ||
|
||
fun subscribe( | ||
subscriptionMode: SubscriptionMode, | ||
dataAdapter: String? = null, | ||
requestedSnapshot: String? = null, | ||
requestedMaxFrequency: String? = null, | ||
itemName: String, | ||
fieldNames: Array<String>, | ||
): Subscription? | ||
|
||
fun unsubscribe() | ||
fun subscribeToClient() | ||
fun setSubscription( | ||
subscriptionMode: SubscriptionMode, | ||
itemNames: Array<String>, | ||
fieldNames: Array<String>, | ||
) | ||
|
||
fun setSubscription( | ||
subscriptionMode: SubscriptionMode, | ||
itemName: String, | ||
fieldNames: Array<String>, | ||
) | ||
|
||
fun setRequestedSnapshot(requestedSnapshot: String?) | ||
fun setRequestedMaxFrequency(requestedMaxFrequency: String?) | ||
} |
12 changes: 12 additions & 0 deletions
12
.../light-streamer/src/main/java/garousi/dev/light_streamer/listeners/EmptyClientListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package garousi.dev.light_streamer.listeners | ||
|
||
import com.lightstreamer.client.ClientListener | ||
import com.lightstreamer.client.LightstreamerClient | ||
|
||
object EmptyClientListener : ClientListener { | ||
override fun onListenStart(client: LightstreamerClient) = Unit | ||
override fun onListenEnd(client: LightstreamerClient) = Unit | ||
override fun onServerError(errorCode: Int, errorMessage: String) = Unit | ||
override fun onStatusChange(status: String) = Unit | ||
override fun onPropertyChange(property: String) = Unit | ||
} |
6 changes: 6 additions & 0 deletions
6
...etwork/light-streamer/src/main/java/garousi/dev/light_streamer/models/SubscriptionMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package garousi.dev.light_streamer.models | ||
|
||
enum class SubscriptionMode { | ||
Merge, | ||
Command, | ||
} |
12 changes: 12 additions & 0 deletions
12
...k/light-streamer/src/main/java/garousi/dev/light_streamer/service/LightStreamerService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package garousi.dev.light_streamer.service | ||
|
||
import com.lightstreamer.client.ItemUpdate | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
interface LightStreamerService<T> { | ||
val stream: StateFlow<T> | ||
fun subscribe(vararg params: Any): LightStreamerService<T> | ||
fun unsubscribe() | ||
fun observeSubscriptionUpdates() | ||
fun setFieldsToDto(itemUpdate: ItemUpdate) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters