update: ec7xx的bsp地址已经改了
[LuatOS.git] / demo / jt808 / paraCtrl.lua
blobe765504e3ea4bb8cecb73308ca1f62affbf48f9b
1 local paraCtrl = {}
3 --终端自身的手机号码
4 function paraCtrl.getTerminalNum()
5 return "13937000000"
6 end
9 --省域ID
10 function paraCtrl.getProvinceId()
11 return 0
12 end
14 --区县ID
15 function paraCtrl.getCityId()
16 return 0
17 end
19 --制造商ID
20 function paraCtrl.getManufactureId()
21 return "00001"
22 end
24 --终端型号
25 function paraCtrl.getTerminalModule()
26 return "GT808"..string.rep(string.char(0),20-("GT808"):len())
27 end
29 --终端ID
30 function paraCtrl.getTerminalId()
31 --return ("12341234001".."000"):fromHex()
32 return ("00000000000000"):fromHex()
33 end
35 --车辆颜色
36 function paraCtrl.getCarColor()
37 return 0
38 end
40 --车辆标识
41 function paraCtrl.getCarNumber()
42 return "41048063212"
43 end
48 function paraCtrl.setPara(id,len,data)
49 local value
50 if len==1 then
51 value = data:byte(1)
52 elseif len==2 then
53 _,value = pack.unpack(data,">H")
54 elseif len==4 then
55 _,value = pack.unpack(data,">i")
56 end
58 local numberPara =
60 [JT808Prot.PARA_HEART_FREQ] = "heartFreq",
61 [JT808Prot.PARA_TCP_RSP_TIMEOUT] = "tcpSndTimeout",
62 [JT808Prot.PARA_TCP_RESEND_CNT] = "tcpResendMaxCnt",
63 [JT808Prot.PARA_LOC_RPT_STRATEGY] = "locRptStrategy",
64 [JT808Prot.PARA_LOC_RPT_MODE] = "locRptMode",
65 [JT808Prot.PARA_SLEEP_LOC_RPT_FREQ] = "sleepLocRptFreq",
66 [JT808Prot.PARA_ALARM_LOC_RPT_FREQ] = "alarmLocRptFreq",
67 [JT808Prot.PARA_WAKE_LOC_RPT_FREQ] = "wakeLocRptFreq",
68 [JT808Prot.PARA_WAKE_LOC_RPT_DISTANCE] = "sleepLocRptDistance",
69 [JT808Prot.PARA_SLEEP_LOC_RPT_DISTANCE] = "alarmLocRptDistance",
70 [JT808Prot.PARA_ALARM_LOC_RPT_DISTANCE] = "wakeLocRptDistance",
71 [JT808Prot.PARA_FENCE_RADIS] = "fenceRadis",
72 [JT808Prot.PARA_ALARM_FILTER] = "alarmFilter",
73 [JT808Prot.PARA_KEY_FLAG] = "keyFlag",
74 [JT808Prot.PARA_SPEED_LIMIT] = "speedLimit",
75 [JT808Prot.PARA_SPEED_EXCEED_TIME] = "speedExceedTime",
78 if numberPara[id] then
79 fskv.set(numberPara[id],value)
80 return true
81 end
83 return false
84 end
86 return paraCtrl