-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
645 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
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,9 @@ | ||
package com.juul.kable | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
public actual enum class Reason { | ||
// Not implemented. | ||
} | ||
|
||
internal actual val bluetoothAvailability: Flow<Bluetooth.Availability> = jvmNotImplementedException() |
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,5 @@ | ||
package com.juul.kable | ||
|
||
internal fun jvmNotImplementedException(): Nothing = throw NotImplementedError( | ||
"JVM target not yet implemented. See https://github.com/JuulLabs/kable/issues/380 for details.", | ||
) |
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,5 @@ | ||
package com.juul.kable | ||
|
||
public actual typealias Identifier = String | ||
|
||
public actual fun String.toIdentifier(): Identifier = this |
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,11 @@ | ||
package com.juul.kable | ||
|
||
internal actual fun Peripheral.observationHandler(): Observation.Handler = object : Observation.Handler { | ||
override suspend fun startObservation(characteristic: Characteristic) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
override suspend fun stopObservation(characteristic: Characteristic) { | ||
jvmNotImplementedException() | ||
} | ||
} |
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,10 @@ | ||
package com.juul.kable | ||
|
||
import kotlinx.coroutines.CoroutineScope | ||
|
||
public actual fun CoroutineScope.peripheral( | ||
advertisement: Advertisement, | ||
builderAction: PeripheralBuilderAction, | ||
): Peripheral { | ||
jvmNotImplementedException() | ||
} |
44 changes: 44 additions & 0 deletions
44
core/src/jvmMain/kotlin/com/juul/kable/PeripheralBuilder.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,44 @@ | ||
package com.juul.kable | ||
|
||
import com.juul.kable.logs.LoggingBuilder | ||
|
||
public actual class ServicesDiscoveredPeripheral internal constructor() { | ||
|
||
public actual suspend fun read( | ||
characteristic: Characteristic, | ||
): ByteArray = jvmNotImplementedException() | ||
|
||
public actual suspend fun read( | ||
descriptor: Descriptor, | ||
): ByteArray = jvmNotImplementedException() | ||
|
||
public actual suspend fun write( | ||
characteristic: Characteristic, | ||
data: ByteArray, | ||
writeType: WriteType, | ||
) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
public actual suspend fun write( | ||
descriptor: Descriptor, | ||
data: ByteArray, | ||
) { | ||
jvmNotImplementedException() | ||
} | ||
} | ||
|
||
public actual class PeripheralBuilder internal actual constructor() { | ||
|
||
public actual fun logging(init: LoggingBuilder) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
public actual fun onServicesDiscovered(action: ServicesDiscoveredAction) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
public actual fun observationExceptionHandler(handler: ObservationExceptionHandler) { | ||
jvmNotImplementedException() | ||
} | ||
} |
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,3 @@ | ||
package com.juul.kable | ||
|
||
public actual interface PlatformScanner : Scanner |
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,43 @@ | ||
package com.juul.kable | ||
|
||
import com.benasher44.uuid.Uuid | ||
|
||
internal actual class PlatformService | ||
internal actual class PlatformCharacteristic | ||
internal actual class PlatformDescriptor | ||
|
||
/** Wrapper around platform specific Bluetooth LE service. Holds a strong reference to underlying service. */ | ||
public actual class DiscoveredService : Service { | ||
internal actual val service: PlatformService | ||
get() = jvmNotImplementedException() | ||
public actual val characteristics: List<DiscoveredCharacteristic> | ||
get() = jvmNotImplementedException() | ||
override val serviceUuid: Uuid | ||
get() = jvmNotImplementedException() | ||
} | ||
|
||
/** Wrapper around platform specific Bluetooth LE characteristic. Holds a strong reference to underlying characteristic. */ | ||
public actual class DiscoveredCharacteristic : Characteristic { | ||
internal actual val characteristic: PlatformCharacteristic | ||
get() = jvmNotImplementedException() | ||
public actual val descriptors: List<DiscoveredDescriptor> | ||
get() = jvmNotImplementedException() | ||
public actual val properties: Characteristic.Properties | ||
get() = jvmNotImplementedException() | ||
override val serviceUuid: Uuid | ||
get() = jvmNotImplementedException() | ||
override val characteristicUuid: Uuid | ||
get() = jvmNotImplementedException() | ||
} | ||
|
||
/** Wrapper around platform specific Bluetooth LE descriptor. Holds a strong reference to underlying descriptor. */ | ||
public actual class DiscoveredDescriptor : Descriptor { | ||
internal actual val descriptor: PlatformDescriptor | ||
get() = jvmNotImplementedException() | ||
override val serviceUuid: Uuid | ||
get() = jvmNotImplementedException() | ||
override val characteristicUuid: Uuid | ||
get() = jvmNotImplementedException() | ||
override val descriptorUuid: Uuid | ||
get() = jvmNotImplementedException() | ||
} |
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,14 @@ | ||
package com.juul.kable | ||
|
||
import com.juul.kable.logs.LoggingBuilder | ||
|
||
public actual class ScannerBuilder { | ||
|
||
public actual var filters: List<Filter>? = null | ||
|
||
public actual fun logging(init: LoggingBuilder) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
internal actual fun build(): PlatformScanner = jvmNotImplementedException() | ||
} |
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,3 @@ | ||
package com.juul.kable.logs | ||
|
||
internal actual val LOG_INDENT: String? = " " |
30 changes: 30 additions & 0 deletions
30
core/src/jvmMain/kotlin/com/juul/kable/logs/SystemLogEngine.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,30 @@ | ||
package com.juul.kable.logs | ||
|
||
import com.juul.kable.jvmNotImplementedException | ||
|
||
public actual object SystemLogEngine : LogEngine { | ||
|
||
override fun verbose(throwable: Throwable?, tag: String, message: String) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
override fun debug(throwable: Throwable?, tag: String, message: String) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
override fun info(throwable: Throwable?, tag: String, message: String) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
override fun warn(throwable: Throwable?, tag: String, message: String) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
override fun error(throwable: Throwable?, tag: String, message: String) { | ||
jvmNotImplementedException() | ||
} | ||
|
||
override fun assert(throwable: Throwable?, tag: String, message: String) { | ||
jvmNotImplementedException() | ||
} | ||
} |
File renamed without changes.
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,14 @@ | ||
public final class com/juul/kable/logs/Kable : com/juul/tuulbox/logging/Key { | ||
public static final field INSTANCE Lcom/juul/kable/logs/Kable; | ||
} | ||
|
||
public final class com/juul/kable/logs/TuulboxLogEngine : com/juul/kable/logs/LogEngine, com/juul/tuulbox/logging/HideFromStackTraceTag { | ||
public static final field INSTANCE Lcom/juul/kable/logs/TuulboxLogEngine; | ||
public fun assert (Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V | ||
public fun debug (Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V | ||
public fun error (Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V | ||
public fun info (Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V | ||
public fun verbose (Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V | ||
public fun warn (Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V | ||
} | ||
|
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ kotlin { | |
js().browser() | ||
macosArm64() | ||
macosX64() | ||
jvm() | ||
|
||
sourceSets { | ||
commonMain.dependencies { | ||
|