-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed DSL calls that would allow undesirable behavior
- Loading branch information
1 parent
7adca77
commit e031f63
Showing
3 changed files
with
61 additions
and
38 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
25 changes: 18 additions & 7 deletions
25
SnakeSkin-Core/src/main/kotlin/org/snakeskin/runtime/impl/RuntimePlatformBindingSoftware.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 |
---|---|---|
@@ -1,36 +1,47 @@ | ||
package org.snakeskin.runtime.impl | ||
|
||
import org.snakeskin.executor.IExecutor | ||
import org.snakeskin.executor.impl.ScheduledExecutorServiceExecutor | ||
import org.snakeskin.hid.IHIDValueProviderFactory | ||
import org.snakeskin.hid.impl.NullHIDValueProviderFactory | ||
import org.snakeskin.rt.IRealTimeExecutor | ||
import org.snakeskin.rt.impl.NullRealTimeExecutor | ||
import org.snakeskin.runtime.IRuntimePlatformBinding | ||
import java.util.concurrent.ScheduledThreadPoolExecutor | ||
import java.util.concurrent.TimeUnit | ||
|
||
class RuntimePlatformBindingSoftware: IRuntimePlatformBinding { | ||
override fun blockMilliseconds(ms: Long) { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
Thread.sleep(ms) | ||
} | ||
|
||
override fun getSystemVbusVolts(): Double { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
return 0.0 | ||
} | ||
|
||
override fun allocatePrimaryExecutor(): IExecutor { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
val pool = ScheduledThreadPoolExecutor(8) | ||
pool.setKeepAliveTime(10, TimeUnit.SECONDS) | ||
pool.allowCoreThreadTimeOut(true) | ||
|
||
return ScheduledExecutorServiceExecutor(pool) | ||
} | ||
|
||
override fun allocateSingleUseExecutor(): IExecutor { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
val executor = ScheduledThreadPoolExecutor(1) | ||
|
||
return ScheduledExecutorServiceExecutor(executor) | ||
} | ||
|
||
override fun allocateRealTimeExecutor(rateSeconds: Double): IRealTimeExecutor { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
return NullRealTimeExecutor | ||
} | ||
|
||
override fun getTimestampSeconds(): Double { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
return System.nanoTime() * 1e-9 | ||
} | ||
|
||
override fun allocateHIDValueProviderFactory(id: Int): IHIDValueProviderFactory { | ||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. | ||
return NullHIDValueProviderFactory | ||
} | ||
} |
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