Lua API Functions

key.setInfo()

nil key:setTitle/Info/Icon( [setMe:string/default=nil] )

Set or remove custom Strings for this key.

setIcon only works on phones that have a colored screen.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

key.setIcon()

nil key:setTitle/Info/Icon( [setMe:string/default=nil] )

Set or remove custom Strings for this key.

setIcon only works on phones that have a colored screen.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

key.setLed()

nil key:setLed( color:string [blink:boolean/default=false] )
nil key:setLed{ color:string [blink:boolean/default=false] }

Set LED corresponding to the key to the specified color.

Allowed color-values are “red”, “green”, “yellow” and “off”.

key.setTitle()

nil key:setTitle/Info/Icon( [setMe:string/default=nil] )

Set or remove custom Strings for this key.

setIcon only works on phones that have a colored screen.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

sip.invite()

nil sip.invite( uri:string [, pickup:boolean/default=false] [, line:int] [, hidden:boolean/default=false] )
? sip.invite{ uri=string [pickup=boolean/default=false] [line=int] [hidden=boolean/default=false] [returnHttpResult:boolean/default=false] }

Send an invite, aka makes a call to the specified uri. Uri can be just a telephone-number or a complete sip-uri.

Attemps a pickup if pickup-parameter is true.

line is the number of the identity to use. When not set the default identity (see idle-screen) is used.

With hidden=true → call will not be shown on the phones display. It won't have audio either.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.subscribe()

handle:data sip.subscribe(uri:string [, type:int [, line:int]], callback:function)
handle:data sip.subscribe{uri:string  callback:function [line:int]}

Start a sip-subscription of type dialog.

uri is the target of the subscription, i.e. where to subscribe to.

type must be set to '0'.

line is the number of the identity to use for subscription.

It defaults to the currently selected identity (see idle screen of phone).

On incoming Notify-messages the callback is called with three parameters:

  • data:string is the raw content of the notify message
  • url:string is the subscribed url
  • identity:int is the number of the identity that started the subscription

The return value of the callback is ignored.Return value is a handle representing the subscription which can be used for unsubscribe.

sip.unsubscribe()

nil sip.unsubscribe( handle:data )
nil sip.unsubscribe{ handle:data }

Unsubscribe a resource previously subscribed with subscribe().

call:getRemote()

uri:string, name:string call:getRemote()

Get details about the other side of the call.

Returns the sip-uri (string) as the first value and if there is a known name it is returned as the second result (string) else NIL

call:resume()

nil call:resume( [call2:call-object/callId-string] )
? call:resume{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Resumes a call.

Accepts a 2nd call as parameter to resume an entire conference at once.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:accept()

nil call:accept()
? call:accept{ [returnHttpResult:boolean/default=false] }

Accepts an incoming call.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:terminate()

nil call:terminate( [call2:call-object/callId-string] )
? call:terminate{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Terminates a call.

Accepts a 2nd call as parameter to terminate an entire conference at once.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:getDisconnectCause()

code:int, reason:string call:getDisconnectCause()

Get the cause for disconnect of a disconnected call.

Returns the sip-code (int) as the first value and the reason (string) as the second.

call:getId()

string call:getId()

Get the id of the call.

call:getState()

string call:getState()

Get the state of the call.

Returns one of the following Strings:

  • calling (outgoing call that was not yet active (i.e. connected))
  • ringing (incoming call that was not yet active (i.e. connected))
  • active (connected call)
  • holding (call was put on hold, i.e. this phone is holding the other party)
  • disconnected (call has ended)
  • unknown (fallback)

call:isIncoming()

boolean call:isIncoming()

Returns true when call is an incoming one, aka some party called this phone.

call:getIdentityIndex()

int call:getIdentityIndex()

Get the index of the identity (starts with 1) with which the call is made or 0 on error.

call:hold()

nil call:hold( [call2:call-object/callId-string] )
? call:hold{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Holds a call.

Accepts a 2nd call as parameter to hold an entire conference at once.

The call2-parameter may either be a call-obj or just a callId.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:transfer()

? call:transfer( number:string )
? call:transfer{ number:string [returnHttpResult:boolean/default=false] }

Transfers a call to a specified number.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:isOutgoing()

boolean call:isOutgoing()

Returns true when call is an outgoing, aka this phone is calling some party.

call:join()

nil call:join( [call2:call-object/callId-string] )
? call:join{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Joins two calls, aka a transfer. This phone will no longer be involved in the calls.

When 2nd call-parameter is missing, phone will do it's best to select the obvious one.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:putDetail()

nil call:putDetail( label:string, value:string )
? call:putDetail{ label:string value:string [returnHttpResult:boolean/default=false] }

Add/Replace a call-detail. These details will make it onto the phones screen whenever the call is displayed in full.

You can delete a detail by passing an empty value.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:conference()

nil call:conference( [call2:call-object/callId-string] )
? call:conference{ [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Joins two calls into a local conference, aka where audio is mixed on this phone.

Conferences may be dissolved by only holding or terminating one of the conference members

When 2nd call-parameter is missing, phone will do it's best to select the obvious one.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

call:dtmf()

? call:dtmf( dtmf:string )
? call:dtmf{ dtmf:string [returnHttpResult:boolean/default=false] }

Sends a dtmf-sequence on an active call.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.resume()

nil sip.calls.resume( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.resume{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Resumes a call or a conference.

If you omit the callId's, the first found held call or conference will be resumed.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.terminate()

nil sip.calls.terminate( [call:call-object/callId-string], [call2:call-object/callId-string]])
? sip.calls.terminate{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Terminates (hangup) a call or conference.

If you omit the callId's, the active call or conference will be terminated.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.accept()

nil sip.calls.accept( [call:call-object/callId-string] )
? sip.calls.accept{ [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Accepts an incoming call.

If you omit the callId, the first ringing call found will be accepted.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.listen()

handle:data sip.calls.listen( callback:function )
handle:data sip.calls.listen{ callback:function }

Subscribe for call changes.

Returns handle which can be passed to stop_listen.

The callback is called with multiple parameters, first one names the change:

  • 'add', call-obj - there is a new call
  • 'remove', call-obj - call was deleted
  • 'remote_update', call-obj - either number or name of call have changed, see call:getRemote()
  • 'state_changed', call-obj - state of call changed (e.g.: put on hold), see call:getState()
  • 'transferred', call-obj - call got transferred → new party on the other end
  • 'conferenced', call-obj, call-obj - both calls are now in a conference
  • 'unconferenced', call-obj, call-obj - both calls are no longern in a conference
  • 'transfer_initiated', call-obj, call-obj - starting attended transfer, both remote parties of both calls are being connected.
  • 'transfer_failed', call-obj, call-obj - attended transfer failed
  • 'transfer_done', call-obj, call-obj - attended transfer was successful
  • 'transfer_done', call-obj, target:string - blind transfer was successful

Call objects can be used to query or modify the call.

The return value of the callback is ignored.

sip.calls.get_all()

calls:array sip.calls.get_all()

Returns a table (array) of calls

sip.calls.hold()

nil sip.calls.hold( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.hold{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Holds a call or a conference.

If you omit the callId's, the active call or conference will be held.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.transfer()

nil sip.calls.transfer( [call:call-object/callId-string], number:string )
? sip.calls.transfer{ number:string [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Transfers a call to a specified number.

You may set the callId to nil in which case the the phone will make a guess which call is ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.join()

nil sip.calls.join( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.join{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Joins two calls, aka a transfer. This phone will no longer be involved in the calls.

If you omit one or both call's, the phone will make a guess which calls are ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.putDetail()

nil sip.calls.putDetail( [call:call-object/callId-string], label:string, value:string )
? sip.calls.putDetail{ label:string value:string [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Add/Replace a call-detail. These details will make it onto the phones screen whenever the call is displayed in full.

You can delete a detail by passing an empty value.

You may set the callId to nil in which case the the phone will make a guess which call is ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.conference()

nil sip.calls.conference( [call:call-object/callId-string], [call2:call-object/callId-string] )
? sip.calls.conference{ [call:call-object/callId-string] [call2:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Joins two calls into a lokal conference, aka where audio is mixed on this phone.

Conferences may be dissolved by only holding or terminating one of the conference members

If you omit one or both callId's, the phone will make a guess which calls are ment.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.make()

nil sip.calls.make( uri:string [, pickup:boolean/default=false] [, line:int] [, hidden:boolean/default=false] )
? sip.calls.make{ uri:string [pickup:boolean/default=false] [line:int] [hidden:boolean/default=false] [returnHttpResult:boolean/default=false] }

Makes a call to the specified uri. Uri can be just a telephone-number or a complete sip-uri.

Attemps a pickup if pickup-parameter is true.

Line is the number of the identity to use. When not set the default identity (see idle-screen) is used.

With hidden=true → call will not be shown on the phones display. It won't have audio either.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.dtmf()

nil sip.calls.dtmf( [call:call-object/callId-string], dtmf:string )
? sip.calls.dtmf{ dtmf:string [call:call-object/callId-string] [returnHttpResult:boolean/default=false] }

Sends a dtmf-sequence on an active call.

You may set the callId to nil in which case the active call is used, if there is one.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

sip.calls.stop_listen()

nil sip.calls.stop_listen( handle:data )
nil sip.calls.stop_listen{ handle:data }

Stop listening for calls previously started with listen().

sip.identities.is_active()

boolean sip.identities.is_active( idIdx:int )
boolean sip.identities.is_active{ idIdx:int }

Returns whether an Identity is registered or not.

idIdx is the number of the identity to check (1-based index).

sip.identities.stop_listen()

nil sip.identities.stop_listen( handle:data )
nil sip.identities.stop_listen{ handle:data }

Stop listening for account state changes previously started with accounts.listen().

sip.identities.listen()

handle:data sip.identities.listen( callback:function )
handle:data sip.identities.listen{ callback:function }

Subscribe for account state changes.

Returns handle which can be passed to stop_listen.

The callback is called with no parameters.

The return value of the callback is ignored.

debug.getDocu()

string debug.getDocu( thing:lua-object )
string debug.getDocu{ thing:lua-object }

Returns the documentation for the provided function, table or other lua-object.

May return nil when no documentation exists.

debug.log()

nil debug.log( message:string [, debug_level:string/default=i] )
? debug.log{ message:string [debug_level:string/default=i] [returnHttpResult:boolean/default=false] }

Log the provided message into androids LogCat-system.

debug_level = e/w/i/d/v → i.e. a one-char String (only first char is looked at) that marks the severity of the log: error, warning, info, debug or verbose.

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

on D100/200 there is a setting that limits logs to only show errors and warnings by default. To enable logs up to debug, you need to set Access → Extended Logging.
verbose logs usually do not show up, unless you use androids adb-tool to connect to your phone and increase the log sensitivity with `adb shell setprop log.tag.LuaScript VERBOSE`.

debug.getLoadableLibs()

table<string> debug.getLoadableLibs()

Returns a list of all Libraries that can be called into any LuaScript using require(“[libname]”).

These include baked-in modules like the penlight library as well as the LuaLibraries which are part of the settings.

debug.getDrawables()

table<string> debug.getDrawables()

Returns a list of all drawables that can be used e.g. for key.setIcon().

system.toast()

nil system.toast( text:string )
? system.toast{ text:string [returnHttpResult:boolean/default=false] }

Shows the provided text as a toast.

On colored devices you may alternatively provide a '@drawable/..' (See debug.getDrawables).

If you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

system.intent()

nil system.intent( action:string )
? system.intent{ action:string [component:string] [data:string(uri-format)] [extras:table] [returnHttpResult:boolean/default=false]}

send an intent to the android system.

for an complete decription of the parameters see: https://developer.android.com/guide/components/intents-filtersIf you set returnHttpResult to true, the function will return the result of the operation.

Result consists of error code, body and additional headers, taylor made to return within an http.listen()-callback. See http.listen()-callback with exclusive=true for more details.

returns nil unless returnHttpResult==true

system.notifications.getAll()

notifications:array notifications.getAll()

Returns a table (array) of all active notifications.

system.notifications.monitor()

monitor:obj notifications.monitor{onCreated:callback onDeleted:callback [pkg:string] [id:int] [tag:string]}

Calls onCreated or onDeleted callback with notification-obj as parameter whenever a notification matching the search-criteria appears or disappears.

system.notifications.get()

notification:obj notifications.get{[pkg:string] [id:int] [tag:string] [key:string]}

Searches all active notifications for the one specified and returns the first one that matches the criteria or nil when none matches.

When key is provided, id, tag and pkg are ignored.

When nothing is provided, the first found active notification is returned.

system.notifications.add()

nil notifications.add{tag:string id:int title:string message:string [icon:string]  [led:on|blink|off(default)] [persistent:boolean/default=false] [onClicked:callback] [onDeleted:callback] }

Create a notification.

onClicked and onDeleted are callbacks with two parameters cb(tag:string id:int) that get called when user deletes a notification or clicks on it.

A persistent notification cannot be deleted by the user.

Icon-Values can be:

  • a '@drawable/..'-reference to an icon that's part of the firmware. See debug.getDrawables().
  • a http-url to an icon.
  • a base64 encoded image.

The led parameter defines the desired behaviour of the LED of the message-key. If you set it to 'on' it will cause the Message-LED to turn on, unless there is another message that overrides this with blinking.

Use tag and id parameter to make your notification unique to the system and to identify it in onClicked- and onDeleted-callbacks.

monitor:remove()

nil monitor:remove()

Remove the monitor, i.e. dont call it's callbacks anymore.

notification:delete()

nil notification:delete()

Delete the notification, i.e. it wont be seen anymore unless it's a persistent notification that cannot be deleted.

If a notification has some intent tied to it's deletion, it will be called.

notification:remove()

nil notification:remove()

Remove a notification that was previously created in lua. This is the only way to remove a persistent notification.

notification:getTitleAndMsg()

string, string notification:getTitleAndMsg()

Returns title and message of the notification.

notification:getPkg()

string notification:getPkg()

Get the package of the notification.

notification:isPersistent()

bool notification:isPersistent()

Returns true if the notification is persistent (cannot be deleted by user).

notification:getKey()

string notification:getKey()

Get the key of the notification.

notification:getId()

int notification:getId()

Get the id of the notification.

notification:getTag()

string notification:getTag()

Get the tag of the notification.

luaPkg: "de.auerswald.functions"
vpnIdTrying: 1623130911
vpnPkg: "de.blinkt.openvpn"
vpnIdSuccess: 1346787898

system.network.monitor()

monitor:obj network.monitor{onAvailable:callback onLost:callback transports:array [capabilities:array]}

Calls onAvailable or onLost callback whenever the requested network gets established or is lost.

The transports-parameter defines the network-types you are interested in. It is expected as an indexed table with the values being one of these strings: wifi, eth, bluetooth and vpn

The capabilities-parameter is an int defined by android, you can find a list of supported capabilities in network.capabilities.

Returned monitor-obj can be used to end this monitor via its :remove()-function.

Returns nil on error.

monitor:remove()

nil monitor:remove()

Remove the monitor, i.e. dont call it's callbacks anymore.

VALIDATED: 16
WIFI_P2P: 6
UNTRUSTED: 14
VPN: 15
INTERNET: 12
CAPTIVE_PORTAL: 17
FOREGROUND: 18
RESTRICTED: 13

http.post()

nil http.post(url:string [, callback:function [, content:string [, headers:table]]])
nil http.post{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true]}

Send an http post request to the provided url.

See http.request() for details.

http.delete()

nil http.delete(url:string [, callback:function [, content:string [, headers:table]]])
nil http.delete{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true]}

Send an http delete request to the provided url.

See http.request() for details.

http.put()

nil http.put(url:string [, callback:function [, content:string [, headers:table]]])
nil http.put{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true]}

Send an http put request to the provided url.

See http.request() for details.

http.request()

nil http.request(url:string [, callback:function [, method:string/default=GET [, content:string]], headers:table])
nil http.request{url:string [callback:function] [method:string/default=GET] [content:string] [headers:table] [follow_redirects:boolean/default=true]}

Send an http request to the provided url.

The url-parameter must start with http:// or https://.

You can pass credentials for authorization challenges via: http://username:password@...

The callback receives 3 parameters: callback(responseCode:int [, content:string, headers:table]).

  • when the request was unsuccessful, the callback gets called with just the http error code.

The method-parameter should be either GET, POST, DELETE or PUT.

The content-parameter is appended as the body of the http-request.

With follow_redirects=false you can get to the headers an body of a 3xx-response.

You can optionally supply request headers as a table mapping string keys to string values.

http.get()

nil http.get(url:string [, callback:function [, headers:table]])
nil http.get{url:string [callback:function] [content:string] [headers:table] [follow_redirects:boolean/default=true]}

Send an http get request to the provided url.

See http.request() for details.

http.listen()

handle:data http.listen(path:string, callback:function [, exclusive:boolean/default=false])

Listen for HTTP requests under https://<your-phone-IP>/api/v1/exec/<path>.

The request has to be authenticated (via Login or token).

Returns handle which can be passed to stop_listen.

If the parameter <exclusive> is true and there already exists a handler for the supplied <path>,

the function returns nil and the handler is not installed.

The request goes to the supplied callback function, which is called with these parameters:

  • the requested path as a string, aka same as the original path-parameter
  • the request body as a string
  • the request headers as a table with string keys and values
  • another table, with additional infos like 'request_method', 'query_string' and 'query_map'

If <exclusive> is true, then the callback can return the HTTP response code, the response body and a map of additional headers to include in the response.

If the code is nil, 200 is sent. If the body is nil, an empty body is sent.

If <exclusive> is false, any return value from the callback is ignored.

http.stop_listen()

nil http.stop_listen(handle:data)

Stop listening for HTTP requests. Parameter handle must be the return value from previous call to http.listen().

dialog.show()

nil dialog.show( text:string )

Shows the provided text in fullscreen.

function is deprecated and may get removed in future, use system.toast() instead.

xml.eval()

XmlObj xml.eval(xml:str)

Convert the provided xml-string into a xml object.

xml.append()

XmlObj xml.append(XmlObj, tableOrTag:table)
XmlObj xml.append(XmlObj, tableOrTag:string)

Create new XmlObj like `xml.new()` and append it to the child elements of the provided XmlObj.

The children are stored at index 1 and up in the XmlObj.Returns the new child.

xml.appendtext()

XmlObj xml.appendtext(XmlObj, text:string)

Append a plain-text element to the child elements ot the provided XmlObj.

The children are stored at index 1 and up in the XmlObj.Returns the provided XmlObj.

xml.tostring()

string xml.tostring(XmlObj)

Return string representation of the provided XmlObj.

xml.find()

XmlObj xml.find(XmlObj [, tag[, key[, value]]])

Find a XmlObj within the provided XmlObj. The provided XmlObj is checked as well as it's children and any of their children recursivly. The first match is returned or nil if no match was found.

Tag can be nil or “” to find an element with any tag.

If key is not nil or “”, the element must have an attribute with this key.

If value is not nil, the attribute must have this value.

xml.new()

XmlObj xml.new(tableOrTag:table)
XmlObj xml.new(tableOrTag:string)

Create a new xml object.

If `tableOrTag` is a table, use and convert it to a xml object (i.e. keep the data as is and add a metatable for object-like access).

If `tableOrTag` is a string, use as the tag of the XmlObj.

XmlObj's have their tag stored at index [0].

At index [1] and above all children are stored. These are either XmlObj's themselfes or a string representing plain-text content.

xml.tag()

string xml.tag(XmlObj)
nil xml.tag(XmlObj, tag:string)

Returns or sets the tag of the XmlObj.If `tag` nil, returns the tag of the provided XmlObj.

If `tag` is a string, changes the tag of the XmlObj.

json.object()

JsonObj json.object([base:table])

Create a new json object.

If base is set, copy all its string-key-value pairs to JsonObj[key.tostring()] = value.tostring().

Values of type table get skipped.

json.eval()

JsonObj json.eval(json:string)

Parse a string and return a json object.

json.insert()

nil json.insert(array:JsonAry [, index:int], value:data)

With an index inserts the provided value at the marked position into the JsonAry.

Without an index adds the provided value at the end of the JsonAry.

The value should be either a JsonObj, a JsonAry or a string.

json.array()

JsonAry json.array([base:array])

Create a new json array.

If base is set, copy all its indexed values to JsonAry[idx] = value.tostring().

Values of type table get skipped.

json.tostring()

string json.tostring(stringMe:JsonObj)
string json.tostring(stringMe:JsonAry)

Return string representation of the provided json object or array.

bluetooth.unregisterRangeCheck()

nil bluetooth.unregisterRangeCheck(addr:string, callback:function)
nil bluetooth.unregisterRangeCheck{addr:string, callback:function}

Unregister from updates on the signal-strength (rssi) of a bluetooth device.

bluetooth.registerRangeCheck()

nil bluetooth.registerRangeCheck(addr:string, callback:function)
nil bluetooth.registerRangeCheck{addr:string, callback:function}

Register for updates on the signal-strength (rssi) of a bluetooth device.

You'll need a paired bluetooth 4 device to receive rssi-updates.

Provide the bluetooth-mac-address as addr-parameter.

The callback receives two parameters: callback(status:string, rssi:int).

  • the callback gets called in a fixed interval once the device connects for the first time.
  • status will either be “OK” or “NOT FOUND”.
  • rssi is an int or NIL if not in range.

bluetooth.getDevices()

{} bluetooth.getDevices()

Returns a dictionary of all known bluetooth devices. Keys are the addresses and the value holds the name.Returns NIL on error, e.g. missing bluetooth dongle.

time.sleep()

nil time.sleep(sleepInSeconds:number)

sleeps up to 5 minutes

function is deprecated and may get removed in future, use time.callbackIn() instead.

time.unregister()

nil time.unregister(callback)

unregister to get a callback every passing minute

time.register()

nil time.register(callback)

register to get a callback every passing minute

time.callbackIn()

nil time.callbackIn(callback, delayInSeconds)

register LuaFunction callback, to be called in delayInSeconds

time.callbackIn(callMe, 0.1) will call callMe in 100 milliseconds.

smallest resolution is 1 ms

async.async()

async.async()

Create a new async object. The object has two functions:

complete(...) -> set the return values of await()
... await([timeout]) -> wait for and return the values given to complete()
    timeout is specified in seconds
    the function will never wait longer than 5 minutes even if no timeout is given

example:

local function http_get_sync(url)
  local async = async.async()
  http.get(url, function(code, response, headers)
      async.complete(response)
  end)
  local res, response = async.await()
  return response
end

Returns async object

phoneInfo.getBrand()

string phoneInfo.getBrand()

Returns either Auerswald or Fontevo

phoneInfo.getMacAddress()

string phoneInfo.getMacAddress()

Returns the mac address of the phone.

phoneInfo.getIPs()

array<string> phoneInfo.getIPs()

Returns a table/array of all IPs the phone has.IPv4's get listed up front, followed by all IPv6's

phoneInfo.getModel()

string phoneInfo.getModel()

Returns the model of the phone, e.g.: D400

phoneInfo.getFwVersion()

string phoneInfo.getFwVersion()

Returns the firmware version, e.g.: 1.6A

config.unregister()

nil config.unregister( path:string, callback:function )
nil config.unregister{ path:string callback:function }

Unregister callback function for the specified path.

path is the xPath to a setting or group of settings.

config.set()

nil config.set( path:string, value:string )
nil config.set{ path:string value:string}

Set a setting-value.

path is the xPath to the desired setting.

value holds the new desired value.

config.get()

string config.get( path:string )
string config.get{ path:string }

Get a setting-value.

path is the xPath to the desired setting.

config.register()

nil config.register( path:string, callback:function )
nil config.register{ path:string callback:function }

Register to be informed of changing setting(s).

path is the xPath to a setting or group of settings.

callback will be called with one parameter:

  • path:string → the xPath of the changed setting(s)

return-value of callback is ignored.