Objects and Syscalls
|Top Previous Next|
Each platform provides a set of objects and syscalls.
Objects package large chunks of device functionality and come from platforms.
Not all objects are supported by every platform — this is the whole point of having them defined within platforms in the first place.
In Tibbo BASIC/C, objects cannot be instantiated (multiplied). They exist as a given.
You can think of them as "embedded libraries" — unchangeable and always available.
Many objects are asynchronous and non-blocking (meaning).
You interact with objects through their events, properties, and methods.
Object events are what TiOS relies on for its operation. Nothing ever happens until an event is generated.
When processing an event, TiOS calls an event handler for this event, provided that this event handler is defined in your application.
Event handlers are subs in Tibbo BASIC and void functions in Tibbo C. This was covered in Procedures and Event Handlers.
Object properties are like internal object variables. Reading and writing them defines objects' behavior.
Some properties are read-only. You cannot set their values. Such properties exist to relate useful information about the current objects' state.
Object methods are actions you can ask an object to perform. It is through methods that you get objects to do useful things.
The list of available objects, their properties and methods can be found in the Project Browser pane: View > Project-Browser, then Platforms -> Objects.
Object events are listed separately, under the Events branch.
Here is a code example of interacting with objects:
In C you must write method invocations with parentheses, even if there are no arguments to pass, like this:
Syscalls are API functions that are built into platforms. You can see the current syscall list here.
Not all syscalls are supported by every platform — again, this is the whole point of having them in platforms.
The list of available syscalls can be found in the Project Browser pane: View > Project-Browser, then Platforms -> Syscalls.
You can think of syscalls as platform procedures (functions).
Here is a little example of how syscalls are used, it shows the use of string-related syscalls: