|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 MARIONETTE_HEAD_JS = "stk_helper.js"; |
|
5 |
|
6 function testLocalInfoLocation(cmd) { |
|
7 log("STK CMD " + JSON.stringify(cmd)); |
|
8 is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
|
9 is(cmd.commandNumber, 0x01); |
|
10 is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LOCATION_INFO); |
|
11 is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LOCATION_INFO); |
|
12 |
|
13 runNextTest(); |
|
14 } |
|
15 |
|
16 function testLocalInfoImei(cmd) { |
|
17 log("STK CMD " + JSON.stringify(cmd)); |
|
18 is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
|
19 is(cmd.commandNumber, 0x01); |
|
20 is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_IMEI); |
|
21 is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_IMEI); |
|
22 |
|
23 runNextTest(); |
|
24 } |
|
25 |
|
26 function testLocalInfoDate(cmd) { |
|
27 log("STK CMD " + JSON.stringify(cmd)); |
|
28 is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
|
29 is(cmd.commandNumber, 0x01); |
|
30 is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE); |
|
31 is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_DATE_TIME_ZONE); |
|
32 |
|
33 runNextTest(); |
|
34 } |
|
35 |
|
36 function testLocalInfoLanguage(cmd) { |
|
37 log("STK CMD " + JSON.stringify(cmd)); |
|
38 is(cmd.typeOfCommand, iccManager.STK_CMD_PROVIDE_LOCAL_INFO); |
|
39 is(cmd.commandNumber, 0x01); |
|
40 is(cmd.commandQualifier, iccManager.STK_LOCAL_INFO_LANGUAGE); |
|
41 is(cmd.options.localInfoType, iccManager.STK_LOCAL_INFO_LANGUAGE); |
|
42 |
|
43 runNextTest(); |
|
44 } |
|
45 |
|
46 function testRefresh(cmd) { |
|
47 log("STK CMD " + JSON.stringify(cmd)); |
|
48 is(cmd.typeOfCommand, iccManager.STK_CMD_REFRESH); |
|
49 is(cmd.commandNumber, 0x01); |
|
50 is(cmd.commandQualifier, 0x01); |
|
51 is(cmd.options, null); |
|
52 |
|
53 runNextTest(); |
|
54 } |
|
55 |
|
56 function testTimerManagementStart(cmd) { |
|
57 log("STK CMD " + JSON.stringify(cmd)); |
|
58 is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); |
|
59 is(cmd.commandNumber, 0x01); |
|
60 is(cmd.commandQualifier, iccManager.STK_TIMER_START); |
|
61 is(cmd.options.timerAction, iccManager.STK_TIMER_START); |
|
62 is(cmd.options.timerId, 0x01); |
|
63 is(cmd.options.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03); |
|
64 |
|
65 runNextTest(); |
|
66 } |
|
67 |
|
68 function testTimerManagementDeactivate(cmd) { |
|
69 log("STK CMD " + JSON.stringify(cmd)); |
|
70 is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); |
|
71 is(cmd.commandNumber, 0x01); |
|
72 is(cmd.commandQualifier, iccManager.STK_TIMER_DEACTIVATE); |
|
73 is(cmd.options.timerAction, iccManager.STK_TIMER_DEACTIVATE); |
|
74 is(cmd.options.timerId, 0x04); |
|
75 |
|
76 runNextTest(); |
|
77 } |
|
78 |
|
79 function testTimerManagementGetCurrentValue(cmd) { |
|
80 log("STK CMD " + JSON.stringify(cmd)); |
|
81 is(cmd.typeOfCommand, iccManager.STK_CMD_TIMER_MANAGEMENT); |
|
82 is(cmd.commandNumber, 0x01); |
|
83 is(cmd.commandQualifier, iccManager.STK_TIMER_GET_CURRENT_VALUE); |
|
84 is(cmd.options.timerAction, iccManager.STK_TIMER_GET_CURRENT_VALUE); |
|
85 is(cmd.options.timerId, 0x08); |
|
86 |
|
87 runNextTest(); |
|
88 } |
|
89 |
|
90 let tests = [ |
|
91 {command: "d009810301260082028182", |
|
92 func: testLocalInfoLocation}, |
|
93 {command: "d009810301260182028182", |
|
94 func: testLocalInfoImei}, |
|
95 {command: "d009810301260382028182", |
|
96 func: testLocalInfoDate}, |
|
97 {command: "d009810301260482028182", |
|
98 func: testLocalInfoLanguage}, |
|
99 {command: "d011810301270082028182a40101a503102030", |
|
100 func: testTimerManagementStart}, |
|
101 {command: "d00c810301270182028182a40104", |
|
102 func: testTimerManagementDeactivate}, |
|
103 {command: "d00c810301270282028182a40108", |
|
104 func: testTimerManagementGetCurrentValue}, |
|
105 ]; |
|
106 |
|
107 runNextTest(); |