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

56 lines
1.2 KiB
Smalltalk

"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 >> startProcess [
"I start a new polling process"
| delay |
delay := Delay forMilliseconds: 500.
Process := [
[true] whileTrue: [
self bsc_select_main: 1.
" delay wait."
].
] 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.
OSMOCore startProcess
]