... | ... | @@ -11,7 +11,7 @@ |
|
|
* PFAL event call back -> avl.event(timeout)
|
|
|
* PFAL state request -> avl.state(type[,index])
|
|
|
|
|
|
# prerequisite Setup
|
|
|
## prerequisite Setup
|
|
|
* use you preferred OS
|
|
|
* install a bash and zip to compile a frp
|
|
|
- on Windows you can use WSL(https://docs.microsoft.com/en-us/windows/wsl/install-win10) or Cygwin (https://www.cygwin.com/)
|
... | ... | @@ -37,15 +37,22 @@ |
|
|
|
|
|
|
|
|
|
|
|
# Sample Code
|
|
|
## Sample Code
|
|
|
Sample is in the master branch of this project.
|
|
|
so please checkout this project from here : git@git.falcom.de:pub/demo_lua.git
|
|
|
The master branch will contain all snippets and demo script as well as a shell script to build OTA update package for FALCOM AVL.
|
|
|
|
|
|
## LUA Script Execution in PFAL
|
|
|
|
|
|
### LUA PFAL Commands
|
|
|
* $PFAL,SYS.Lua.Start
|
|
|
* $PFAL,SYS.Lua.Stop
|
|
|
* $PFAL,SYS.Lua.Dump
|
|
|
* $PFAL,SYS.LUA.Event,<id>,<"text"> //catch a LUA generated Event in PFAL
|
|
|
|
|
|
## built in function
|
|
|
|
|
|
# Built in callback function
|
|
|
### Built in callback function
|
|
|
* sResult := avl.version()
|
|
|
* iResult := avl.timer(index)
|
|
|
* iResult := avl.trigger(index)
|
... | ... | @@ -60,7 +67,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
* sValue := avl.gsm_imsi()
|
|
|
* sValue := avl.gsm_iccid()
|
|
|
|
|
|
# Event Notification ev := [
|
|
|
### Event Notification ev := [
|
|
|
ev.type // integer event type
|
|
|
ev.time // integer timestamp
|
|
|
ev.idx // integer subindex
|
... | ... | @@ -78,7 +85,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
ev.u_smstext // string SMS text
|
|
|
]
|
|
|
|
|
|
# State Requests state := [
|
|
|
### State Requests state := [
|
|
|
state.type // integer state type
|
|
|
state.idx // integer subindex
|
|
|
state.u_bool // boolean value type
|
... | ... | @@ -90,7 +97,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
state.u_opname // string operator name
|
|
|
]
|
|
|
|
|
|
# GPS data record := [
|
|
|
### GPS data record := [
|
|
|
lat // Latidude (degree)
|
|
|
lon // Latidude (degree)
|
|
|
alt // Altidude (meter)
|
... | ... | @@ -104,7 +111,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
fix // fix (boolean)
|
|
|
]
|
|
|
|
|
|
# GPS satellites record := [
|
|
|
### GPS satellites record := [
|
|
|
gps_num // Number of GPS satellites
|
|
|
gps_sat1 // Dump of satellite data
|
|
|
.. // "SatID,Elevation,Azimuth,AvgCNo,Used"
|
... | ... | @@ -115,7 +122,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
gls_sat12
|
|
|
]
|
|
|
|
|
|
# GSM data record := [
|
|
|
### GSM data record := [
|
|
|
state // GSM state
|
|
|
csq // CSQ value
|
|
|
creg // CREG value
|
... | ... | @@ -129,7 +136,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
]
|
|
|
|
|
|
|
|
|
# Motion data record := [
|
|
|
### Motion data record := [
|
|
|
val_x // Current X acceleration
|
|
|
val_y // Current Y acceleration
|
|
|
val_z // Current Z acceleration
|
... | ... | @@ -144,7 +151,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
nsum_z // Normal Z gravitation
|
|
|
]
|
|
|
|
|
|
# TCP Socket
|
|
|
### TCP Socket
|
|
|
```lua
|
|
|
socket := net.create_socket([type, param])
|
|
|
socket:connect(<"IP"|"URL">, port)
|
... | ... | @@ -164,7 +171,7 @@ The master branch will contain all snippets and demo script as well as a shell s |
|
|
socket:on(<"connection"|"disconnection"|"sent"|"receive">, function())
|
|
|
```
|
|
|
|
|
|
# Constant Types
|
|
|
### Constant Types
|
|
|
NET_TCP, NET_UDP - socket type
|
|
|
|
|
|
ALARM_TCP_SOCKET_IFUP, ALARM_TCP_SOCKET_IFDOWN, ALARM_TCP_SOCKET_CONNECTED,
|
... | ... | @@ -202,31 +209,31 @@ INCOMING_DATA_CALL, INCOMING_FAX_CALL, OUTGOING_VOICE_CALL, INSIDE_VOICE_CALL |
|
|
TIMER_ERASED, TIMER_INACTIVE, TIMER_PAUSED, TIMER_RUNNING
|
|
|
|
|
|
## LUA library:
|
|
|
# LUA "os" library:
|
|
|
### LUA "os" library:
|
|
|
os.clock(), os.date(), os.time(), os.difftime(), os.exit(), os.execute(),
|
|
|
os.getenv(), os.setenv(), os.setlocale()
|
|
|
|
|
|
# LUA "coroutine" library:
|
|
|
### LUA "coroutine" library:
|
|
|
coroutine.create(), coroutine.resume(), coroutine.running(),
|
|
|
coroutine.status(), coroutine.wrap(), coroutine.yield()
|
|
|
|
|
|
# LUA "string" library:
|
|
|
### LUA "string" library:
|
|
|
string.byte(), string.char(), string.dump(), string.find(), string.format(),
|
|
|
string.gmatch(), string.gsub(), string.len(), string.lower(), string.match(),
|
|
|
string.rep(), string.reverse(), string.sub(), string.upper(), string.replace()
|
|
|
|
|
|
# LUA "table" library:
|
|
|
### LUA "table" library:
|
|
|
table.concat(), table.insert(), table.pack(), table.unpack(), table.remove(),
|
|
|
table.sort()
|
|
|
|
|
|
# LUA "math" library:
|
|
|
### LUA "math" library:
|
|
|
math.abs(), math.acos(), math.asin(), math.atan2(), math.atan(), math.ceil(),
|
|
|
math.cosh(), math.cos(), math.deg(), math.exp(), math.floor(), math.fmod(),
|
|
|
math.frexp(), math.ldexp(), math.log(), math.max(), math.min(), math.modf(),
|
|
|
math.pow(), math.rad(), math.random(), math.randomseed(), math.sinh(),
|
|
|
math.sin(), math.sqrt(), math.tanh(), math.tan()
|
|
|
|
|
|
# LUA "bit32" library:
|
|
|
### LUA "bit32" library:
|
|
|
bit32.arshift(), bit32.band(), bit32.bnot(), bit32.bor(), bit32.bxor(),
|
|
|
bit32.btest(), bit32.extract(), bit32.lrotate(), bit32.lshift(),
|
|
|
bit32.replace(), bit32.rrotate(), bit32.rshift()
|
... | ... | |