1
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
osmo-st-binding/OsmoCore.st

60 lines
1.3 KiB
Smalltalk
Raw Normal View History

"Copyright placeholder"
Eval [
"Handle reloading the OsmoCore.st file for updates"
Namespace current at: #OSMOCore ifPresent: [ :each | OSMOCore stopProcess ].
]
Object subclass: OSMOCore [
<comment: 'I provide lowlevel access libosmocore.so.0'>
<category: 'libosmocore'>
Process := nil.
OSMOCore class >> initialize [
DLD addLibrary: 'libosmocore.so.0'.
ObjectMemory addDependent: self.
]
OSMOCore class >> poll [
| delay |
delay := Delay forMilliseconds: 50.
[true] whileTrue: [
self bsc_select_main: 1.
delay wait.
].
]
OSMOCore class >> startProcess [
"I start a new polling process"
Process := [
self poll.
] fork.
]
OSMOCore class >> stopProcess [
"I will terminate the process"
Process ifNotNil: [
Process terminate.
Process := nil.
]
]
OSMOCore class >> update: aSymbol [
"Check if the BSC Symbols are there again?"
]
OSMOCore class >> bsc_select_main: poll [
<cCall: 'bsc_select_main' returning: #int args: #(#int) >
]
OSMOCore class >> processEvents [
self bsc_select_main: 1
]
]
Eval [
OSMOCore initialize.
]