Version 1.10#
key#
key.setInfo()#
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()#
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] }
Allowed color-values are "red", "green", "yellow" and "off".
key.setTitle()#
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#
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] }
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]}
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()#
Unsubscribe a resource previously subscribed with subscribe().sip.calls#
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] }
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] }
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] }
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()#
Subscribe for call changes.Returns handle which can be passed to stop_listen.
The callback is called with two 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()#
Returns a table (array) of callssip.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] }
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] }
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] }
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] }
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] }
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] }
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()#
Stop listening for calls previously started with listen().sip.identities#
sip.identities.is_active()#
Returns whether an Identity is registered or not.idIdx is the number of the identity to check (1-based index).
sip.identities.stop_listen()#
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 }
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#
debug.getDocu()#
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] }
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
Info
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.
Info
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()#
Returns a list of all Libraries that can be called into any LuaScript usingrequire("[libname]")
.
These include baked-in modules like the penlight library as well as the LuaLibraries which are part of the settings.
debug.getDrawables()#
Returns a list of all drawables that can be used e.g. for key.setIcon().system#
system.toast()#
nil system.toast( text:string )
? system.toast{ text:string [returnHttpResult:boolean/default=false] }
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]}
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#
system.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]}
system.notifications.get()#
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] }
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.
system.notifications.constants#
contains a map of constant key-values-pairs
system.network#
system.network.monitor()#
monitor:obj network.monitor{onAvailable:callback onLost:callback transports:array [capabilities:array]}
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.
system.network.capabilities#
contains a map of constant key-values-pairs
http#
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]}
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]}
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]}
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]}
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]}
See http.request() for details.
http.listen()#
Listen for HTTP requests underhttps://<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()#
Stop listening for HTTP requests. Parameter handle must be the return value from previous call to http.listen().dialog#
dialog.show()#
Shows the provided text in fullscreen.Info
function is deprecated and may get removed in future, use system.toast() instead.
xml#
xml.eval()#
Convert the provided xml-string into a xml object.xml.append()#
Create new XmlObj likexml.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()#
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()#
Return string representation of the provided XmlObj.xml.find()#
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()#
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()#
Returns or sets the tag of the XmlObj.Iftag
nil, returns the tag of the provided XmlObj.
If tag
is a string, changes the tag of the XmlObj.
json#
json.object()#
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()#
Parse a string and return a json object.json.insert()#
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()#
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()#
Return string representation of the provided json object or array.bluetooth#
bluetooth.unregisterRangeCheck()#
nil bluetooth.unregisterRangeCheck(addr:string, callback:function)
nil bluetooth.unregisterRangeCheck{addr:string, callback:function}
bluetooth.registerRangeCheck()#
nil bluetooth.registerRangeCheck(addr:string, callback:function)
nil bluetooth.registerRangeCheck{addr:string, callback:function}
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()#
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#
time.sleep()#
sleeps up to 5 minutesInfo
function is deprecated and may get removed in future, use time.callbackIn() instead.
time.unregister()#
unregister to get a callback every passing minutetime.register()#
register to get a callback every passing minutetime.callbackIn()#
register LuaFunction callback, to be called in delayInSecondstime.callbackIn(callMe, 0.1) will call callMe in 100 milliseconds.
smallest resolution is 1 ms
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#
phoneInfo.getBrand()#
Returns either Auerswald or FontevophoneInfo.getMacAddress()#
Returns the mac address of the phone.phoneInfo.getIPs()#
Returns a table/array of all IPs the phone has.IPv4's get listed up front, followed by all IPv6'sphoneInfo.getModel()#
Returns the model of the phone, e.g.: D400phoneInfo.getFwVersion()#
Returns the firmware version, e.g.: 1.6Aconfig#
config.unregister()#
nil config.unregister( path:string, callback:function )
nil config.unregister{ path:string callback:function }
path is the xPath to a setting or group of settings.
config.set()#
Set a setting-value.path is the xPath to the desired setting.
value holds the new desired value.
config.get()#
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 }
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.