The following objects provide bundles of functions and should be built in to any accessor host. All accessor hosts are assumed to have basic networking faculties available at a minimum, placing libraries such as http and coap into the required set.
All built-in modules are scoped under the rt. namespace to make their provenance clear.
Long-running operations, e.g. I/O operations, are placed under either the asynchronous or synchronous (art. or srt.) namespace. The call signatures are always identical, except that art functions append two arguments to every function, done_fn and err_fn callbacks for completion and error respectively. The done_fn argument is the same as the return value of the synchronous interface. This is written out explicitly for {a,s}rt.time.sleep, the remaining functions only show the srt interface for brevity.
rt.log
A general logging mechanism. Will log to the most appropriate location for the current runtime, e.g a terminal window or an ADB shell. This library is intended for developers. Accessors should not depend on any messages from rt.log being displayed.
<void> rt.log.[debug,info,warn,error](<string> line): The log family of functions provides a means for logging messages. These messages are generally intended for developers and should not be used to convey runtime information.
<void> rt.log.critical(<string> line): A critical error will throw a runtime exception, terminating the current execution. Do not use critical for transient errors (e.g. a 503).
rt.time
<float> rt.time.time(): Returns current time as a unix timestamp. FIXME: Timezones? I prefer the idea of UTC by default -Pat
<null> srt.time.sleep(<int> time_in_ms) / art.time.sleep(<int> time_in_ms, < <void> fn ( <void> ) > done_cb, < <void> fn ( <void> ) > error_cb): Suspends execution for at least the amount of time requested.
<null> rt.time.run_later(<float> delay_in_ms, <fn> fn_to_run, <T> args): Schedules fn_to_run for execution in the future.
rt.encode
See https://github.com/lab11/accessors/tree/master/runtimes#encoding-functions
rt.color
See https://github.com/lab11/accessors/tree/master/runtimes#color-functions
rt.socket
See https://github.com/lab11/accessors/tree/master/runtimes#sockets
rt.http
See https://github.com/lab11/accessors/tree/master/runtimes#http-requests
rt.coap
See https://github.com/lab11/accessors/tree/master/runtimes#coap-requests
rt.amqp
See https://github.com/lab11/accessors/tree/master/runtimes#rabbitmq--amqp
rt.gatd
See https://github.com/lab11/accessors/tree/master/runtimes#gatd-v01
FIXME: Are there elements from util that should be pulled in?
- util: Provides various utility functions.
Migration TODOs
Back to accessor specification